Skip to content

Commit

Permalink
TimelineModel: adjust for changes in utility process main thread naming.
Browse files Browse the repository at this point in the history
This got changed in
https://chromium-review.googlesource.com/c/chromium/src/+/4129799,
so some of these threads weren't found, resulting in WICG/turtledove#499

Bug: 1432954
Change-Id: I59a235ed3ddeb5c6e2afbefaf8449f3ef4833f87
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4414780
Reviewed-by: Victor Porof <victorporof@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
(cherry picked from commit 4a76ee9)
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4436689
Commit-Queue: Paul Jensen <pauljensen@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
  • Loading branch information
Maks Orlovich committed Apr 24, 2023
1 parent 6d161df commit 0fc67e5
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 3 deletions.
10 changes: 7 additions & 3 deletions front_end/models/timeline_model/TimelineModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ export class TimelineModelImpl {
let urlForOther: Platform.DevToolsPath.UrlString|null = null;
let workletTypeForOther: WorkletType = WorkletType.NotWorklet;
if (thread.name() === TimelineModelImpl.AuctionWorkletThreadName ||
thread.name() === TimelineModelImpl.UtilityMainThreadName) {
thread.name().endsWith(TimelineModelImpl.UtilityMainThreadNameSuffix)) {
if (typeof workletUrl !== 'boolean') {
urlForOther = workletUrl;
}
Expand Down Expand Up @@ -996,7 +996,9 @@ export class TimelineModelImpl {
} else if (thread.name() === TimelineModelImpl.AuctionWorkletThreadName) {
track.url = url || Platform.DevToolsPath.EmptyUrlString;
track.name = TimelineModelImpl.nameAuctionWorklet(workletType, url);
} else if (workletType !== WorkletType.NotWorklet && thread.name() === TimelineModelImpl.UtilityMainThreadName) {
} else if (
workletType !== WorkletType.NotWorklet &&
thread.name().endsWith(TimelineModelImpl.UtilityMainThreadNameSuffix)) {
track.url = url || Platform.DevToolsPath.EmptyUrlString;
track.name = url ? i18nString(UIStrings.workletServiceS, {PH1: url}) : i18nString(UIStrings.workletService);
}
Expand Down Expand Up @@ -1919,7 +1921,9 @@ export namespace TimelineModelImpl {
export const WorkerThreadNameLegacy = 'DedicatedWorker Thread';
export const RendererMainThreadName = 'CrRendererMain';
export const BrowserMainThreadName = 'CrBrowserMain';
export const UtilityMainThreadName = 'CrUtilityMain';
// The names of threads before M111 were exactly this, but afterwards have
// it a suffix after the exact role.
export const UtilityMainThreadNameSuffix = 'CrUtilityMain';
export const AuctionWorkletThreadName = 'AuctionV8HelperThread';

export const DevToolsMetadataEvent = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,100 @@ describeWithEnvironment('TimelineModel', () => {
]);
});

it('includes utility process main thread w/M11+ name, too', () => {
const {timelineModel} = traceWithEvents([
{
'args': {
'data': {
'host': '192.168.0.105',
'pid': 1538739,
'target': 'a1e485ff-f876-41cb-90ca-85c4b684b302',
'type': 'bidder',
},
},
'cat': 'disabled-by-default-devtools.timeline',
'name': 'AuctionWorkletRunningInProcess',
'ph': 'I',
'pid': 1537480,
's': 't',
'tid': 1537480,
'ts': 962633184323,
'tts': 23961306,
},
{
'args': {'name': 'AuctionV8HelperThread'},
'cat': '__metadata',
'name': 'thread_name',
'ph': 'M',
'pid': 1538739,
'tid': 7,
'ts': 0,
},
{
'args': {'name': 'auction_worklet.CrUtilityMain'},
'cat': '__metadata',
'name': 'thread_name',
'ph': 'M',
'pid': 1538739,
'tid': 1,
'ts': 0,
},
] as unknown as SDK.TracingManager.EventPayload[]);
const trackInfo = summarizeArray(timelineModel.tracks());
assert.deepEqual(trackInfo, [
{
forMainFrame: false,
name: 'Thread 0',
processId: 1537729,
processName: 'Renderer',
threadId: 0,
threadName: '',
type: 'Other',
url: '',
},
{
forMainFrame: true,
name: 'CrRendererMain',
processId: 1537729,
processName: 'Renderer',
threadId: 1,
threadName: 'CrRendererMain',
type: 'MainThread',
url: 'https://192.168.0.105/run.html',
},
{
forMainFrame: false,
name: 'Auction Worklet Service — https://192.168.0.105',
processId: 1538739,
processName: 'Service: auction_worklet.mojom.AuctionWorkletService',
threadId: 1,
threadName: 'auction_worklet.CrUtilityMain',
type: 'Other',
url: 'https://192.168.0.105',
},
{
forMainFrame: false,
name: 'Bidder Worklet — https://192.168.0.105',
processId: 1538739,
processName: 'Service: auction_worklet.mojom.AuctionWorkletService',
threadId: 7,
threadName: 'AuctionV8HelperThread',
type: 'Other',
url: 'https://192.168.0.105',
},
{
forMainFrame: false,
name: '',
processId: 1537729,
processName: 'Renderer',
threadId: 1,
threadName: 'CrRendererMain',
type: 'Experience',
url: '',
},
]);
});

it('handles auction worklet exit events', () => {
const {timelineModel} = traceWithEvents([
{
Expand Down

0 comments on commit 0fc67e5

Please sign in to comment.