@@ -11,8 +11,7 @@ import collections = require('vs/base/common/collections');
1111import URI from 'vs/base/common/uri' ;
1212import Event , { Emitter } from 'vs/base/common/event' ;
1313import Severity from 'vs/base/common/severity' ;
14- import { IThreadService , IThreadSynchronizableObject } from 'vs/platform/thread/common/thread' ;
15- import { MainThreadAttr } from 'vs/platform/thread/common/threadService' ;
14+ import { Remotable , IThreadService } from 'vs/platform/thread/common/thread' ;
1615import { IMarkerService , IMarkerData , IResourceMarker , IMarker , MarkerStatistics } from './markers' ;
1716
1817interface Key {
@@ -49,42 +48,23 @@ export interface MarkerData {
4948 [ k : string ] : IMarkerData [ ] ;
5049}
5150
52- export class MarkerService implements IMarkerService , IThreadSynchronizableObject < MarkerData > {
51+
52+ export abstract class MarkerService implements IMarkerService {
5353 public serviceId = IMarkerService ;
5454 private _data : { [ k : string ] : IMarkerData [ ] } ;
5555 private _stats : MarkerStatistics ;
5656 private _onMarkerChanged : Emitter < URI [ ] > ;
5757
58- constructor ( threadService : IThreadService ) {
58+ constructor ( ) {
5959 this . _data = Object . create ( null ) ;
6060 this . _stats = this . _emptyStats ( ) ;
6161 this . _onMarkerChanged = new Emitter < URI [ ] > ( ) ;
62- threadService . registerInstance ( this ) ;
63- }
64-
65- // ---- IThreadSynchronizableObject ------------------------------
66-
67- public getId ( ) : string {
68- return '__markerService' ;
69- }
70-
71- public getSerializableState ( ) : MarkerData {
72- return this . _data ;
73- }
74-
75- public setData ( data : MarkerData ) : void {
76- this . _data = data ;
7762 }
7863
7964 public getStatistics ( ) : MarkerStatistics {
8065 return this . _stats ;
8166 }
8267
83- // ---- Threading attributes to invoke functions everywhere ------
84-
85- static $changeOne = MainThreadAttr ( MarkerService , MarkerService . prototype . changeOne ) ;
86- static $changeAll = MainThreadAttr ( MarkerService , MarkerService . prototype . changeAll ) ;
87-
8868 // ---- IMarkerService ------------------------------------------
8969
9070 public get onMarkerChanged ( ) : Event < URI [ ] > {
@@ -306,4 +286,40 @@ export class MarkerService implements IMarkerService, IThreadSynchronizableObjec
306286 data . endLineNumber = data . endLineNumber >= data . startLineNumber ? data . endLineNumber : data . startLineNumber ;
307287 data . endColumn = data . endColumn > 0 ? data . endColumn : data . startColumn ;
308288 }
309- }
289+ }
290+
291+ export class SecondaryMarkerService extends MarkerService {
292+
293+ private _proxy : MainProcessMarkerService ;
294+
295+ constructor ( threadService : IThreadService ) {
296+ super ( ) ;
297+ this . _proxy = threadService . getRemotable ( MainProcessMarkerService ) ;
298+ }
299+
300+ public changeOne ( owner : string , resource : URI , markers : IMarkerData [ ] ) : void {
301+ this . _proxy . changeOne ( owner , resource , markers ) ;
302+ }
303+
304+ public changeAll ( owner : string , data : IResourceMarker [ ] ) : void {
305+ this . _proxy . changeAll ( owner , data ) ;
306+ }
307+
308+ }
309+
310+ @Remotable . MainContext ( 'MainProcessMarkerService' )
311+ export class MainProcessMarkerService extends MarkerService {
312+
313+ constructor ( threadService : IThreadService ) {
314+ super ( ) ;
315+ threadService . registerRemotableInstance ( MainProcessMarkerService , this ) ;
316+ }
317+
318+ public changeOne ( owner : string , resource : URI , markers : IMarkerData [ ] ) : void {
319+ super . changeOne ( owner , resource , markers ) ;
320+ }
321+
322+ public changeAll ( owner : string , data : IResourceMarker [ ] ) : void {
323+ super . changeAll ( owner , data ) ;
324+ }
325+ }
0 commit comments