diff options
author | Steve Golton <stevegolton@google.com> | 2023-12-13 15:39:59 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-12-13 15:39:59 +0000 |
commit | 1fa63d9b0eac470a81abd123291236ea7191c85c (patch) | |
tree | 3955144c120be87fbeb60306422c87d9e4870649 | |
parent | 58aa64e3ace694beafa9dce34d9ac2c2f77b2c85 (diff) | |
parent | 7a9a4f8512945bada511d506f5947175ac4479aa (diff) | |
download | perfetto-1fa63d9b0eac470a81abd123291236ea7191c85c.tar.gz |
Merge "[ui] Pass pre-calculated depth to V2 tracks." into main am: f79d967eab am: eb7bf256a8 am: 7a9a4f8512
Original change: https://android-review.googlesource.com/c/platform/external/perfetto/+/2873555
Change-Id: I0d4c1b9c91e2ea1400ffdeb9612b1bd26f8c86f1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | ui/src/frontend/slice_layout.ts | 28 | ||||
-rw-r--r-- | ui/src/tracks/async_slices/async_slice_track_v2.ts | 6 | ||||
-rw-r--r-- | ui/src/tracks/chrome_slices/index.ts | 9 | ||||
-rw-r--r-- | ui/src/tracks/frames/actual_frames_track_v2.ts | 6 | ||||
-rw-r--r-- | ui/src/tracks/frames/expected_frames_track_v2.ts | 6 |
5 files changed, 36 insertions, 19 deletions
diff --git a/ui/src/frontend/slice_layout.ts b/ui/src/frontend/slice_layout.ts index ca655bdad..9a2fa15b6 100644 --- a/ui/src/frontend/slice_layout.ts +++ b/ui/src/frontend/slice_layout.ts @@ -13,15 +13,15 @@ // limitations under the License. export interface SliceLayoutBase { - padding: number; // top/bottom pixel padding between slices and track. - rowSpacing: number; // Spacing between rows. - minDepth: number; // Minimum depth a slice can be (normally zero) + readonly padding: number; // vertical pixel padding between slices and track. + readonly rowSpacing: number; // Spacing between rows. + readonly minDepth: number; // Minimum depth a slice can be (normally zero) // Maximum depth a slice can be plus 1 (a half open range with minDepth). // We have a optimization for when maxDepth - minDepth == 1 so it is useful // to set this correctly: - maxDepth: number; - titleSizePx?: number; - subtitleSizePx?: number; + readonly maxDepth: number; + readonly titleSizePx?: number; + readonly subtitleSizePx?: number; } export const SLICE_LAYOUT_BASE_DEFAULTS: SliceLayoutBase = Object.freeze({ @@ -34,8 +34,8 @@ export const SLICE_LAYOUT_BASE_DEFAULTS: SliceLayoutBase = Object.freeze({ }); export interface SliceLayoutFixed extends SliceLayoutBase { - heightMode: 'FIXED'; - fixedHeight: number; // Outer height of the track. + readonly heightMode: 'FIXED'; + readonly fixedHeight: number; // Outer height of the track. } export const SLICE_LAYOUT_FIXED_DEFAULTS: SliceLayoutFixed = Object.freeze({ @@ -45,8 +45,8 @@ export const SLICE_LAYOUT_FIXED_DEFAULTS: SliceLayoutFixed = Object.freeze({ }); export interface SliceLayoutFitContent extends SliceLayoutBase { - heightMode: 'FIT_CONTENT'; - sliceHeight: number; // Only when heightMode = 'FIT_CONTENT'. + readonly heightMode: 'FIT_CONTENT'; + readonly sliceHeight: number; // Only when heightMode = 'FIT_CONTENT'. } export const SLICE_LAYOUT_FIT_CONTENT_DEFAULTS: SliceLayoutFitContent = @@ -57,10 +57,10 @@ export const SLICE_LAYOUT_FIT_CONTENT_DEFAULTS: SliceLayoutFitContent = }); export interface SliceLayoutFlat extends SliceLayoutBase { - heightMode: 'FIXED'; - fixedHeight: number; // Outer height of the track. - minDepth: 0; - maxDepth: 1; + readonly heightMode: 'FIXED'; + readonly fixedHeight: number; // Outer height of the track. + readonly minDepth: 0; + readonly maxDepth: 1; } export const SLICE_LAYOUT_FLAT_DEFAULTS: SliceLayoutFlat = Object.freeze({ diff --git a/ui/src/tracks/async_slices/async_slice_track_v2.ts b/ui/src/tracks/async_slices/async_slice_track_v2.ts index 4e87c9b50..cd2413269 100644 --- a/ui/src/tracks/async_slices/async_slice_track_v2.ts +++ b/ui/src/tracks/async_slices/async_slice_track_v2.ts @@ -13,6 +13,7 @@ // limitations under the License. import {NamedSliceTrack} from '../../frontend/named_slice_track'; +import {SLICE_LAYOUT_FIT_CONTENT_DEFAULTS} from '../../frontend/slice_layout'; import {NewTrackArgs} from '../../frontend/track'; import {Slice} from '../../public'; @@ -20,7 +21,10 @@ export class AsyncSliceTrackV2 extends NamedSliceTrack { constructor( args: NewTrackArgs, maxDepth: number, private trackIds: number[]) { super(args); - this.sliceLayout.maxDepth = maxDepth + 1; + this.sliceLayout = { + ...SLICE_LAYOUT_FIT_CONTENT_DEFAULTS, + minDepth: maxDepth + 1, + }; } getSqlSource(): string { diff --git a/ui/src/tracks/chrome_slices/index.ts b/ui/src/tracks/chrome_slices/index.ts index 8d36341a8..3d9e63830 100644 --- a/ui/src/tracks/chrome_slices/index.ts +++ b/ui/src/tracks/chrome_slices/index.ts @@ -20,6 +20,7 @@ import { NamedSliceTrack, NamedSliceTrackTypes, } from '../../frontend/named_slice_track'; +import {SLICE_LAYOUT_FIT_CONTENT_DEFAULTS} from '../../frontend/slice_layout'; import { SliceData, SliceTrackLEGACY, @@ -165,8 +166,12 @@ export interface ChromeSliceTrackTypes extends NamedSliceTrackTypes { } export class ChromeSliceTrackV2 extends NamedSliceTrack<ChromeSliceTrackTypes> { - constructor(args: NewTrackArgs, private trackId: number) { + constructor(args: NewTrackArgs, private trackId: number, maxDepth: number) { super(args); + this.sliceLayout = { + ...SLICE_LAYOUT_FIT_CONTENT_DEFAULTS, + minDepth: maxDepth + 1, + }; } // This is used by the base class to call iter(). @@ -283,7 +288,7 @@ class ChromeSlicesPlugin implements Plugin { engine: ctx.engine, trackKey, }; - return new ChromeSliceTrackV2(newTrackArgs, trackId); + return new ChromeSliceTrackV2(newTrackArgs, trackId, maxDepth); }, }); } diff --git a/ui/src/tracks/frames/actual_frames_track_v2.ts b/ui/src/tracks/frames/actual_frames_track_v2.ts index c30e67300..766041f7d 100644 --- a/ui/src/tracks/frames/actual_frames_track_v2.ts +++ b/ui/src/tracks/frames/actual_frames_track_v2.ts @@ -19,6 +19,7 @@ import { NamedSliceTrack, NamedSliceTrackTypes, } from '../../frontend/named_slice_track'; +import {SLICE_LAYOUT_FIT_CONTENT_DEFAULTS} from '../../frontend/slice_layout'; import {EngineProxy, Slice, STR_NULL} from '../../public'; const BLUE = makeColorScheme(new HSLColor('#03A9F4')); // Blue 500 @@ -47,7 +48,10 @@ export class ActualFramesTrack extends NamedSliceTrack<ActualFrameTrackTypes> { engine: EngineProxy, maxDepth: number, trackKey: string, private trackIds: number[]) { super({engine, trackKey}); - this.sliceLayout.maxDepth = maxDepth + 1; + this.sliceLayout = { + ...SLICE_LAYOUT_FIT_CONTENT_DEFAULTS, + minDepth: maxDepth + 1, + }; } // This is used by the base class to call iter(). diff --git a/ui/src/tracks/frames/expected_frames_track_v2.ts b/ui/src/tracks/frames/expected_frames_track_v2.ts index 268b4b660..a3caf5a21 100644 --- a/ui/src/tracks/frames/expected_frames_track_v2.ts +++ b/ui/src/tracks/frames/expected_frames_track_v2.ts @@ -15,6 +15,7 @@ import {HSLColor} from '../../common/color'; import {makeColorScheme} from '../../common/colorizer'; import {NamedRow, NamedSliceTrack} from '../../frontend/named_slice_track'; +import {SLICE_LAYOUT_FIT_CONTENT_DEFAULTS} from '../../frontend/slice_layout'; import {EngineProxy, Slice} from '../../public'; const GREEN = makeColorScheme(new HSLColor('#4CAF50')); // Green 500 @@ -24,7 +25,10 @@ export class ExpectedFramesTrack extends NamedSliceTrack { engine: EngineProxy, maxDepth: number, trackKey: string, private trackIds: number[]) { super({engine, trackKey}); - this.sliceLayout.maxDepth = maxDepth + 1; + this.sliceLayout = { + ...SLICE_LAYOUT_FIT_CONTENT_DEFAULTS, + minDepth: maxDepth + 1, + }; } getSqlSource(): string { |