firefox-devtools / firefox-devtools/profiler

Make CompositorScreenshot markers schema-based

Open
#5,303 0 comments 0 reactions 0 assignees View on GitHub
markers
Dominant language
TypeScript
Stars
1.5k
Forks
491
Avg merge
3d 46m
Merged PRs (30d)
27

Description

Screenshot markers are currently handled in a custom way, based on `marker.data.type === 'CompositorScreenshot'`.

These markers don't have a schema. We expect the presence of certain fields (`windowID`, `url`, `windowWidth`, `windowHeight`) based on the type and the name.

We have custom code in three places:

1. When computing derived markers, we turn these markers from instant markers into interval markers.
2. In the marker tooltip, we have custom code to render the image and the window size.
3. Screenshot tracks are created based on these markers.

For #5302 we'll have to add a schema for these markers which declares all fields.
And it might make sense to simplify marker derivation at the same time, if we have to add an upgrader for these markers anyway.

---

I suggest the following:

1. Add a marker field format called `screenshot-size`, expecting a value of type `{ width: number, height: number }`, so that the window size is displayed as a single field in the tooltip.
2. Add a marker field format called `screenshot-data-url`, maybe with an extra `sizeFieldForAspectRatio: string` annotation, for the data URL field.
3. To simplify computing derived markers, we should make it so that these markers are start + end markers in the profile, instead of instant markers. We can include the windowID in the marker name, so that the usual name-based matching of start/end markers works for these markers.
4. Add an upgrader for the processed format which performs the migration, and add code to profile processing which does the same. Then we can separately change the gecko format and remove this new profile processing code, at our own pace.

┆Issue is synchronized with this [Jira Task](https://mozilla-hub.atlassian.net/browse/FP-853)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.