@@ -7,7 +7,7 @@ import { URI } from 'vs/base/common/uri';
77import { Event , Emitter } from 'vs/base/common/event' ;
88import { IDecorationsService , IDecoration , IResourceDecorationChangeEvent , IDecorationsProvider , IDecorationData } from './decorations' ;
99import { TernarySearchTree } from 'vs/base/common/map' ;
10- import { Disposable , IDisposable , toDisposable , dispose } from 'vs/base/common/lifecycle' ;
10+ import { Disposable , IDisposable , toDisposable } from 'vs/base/common/lifecycle' ;
1111import { isThenable } from 'vs/base/common/async' ;
1212import { LinkedList } from 'vs/base/common/linkedList' ;
1313import { createStyleSheet , createCSSRule , removeCSSRulesContainingSelector } from 'vs/base/browser/dom' ;
@@ -334,15 +334,14 @@ class DecorationProviderWrapper {
334334 }
335335}
336336
337- export class FileDecorationsService implements IDecorationsService {
337+ export class FileDecorationsService extends Disposable implements IDecorationsService {
338338
339339 _serviceBrand : any ;
340340
341341 private readonly _data = new LinkedList < DecorationProviderWrapper > ( ) ;
342- private readonly _onDidChangeDecorationsDelayed = new Emitter < URI | URI [ ] > ( ) ;
343- private readonly _onDidChangeDecorations = new Emitter < IResourceDecorationChangeEvent > ( ) ;
342+ private readonly _onDidChangeDecorationsDelayed = this . _register ( new Emitter < URI | URI [ ] > ( ) ) ;
343+ private readonly _onDidChangeDecorations = this . _register ( new Emitter < IResourceDecorationChangeEvent > ( ) ) ;
344344 private readonly _decorationStyles : DecorationStyles ;
345- private readonly _disposables : IDisposable [ ] ;
346345
347346 readonly onDidChangeDecorations : Event < IResourceDecorationChangeEvent > = Event . any (
348347 this . _onDidChangeDecorations . event ,
@@ -356,27 +355,17 @@ export class FileDecorationsService implements IDecorationsService {
356355 constructor (
357356 @IThemeService themeService : IThemeService
358357 ) {
359- this . _decorationStyles = new DecorationStyles ( themeService ) ;
358+ super ( ) ;
359+ this . _decorationStyles = this . _register ( new DecorationStyles ( themeService ) ) ;
360360
361361 // every so many events we check if there are
362362 // css styles that we don't need anymore
363363 let count = 0 ;
364- let reg = this . onDidChangeDecorations ( ( ) => {
364+ this . _register ( this . onDidChangeDecorations ( ( ) => {
365365 if ( ++ count % 17 === 0 ) {
366366 this . _decorationStyles . cleanUp ( this . _data . iterator ( ) ) ;
367367 }
368- } ) ;
369-
370- this . _disposables = [
371- reg ,
372- this . _decorationStyles
373- ] ;
374- }
375-
376- dispose ( ) : void {
377- dispose ( this . _disposables ) ;
378- dispose ( this . _onDidChangeDecorations ) ;
379- dispose ( this . _onDidChangeDecorationsDelayed ) ;
368+ } ) ) ;
380369 }
381370
382371 registerDecorationsProvider ( provider : IDecorationsProvider ) : IDisposable {
0 commit comments