Move trace converter behind interface Change-Id: I2f6d3191a3d502489f9c2e26bc6ed1d2ea7ee7d2
diff --git a/ui/src/core/trace_impl.ts b/ui/src/core/trace_impl.ts index c0c6bb7..e6dbd34 100644 --- a/ui/src/core/trace_impl.ts +++ b/ui/src/core/trace_impl.ts
@@ -55,7 +55,7 @@ import {Setting, SettingDescriptor, SettingsManager} from '../public/settings'; import {SettingsManagerImpl} from './settings_manager'; import {MinimapManagerImpl} from './minimap_manager'; -import {TraceConverter} from '../frontend/trace_converter'; +import {TraceConverterImpl} from '../frontend/trace_converter'; /** * Handles the per-trace state of the UI @@ -196,7 +196,7 @@ private readonly sidebarProxy: SidebarManagerImpl; private readonly pageMgrProxy: PageManagerImpl; private readonly settingsProxy: SettingsManagerImpl; - readonly traceConverter: TraceConverter; + readonly traceConverter: TraceConverterImpl; // This is called by TraceController when loading a new trace, soon after the // engine has been set up. It obtains a new TraceImpl for the core. From that @@ -222,7 +222,7 @@ this.traceCtx = ctx; const traceUnloadTrash = ctx.trash; - this.traceConverter = new TraceConverter(appImpl, this); + this.traceConverter = new TraceConverterImpl(appImpl, this); // Invalidate all the engine proxies when the TraceContext is destroyed. this.engineProxy = ctx.engine.getProxy(pluginId);
diff --git a/ui/src/frontend/trace_converter.ts b/ui/src/frontend/trace_converter.ts index 27e798f..aa0553c 100644 --- a/ui/src/frontend/trace_converter.ts +++ b/ui/src/frontend/trace_converter.ts
@@ -20,6 +20,7 @@ import {time} from '../base/time'; import {AppImpl} from '../core/app_impl'; import {Trace} from '../public/trace'; +import {TraceConverter} from '../public/trace_converter'; type Args = | UpdateStatusArgs @@ -59,7 +60,7 @@ size: number, ) => void; -export class TraceConverter { +export class TraceConverterImpl implements TraceConverter { constructor( private readonly app: AppImpl, private readonly trace: Trace,
diff --git a/ui/src/public/trace.ts b/ui/src/public/trace.ts index fdebd42..42d1a9d 100644 --- a/ui/src/public/trace.ts +++ b/ui/src/public/trace.ts
@@ -28,7 +28,7 @@ import {StatusbarManager} from './statusbar'; import {MinimapManager} from './minimap'; import {SearchManager} from './search'; -import {TraceConverter} from '../frontend/trace_converter'; +import {TraceConverter} from './trace_converter'; // Lists all the possible event listeners using the key as the event name and // the type as the type of the callback.
diff --git a/ui/src/public/trace_converter.ts b/ui/src/public/trace_converter.ts new file mode 100644 index 0000000..93278d1 --- /dev/null +++ b/ui/src/public/trace_converter.ts
@@ -0,0 +1,21 @@ +// Copyright (C) 2025 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import {time} from '../base/time'; + +export interface TraceConverter { + convertTraceToJsonAndDownload(): Promise<void>; + convertTraceToSystraceAndDownload(): Promise<void>; + convertTraceToPprofAndDownload(pid: number, ts: time): Promise<void>; +}