mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
Metered network connections support (#288919)
Includes public API, user setting, status bar icon and a new service to support metered network connections. Updates code in various areas performing automated actions using network to delay/pause network operations while network connection is being metered.
This commit is contained in:
@@ -60,6 +60,10 @@ import { ILifecycleMainService, LifecycleMainPhase, ShutdownReason } from '../..
|
||||
import { ILoggerService, ILogService } from '../../platform/log/common/log.js';
|
||||
import { IMenubarMainService, MenubarMainService } from '../../platform/menubar/electron-main/menubarMainService.js';
|
||||
import { INativeHostMainService, NativeHostMainService } from '../../platform/native/electron-main/nativeHostMainService.js';
|
||||
import { IMeteredConnectionService } from '../../platform/meteredConnection/common/meteredConnection.js';
|
||||
import { METERED_CONNECTION_CHANNEL } from '../../platform/meteredConnection/common/meteredConnectionIpc.js';
|
||||
import { MeteredConnectionChannel } from '../../platform/meteredConnection/electron-main/meteredConnectionChannel.js';
|
||||
import { MeteredConnectionMainService } from '../../platform/meteredConnection/electron-main/meteredConnectionMainService.js';
|
||||
import { IProductService } from '../../platform/product/common/productService.js';
|
||||
import { getRemoteAuthority } from '../../platform/remote/common/remoteHosts.js';
|
||||
import { SharedProcess } from '../../platform/sharedProcess/electron-main/sharedProcess.js';
|
||||
@@ -589,6 +593,11 @@ export class CodeApplication extends Disposable {
|
||||
// Error telemetry
|
||||
appInstantiationService.invokeFunction(accessor => this._register(new ErrorTelemetry(accessor.get(ILogService), accessor.get(ITelemetryService))));
|
||||
|
||||
// Metered connection telemetry
|
||||
appInstantiationService.invokeFunction(accessor => {
|
||||
(accessor.get(IMeteredConnectionService) as MeteredConnectionMainService).setTelemetryService(accessor.get(ITelemetryService));
|
||||
});
|
||||
|
||||
// Auth Handler
|
||||
appInstantiationService.invokeFunction(accessor => accessor.get(IProxyAuthService));
|
||||
|
||||
@@ -1039,6 +1048,10 @@ export class CodeApplication extends Disposable {
|
||||
// Native Host
|
||||
services.set(INativeHostMainService, new SyncDescriptor(NativeHostMainService, undefined, false /* proxied to other processes */));
|
||||
|
||||
// Metered Connection
|
||||
const meteredConnectionService = new MeteredConnectionMainService(this.configurationService);
|
||||
services.set(IMeteredConnectionService, meteredConnectionService);
|
||||
|
||||
// Web Contents Extractor
|
||||
services.set(IWebContentExtractorService, new SyncDescriptor(NativeWebContentExtractorService, undefined, false /* proxied to other processes */));
|
||||
|
||||
@@ -1168,6 +1181,11 @@ export class CodeApplication extends Disposable {
|
||||
const updateChannel = new UpdateChannel(accessor.get(IUpdateService));
|
||||
mainProcessElectronServer.registerChannel('update', updateChannel);
|
||||
|
||||
// Metered Connection
|
||||
const meteredConnectionChannel = new MeteredConnectionChannel(accessor.get(IMeteredConnectionService) as MeteredConnectionMainService);
|
||||
mainProcessElectronServer.registerChannel(METERED_CONNECTION_CHANNEL, meteredConnectionChannel);
|
||||
sharedProcessClient.then(client => client.registerChannel(METERED_CONNECTION_CHANNEL, meteredConnectionChannel));
|
||||
|
||||
// Process
|
||||
const processChannel = ProxyChannel.fromService(new ProcessMainService(this.logService, accessor.get(IDiagnosticsService), accessor.get(IDiagnosticsMainService)), disposables);
|
||||
mainProcessElectronServer.registerChannel('process', processChannel);
|
||||
|
||||
Reference in New Issue
Block a user