monitor -> service

This commit is contained in:
Johannes Rieken
2016-09-07 10:31:21 +02:00
parent 94acaef890
commit af55c20055
8 changed files with 23 additions and 23 deletions

View File

@@ -0,0 +1,32 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IDisposable} from 'vs/base/common/lifecycle';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {ExtHostContext} from './extHost.protocol';
import {onDidGarbageCollectSignals, consumeSignals} from 'gc-signals';
export class MainThreadHeapService {
private _subscription: IDisposable;
private _consumeHandle: number;
constructor( @IThreadService threadService: IThreadService) {
const proxy = threadService.get(ExtHostContext.ExtHostHeapService);
this._subscription = onDidGarbageCollectSignals(ids => {
proxy.$onGarbageCollection(ids);
});
this._consumeHandle = setInterval(consumeSignals, 15 * 1000);
}
dispose() {
clearInterval(this._consumeHandle);
this._subscription.dispose();
}
}