Adds timeline view & api providers (wip) — #84297

This commit is contained in:
Eric Amodio
2020-01-14 19:15:57 -05:00
committed by Eric Amodio
parent a592b87e9c
commit 70e1e9b4f4
13 changed files with 770 additions and 4 deletions

View File

@@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { MainContext, MainThreadTimelineShape, IExtHostContext, ExtHostTimelineShape, ExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { ITimelineService, TimelineItem } from 'vs/workbench/contrib/timeline/common/timeline';
import { URI } from 'vs/base/common/uri';
import { CancellationToken } from 'vs/base/common/cancellation';
@extHostNamedCustomer(MainContext.MainThreadTimeline)
export class MainThreadTimeline implements MainThreadTimelineShape {
private readonly _proxy: ExtHostTimelineShape;
constructor(
context: IExtHostContext,
@ITimelineService private readonly _timelineService: ITimelineService
) {
this._proxy = context.getProxy(ExtHostContext.ExtHostTimeline);
}
$getTimeline(uri: URI, since: number, token: CancellationToken): Promise<TimelineItem[]> {
return this._timelineService.getTimeline(uri, since, token);
}
$registerTimelineProvider(key: string, id: string): void {
console.log(`MainThreadTimeline#registerTimelineProvider: key=${key}`);
const proxy = this._proxy;
this._timelineService.registerTimelineProvider(key, {
id: id,
provideTimeline(uri: URI, since: number, token: CancellationToken) {
return proxy.$getTimeline(key, uri, since, token);
}
});
}
$unregisterTimelineProvider(key: string): void {
console.log(`MainThreadTimeline#unregisterTimelineProvider: key=${key}`);
this._timelineService.unregisterTimelineProvider(key);
}
dispose(): void {
// noop
}
}