1// Copyright (C) 2024 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 m from 'mithril'; 16import {Anchor} from '../../widgets/anchor'; 17import {Icons} from '../../base/semantic_icons'; 18import {Trace} from '../../public/trace'; 19 20export const SCROLLS_TRACK_URI = 'perfetto.ChromeScrollJank#toplevelScrolls'; 21export const EVENT_LATENCY_TRACK_URI = 'perfetto.ChromeScrollJank#eventLatency'; 22export const JANKS_TRACK_URI = 'perfetto.ChromeScrollJank#scrollJankV3'; 23 24export function renderSliceRef(args: { 25 trace: Trace; 26 id: number; 27 trackUri: string; 28 title: m.Children; 29}) { 30 return m( 31 Anchor, 32 { 33 icon: Icons.UpdateSelection, 34 onclick: () => { 35 args.trace.selection.selectTrackEvent(args.trackUri, args.id, { 36 scrollToSelection: true, 37 }); 38 }, 39 }, 40 args.title, 41 ); 42} 43