提交 2e802ebc 编写于 作者: J Johannes Rieken

debt - move perfview editor to browser

上级 ea59ae20
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { registerAction2, Action2 } from 'vs/platform/actions/common/actions';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { Registry } from 'vs/platform/registry/common/platform';
import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import { Extensions as Input, IEditorInputFactory, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
import { PerfviewContrib, PerfviewInput } from 'vs/workbench/contrib/performance/browser/perfviewEditor';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
// -- startup performance view
Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench).registerWorkbenchContribution(
PerfviewContrib,
LifecyclePhase.Ready
);
Registry.as<IEditorInputFactoryRegistry>(Input.EditorInputFactories).registerEditorInputFactory(
PerfviewInput.Id,
class implements IEditorInputFactory {
canSerialize(): boolean {
return true;
}
serialize(): string {
return '';
}
deserialize(instantiationService: IInstantiationService): PerfviewInput {
return instantiationService.createInstance(PerfviewInput);
}
}
);
registerAction2(class extends Action2 {
constructor() {
super({
id: 'perfview.show',
title: localize('show.label', "Startup Performance"),
category: localize({ key: 'show.cat', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"),
f1: true
});
}
run(accessor: ServicesAccessor) {
const editorService = accessor.get(IEditorService);
const instaService = accessor.get(IInstantiationService);
return editorService.openEditor(instaService.createInstance(PerfviewInput));
}
});
......@@ -3,54 +3,12 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { MenuRegistry } from 'vs/platform/actions/common/actions';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { Registry } from 'vs/platform/registry/common/platform';
import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import { Extensions as Input, IEditorInputFactory, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
import { PerfviewContrib, PerfviewInput } from 'vs/workbench/contrib/performance/electron-browser/perfviewEditor';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { StartupProfiler } from './startupProfiler';
import { StartupTimings } from './startupTimings';
// -- startup performance view
Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench).registerWorkbenchContribution(
PerfviewContrib,
LifecyclePhase.Ready
);
Registry.as<IEditorInputFactoryRegistry>(Input.EditorInputFactories).registerEditorInputFactory(
PerfviewInput.Id,
class implements IEditorInputFactory {
canSerialize(): boolean {
return true;
}
serialize(): string {
return '';
}
deserialize(instantiationService: IInstantiationService): PerfviewInput {
return instantiationService.createInstance(PerfviewInput);
}
}
);
CommandsRegistry.registerCommand('perfview.show', accessor => {
const editorService = accessor.get(IEditorService);
const instaService = accessor.get(IInstantiationService);
return editorService.openEditor(instaService.createInstance(PerfviewInput));
});
MenuRegistry.addCommand({
id: 'perfview.show',
category: localize({ key: 'show.cat', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"),
title: localize('show.label', "Startup Performance")
});
// -- startup profiler
Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench).registerWorkbenchContribution(
......
......@@ -12,7 +12,7 @@ import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/enviro
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { PerfviewInput } from 'vs/workbench/contrib/performance/electron-browser/perfviewEditor';
import { PerfviewInput } from 'vs/workbench/contrib/performance/browser/perfviewEditor';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { URI } from 'vs/base/common/uri';
......
......@@ -399,5 +399,9 @@ export class TimerService extends AbstractTimerService {
protected async _getWindowCount(): Promise<number> {
return 1;
}
protected async _extendStartupInfo(_info: Writeable<IStartupMetrics>): Promise<void> { }
protected async _extendStartupInfo(info: Writeable<IStartupMetrics>): Promise<void> {
info.isVMLikelyhood = 0;
info.platform = navigator.userAgent;
info.release = navigator.appVersion;
}
}
......@@ -144,6 +144,9 @@ import 'vs/workbench/contrib/preferences/browser/preferences.contribution';
import 'vs/workbench/contrib/preferences/browser/keybindingsEditorContribution';
import 'vs/workbench/contrib/preferences/browser/preferencesSearch';
// Performance
import 'vs/workbench/contrib/performance/browser/performance.contribution';
// Notebook
import 'vs/workbench/contrib/notebook/browser/notebook.contribution';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册