[tracing] Avoid perfetto track aliasing in ['device/vr/openxr', 'third_party/blink/renderer/modules/xr']
perfetto::Track::FromPointer is problematic because pointer reuse can
cause track aliasing in perfetto UI, leading to confusing traces (this
was true of legacy TRACE_EVENT_ASYNC as well).
To avoid these, we have the following alternatives:
1- Usin GetNextGlobalTraceId() instead of a pointer id to guarantee
uniqueness. The track will get its name from the first event emitted.
2- Using NamedTrack to scope the pointer to a specific class
(an aliased track would always correctly have the same name). This
is more appropriate when there are several events emitted to the same
track without a clear name. This has the benefit of giving the track
a consistent, explicit name.
3- Replace custom track with "sync" instant events with flows.
This reduces visual clutter and retain information about where
events originated from.
This CL applies a migration to of one #1 or #2.
Questions for the reviewer:
- Design Fit: Is the choice of a dedicated async track (#1/#2)
appropriate, or would is be suitable to emit "sync" events with
flows (#3). As a rule of thumb, async tracks are appropriate to
display a clear async operation (that could be recorded as UMA),
or high level / user visible state.
- Naming: (when applicable) Is the track name I chose appropriate
This CL was uploaded by git cl split.
This CL was uploaded by git cl split.