xref: /aosp_15_r20/external/perfetto/ui/src/components/extensions.ts (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1*6dbdd20aSAndroid Build Coastguard Worker// Copyright (C) 2024 The Android Open Source Project
2*6dbdd20aSAndroid Build Coastguard Worker//
3*6dbdd20aSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*6dbdd20aSAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*6dbdd20aSAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*6dbdd20aSAndroid Build Coastguard Worker//
7*6dbdd20aSAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
8*6dbdd20aSAndroid Build Coastguard Worker//
9*6dbdd20aSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*6dbdd20aSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*6dbdd20aSAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*6dbdd20aSAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*6dbdd20aSAndroid Build Coastguard Worker// limitations under the License.
14*6dbdd20aSAndroid Build Coastguard Worker
15*6dbdd20aSAndroid Build Coastguard Workerimport {type addDebugSliceTrack} from './tracks/debug_tracks';
16*6dbdd20aSAndroid Build Coastguard Workerimport {type addDebugCounterTrack} from './tracks/debug_tracks';
17*6dbdd20aSAndroid Build Coastguard Workerimport {type addSqlTableTab} from './details/sql_table_tab';
18*6dbdd20aSAndroid Build Coastguard Workerimport {type addVisualizedArgTracks} from './tracks/visualized_args_tracks';
19*6dbdd20aSAndroid Build Coastguard Workerimport {type addQueryResultsTab} from './query_table/query_result_tab';
20*6dbdd20aSAndroid Build Coastguard Worker
21*6dbdd20aSAndroid Build Coastguard Worker// TODO(primiano & stevegolton): This injection is to break the circular
22*6dbdd20aSAndroid Build Coastguard Worker// dependency cycle that there is between various tabs and tracks.
23*6dbdd20aSAndroid Build Coastguard Worker//
24*6dbdd20aSAndroid Build Coastguard Worker// For example: DebugSliceTrack has a DebugSliceDetailsTab which shows details
25*6dbdd20aSAndroid Build Coastguard Worker// about slices, which have a context menu, which allows to create a debug track
26*6dbdd20aSAndroid Build Coastguard Worker// from it. We will break this cycle "more properly" by either:
27*6dbdd20aSAndroid Build Coastguard Worker// 1. having a registry for context menu items for slices
28*6dbdd20aSAndroid Build Coastguard Worker// 2. allowing plugins to expose API for the use of other plugins, and putting
29*6dbdd20aSAndroid Build Coastguard Worker//    these extension points there instead
30*6dbdd20aSAndroid Build Coastguard Worker
31*6dbdd20aSAndroid Build Coastguard Workerexport interface ExtensionApi {
32*6dbdd20aSAndroid Build Coastguard Worker  addDebugSliceTrack: typeof addDebugSliceTrack;
33*6dbdd20aSAndroid Build Coastguard Worker  addDebugCounterTrack: typeof addDebugCounterTrack;
34*6dbdd20aSAndroid Build Coastguard Worker  addSqlTableTab: typeof addSqlTableTab;
35*6dbdd20aSAndroid Build Coastguard Worker  addVisualizedArgTracks: typeof addVisualizedArgTracks;
36*6dbdd20aSAndroid Build Coastguard Worker  addQueryResultsTab: typeof addQueryResultsTab;
37*6dbdd20aSAndroid Build Coastguard Worker}
38*6dbdd20aSAndroid Build Coastguard Worker
39*6dbdd20aSAndroid Build Coastguard Workerexport let extensions: ExtensionApi;
40*6dbdd20aSAndroid Build Coastguard Worker
41*6dbdd20aSAndroid Build Coastguard Workerexport function configureExtensions(e: ExtensionApi) {
42*6dbdd20aSAndroid Build Coastguard Worker  extensions = e;
43*6dbdd20aSAndroid Build Coastguard Worker}
44