1// Copyright (C) 2023 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15import {NamedSliceTrackTypes} from '../named_slice_track'; 16import { 17 CustomSqlDetailsPanelConfig, 18 CustomSqlTableDefConfig, 19 CustomSqlTableSliceTrack, 20} from '../tracks/custom_sql_table_slice_track'; 21import {TrackContext} from '../../public'; 22import {Engine} from '../../trace_processor/engine'; 23import {DebugSliceDetailsTab} from './details_tab'; 24 25export class DebugSliceTrack extends CustomSqlTableSliceTrack<NamedSliceTrackTypes> { 26 private readonly sqlTableName: string; 27 28 constructor(engine: Engine, ctx: TrackContext, tableName: string) { 29 super({ 30 engine, 31 trackKey: ctx.trackKey, 32 }); 33 this.sqlTableName = tableName; 34 } 35 36 async getSqlDataSource(): Promise<CustomSqlTableDefConfig> { 37 return { 38 sqlTableName: this.sqlTableName, 39 }; 40 } 41 42 getDetailsPanel(): CustomSqlDetailsPanelConfig { 43 return { 44 kind: DebugSliceDetailsTab.kind, 45 config: { 46 sqlTableName: this.sqlTableName, 47 title: 'Debug Slice', 48 }, 49 }; 50 } 51} 52