[iOS Tracing] Add async trace events that track JS calls [chromium/src : main]

8 views
Skip to first unread message

Etienne Pierre-Doray (Gerrit)

unread,
Apr 29, 2026, 3:52:34 PMApr 29
to Justin Novosad, Mark Cogan, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
Attention needed from Justin Novosad, Mark Cogan and Rohit Rao

Etienne Pierre-Doray added 4 comments

File base/trace_event/builtin_categories.h
Line 283, Patchset 1 (Latest): perfetto::Category("webkit"),
Etienne Pierre-Doray . unresolved

Please add a description of the category with SetDescription()

File ios/web/js_messaging/web_view_js_utils.mm
Line 148, Patchset 1 (Latest):uint64_t GetNextJSExecutionTraceId() {
DCHECK([NSThread isMainThread]); // Ensure non-atomic increment is safe.
static uint64_t g_trace_id = 0;
return ++g_trace_id;
}
Etienne Pierre-Doray . unresolved

Nit: you could use base::trace_event::GetNextGlobalTraceId()

Line 200, Patchset 1 (Latest): TRACE_EVENT_END("webkit",
perfetto::NamedTrack("Injected Script", trace_id));
Etienne Pierre-Doray . unresolved

This runs after TRACE_EVENT_BEGIN() below right? (I'm a little confused with objective-C syntax)

Line 207, Patchset 1 (Latest): TRACE_EVENT_BEGIN("webkit", perfetto::DynamicString(location.ToString()),
Etienne Pierre-Doray . unresolved

You can use perfetto::StaticString since this is a compile time string IUUC.
To make sure this works for field traces.
Here and below.

Open in Gerrit

Related details

Attention is currently required from:
  • Justin Novosad
  • Mark Cogan
  • Rohit Rao
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
Gerrit-Change-Number: 7799850
Gerrit-PatchSet: 1
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
Gerrit-Attention: Justin Novosad <ju...@chromium.org>
Gerrit-Attention: Mark Cogan <ma...@chromium.org>
Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
Gerrit-Comment-Date: Wed, 29 Apr 2026 19:52:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Justin Novosad (Gerrit)

unread,
Apr 29, 2026, 4:29:04 PMApr 29
to Mark Cogan, Etienne Pierre-Doray, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
Attention needed from Etienne Pierre-Doray, Mark Cogan and Rohit Rao

Justin Novosad added 4 comments

File base/trace_event/builtin_categories.h
Line 283, Patchset 1: perfetto::Category("webkit"),
Etienne Pierre-Doray . resolved

Please add a description of the category with SetDescription()

Justin Novosad

Done

File ios/web/js_messaging/web_view_js_utils.mm
Line 148, Patchset 1:uint64_t GetNextJSExecutionTraceId() {

DCHECK([NSThread isMainThread]); // Ensure non-atomic increment is safe.
static uint64_t g_trace_id = 0;
return ++g_trace_id;
}
Etienne Pierre-Doray . resolved

Nit: you could use base::trace_event::GetNextGlobalTraceId()

Justin Novosad

Done

Line 200, Patchset 1: TRACE_EVENT_END("webkit",

perfetto::NamedTrack("Injected Script", trace_id));
Etienne Pierre-Doray . resolved

This runs after TRACE_EVENT_BEGIN() below right? (I'm a little confused with objective-C syntax)

Justin Novosad

Yes, exactly. This is the Obj-C equivalent of a C++ lambda.

Line 207, Patchset 1: TRACE_EVENT_BEGIN("webkit", perfetto::DynamicString(location.ToString()),
Etienne Pierre-Doray . unresolved

You can use perfetto::StaticString since this is a compile time string IUUC.
To make sure this works for field traces.
Here and below.

Justin Novosad

Unfortunately base::Location::ToString() returns a temporary string. I did not realize that dynamic strings don't work for field traces. This might not be the ideal approach then. I need to think more about this...

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
  • Mark Cogan
  • Rohit Rao
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
Gerrit-Change-Number: 7799850
Gerrit-PatchSet: 2
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
Gerrit-Attention: Mark Cogan <ma...@chromium.org>
Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Comment-Date: Wed, 29 Apr 2026 20:28:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Etienne Pierre-Doray (Gerrit)

unread,
Apr 29, 2026, 4:37:47 PMApr 29
to Justin Novosad, Mark Cogan, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
Attention needed from Justin Novosad, Mark Cogan and Rohit Rao

Etienne Pierre-Doray added 1 comment

File ios/web/js_messaging/web_view_js_utils.mm
Line 207, Patchset 1: TRACE_EVENT_BEGIN("webkit", perfetto::DynamicString(location.ToString()),
Etienne Pierre-Doray . unresolved

You can use perfetto::StaticString since this is a compile time string IUUC.
To make sure this works for field traces.
Here and below.

Justin Novosad

Unfortunately base::Location::ToString() returns a temporary string. I did not realize that dynamic strings don't work for field traces. This might not be the ideal approach then. I need to think more about this...

Etienne Pierre-Doray

You could fill a proto with this (which eventually shows up the in event args) similar to
https://source.chromium.org/chromium/chromium/src/+/main:base/task/common/task_annotator.cc;l=263?q=base%20task%20annotator%20location&ss=chromium

Either by reusing task_execution, or creating a new field, but then you'd need to come up with another more static name.

Open in Gerrit

Related details

Attention is currently required from:
  • Justin Novosad
  • Mark Cogan
  • Rohit Rao
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
Gerrit-Change-Number: 7799850
Gerrit-PatchSet: 2
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
Gerrit-Attention: Justin Novosad <ju...@chromium.org>
Gerrit-Attention: Mark Cogan <ma...@chromium.org>
Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
Gerrit-Comment-Date: Wed, 29 Apr 2026 20:37:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Justin Novosad <ju...@chromium.org>
Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Mark Cogan (Gerrit)

unread,
Apr 30, 2026, 4:36:28 AMApr 30
to Justin Novosad, Mike Dougherty, Etienne Pierre-Doray, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
Attention needed from Justin Novosad, Mike Dougherty and Rohit Rao

Mark Cogan added 1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Mark Cogan . resolved

+michaeldo

Open in Gerrit

Related details

Attention is currently required from:
  • Justin Novosad
  • Mike Dougherty
  • Rohit Rao
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
Gerrit-Change-Number: 7799850
Gerrit-PatchSet: 2
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
Gerrit-Reviewer: Mike Dougherty <mich...@chromium.org>
Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
Gerrit-Attention: Justin Novosad <ju...@chromium.org>
Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
Gerrit-Attention: Mike Dougherty <mich...@chromium.org>
Gerrit-Comment-Date: Thu, 30 Apr 2026 08:36:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Justin Novosad (Gerrit)

unread,
Apr 30, 2026, 10:58:00 AMApr 30
to Mike Dougherty, Mark Cogan, Etienne Pierre-Doray, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
Attention needed from Etienne Pierre-Doray, Mike Dougherty and Rohit Rao

Justin Novosad added 1 comment

File ios/web/js_messaging/web_view_js_utils.mm
Line 207, Patchset 1: TRACE_EVENT_BEGIN("webkit", perfetto::DynamicString(location.ToString()),
Etienne Pierre-Doray . unresolved

You can use perfetto::StaticString since this is a compile time string IUUC.
To make sure this works for field traces.
Here and below.

Justin Novosad

Unfortunately base::Location::ToString() returns a temporary string. I did not realize that dynamic strings don't work for field traces. This might not be the ideal approach then. I need to think more about this...

Etienne Pierre-Doray

You could fill a proto with this (which eventually shows up the in event args) similar to
https://source.chromium.org/chromium/chromium/src/+/main:base/task/common/task_annotator.cc;l=263?q=base%20task%20annotator%20location&ss=chromium

Either by reusing task_execution, or creating a new field, but then you'd need to come up with another more static name.

Justin Novosad

Okay, that worked, and it was pretty easy to re-use that same proto. Thanks! The trace graph is slightly less convenient to read this way because it now uses a static event name, but all the info we care about is still there. It's a good compromise IMHO. Also, there's no observable impact on record time performance (<microsecond). I imagine the trace buffer is significantly more compact in memory this way, but I'm not sure how to measure that.

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
  • Mike Dougherty
  • Rohit Rao
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
Gerrit-Change-Number: 7799850
Gerrit-PatchSet: 2
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
Gerrit-Reviewer: Mike Dougherty <mich...@chromium.org>
Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Attention: Mike Dougherty <mich...@chromium.org>
Gerrit-Comment-Date: Thu, 30 Apr 2026 14:57:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mike Dougherty (Gerrit)

unread,
Apr 30, 2026, 5:31:55 PMApr 30
to Justin Novosad, Mark Cogan, Etienne Pierre-Doray, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
Attention needed from Etienne Pierre-Doray, Justin Novosad and Rohit Rao

Mike Dougherty added 1 comment

Patchset-level comments
File-level comment, Patchset 6 (Latest):
Mike Dougherty . unresolved

There is a lot of piping taking place in this CL and no context in the associated bug. Is it possible to provide some additional context about why this is necessary?

Additionally, is it possible to land the core of the change (within ios/web/js_messaging/web_view_js_utils.mm) first? And then follow-up with a few smaller CLs to improve the granularity of the `location` value?

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
  • Justin Novosad
  • Rohit Rao
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
Gerrit-Change-Number: 7799850
Gerrit-PatchSet: 6
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
Gerrit-Reviewer: Mike Dougherty <mich...@chromium.org>
Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
Gerrit-Attention: Justin Novosad <ju...@chromium.org>
Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Comment-Date: Thu, 30 Apr 2026 21:31:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Justin Novosad (Gerrit)

unread,
May 5, 2026, 3:57:56 PMMay 5
to Mike Dougherty, Mark Cogan, Etienne Pierre-Doray, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
Attention needed from Etienne Pierre-Doray, Mike Dougherty and Rohit Rao

Justin Novosad added 3 comments

Patchset-level comments
File-level comment, Patchset 6:
Mike Dougherty . resolved

There is a lot of piping taking place in this CL and no context in the associated bug. Is it possible to provide some additional context about why this is necessary?

Additionally, is it possible to land the core of the change (within ios/web/js_messaging/web_view_js_utils.mm) first? And then follow-up with a few smaller CLs to improve the granularity of the `location` value?

Justin Novosad

Done

File-level comment, Patchset 7 (Latest):
Justin Novosad . resolved

I split this CL into 2. This part now only adds the trace events logic.

File ios/web/js_messaging/web_view_js_utils.mm
Line 207, Patchset 1: TRACE_EVENT_BEGIN("webkit", perfetto::DynamicString(location.ToString()),
Etienne Pierre-Doray . resolved

You can use perfetto::StaticString since this is a compile time string IUUC.
To make sure this works for field traces.
Here and below.

Justin Novosad

Unfortunately base::Location::ToString() returns a temporary string. I did not realize that dynamic strings don't work for field traces. This might not be the ideal approach then. I need to think more about this...

Etienne Pierre-Doray

You could fill a proto with this (which eventually shows up the in event args) similar to
https://source.chromium.org/chromium/chromium/src/+/main:base/task/common/task_annotator.cc;l=263?q=base%20task%20annotator%20location&ss=chromium

Either by reusing task_execution, or creating a new field, but then you'd need to come up with another more static name.

Justin Novosad

Okay, that worked, and it was pretty easy to re-use that same proto. Thanks! The trace graph is slightly less convenient to read this way because it now uses a static event name, but all the info we care about is still there. It's a good compromise IMHO. Also, there's no observable impact on record time performance (<microsecond). I imagine the trace buffer is significantly more compact in memory this way, but I'm not sure how to measure that.

Justin Novosad

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
  • Mike Dougherty
  • Rohit Rao
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
    Gerrit-Change-Number: 7799850
    Gerrit-PatchSet: 7
    Gerrit-Owner: Justin Novosad <ju...@chromium.org>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
    Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
    Gerrit-Reviewer: Mike Dougherty <mich...@chromium.org>
    Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
    Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
    Gerrit-Attention: Mike Dougherty <mich...@chromium.org>
    Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Comment-Date: Tue, 05 May 2026 19:57:51 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Justin Novosad <ju...@chromium.org>
    Comment-In-Reply-To: Mike Dougherty <mich...@chromium.org>
    Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mike Dougherty (Gerrit)

    unread,
    May 6, 2026, 12:55:14 AMMay 6
    to Justin Novosad, Mark Cogan, Etienne Pierre-Doray, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
    Attention needed from Etienne Pierre-Doray, Justin Novosad and Rohit Rao

    Mike Dougherty added 5 comments

    Patchset-level comments
    File-level comment, Patchset 7 (Latest):
    Mike Dougherty . unresolved

    I added a few nits but in general I don't feel like I know enough about perfetto to provide great feedback on this overall. I don't love how it needs to propagate the location manually through all the layers in the follow-up CL, but maybe that's just how tracing works on other platforms too?

    File ios/web/js_messaging/web_view_js_utils.h
    Line 54, Patchset 7 (Latest): const base::Location& location = FROM_HERE);
    Mike Dougherty . unresolved

    After the follow-up lands, would be it a good idea to remove the `FROM_HERE` default to ensure call sites pass in their own value of location?

    Line 16, Patchset 7 (Latest):typedef void (^ExecuteJavaScriptCompletionHandler)(id, NSError*);
    Mike Dougherty . unresolved

    I don't think we need this typedef as it just adds an extra indirection for readers trying to understand which params are passed to the completion handler.

    Line 10, Patchset 7 (Latest):#import <string_view>
    Mike Dougherty . unresolved

    is this necessary?

    File ios/web/js_messaging/web_view_js_utils.mm
    Line 206, Patchset 7 (Latest): perfetto::NamedTrack("Injected Script", trace_id),
    Mike Dougherty . unresolved

    I would recommend the term "Executed" or "Evaluated" instead. We use the term "Injected" to refer to JS that is added to WebFrames on webpage load, which is a specific type of JavaScript execution.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Etienne Pierre-Doray
    • Justin Novosad
    • Rohit Rao
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
      Gerrit-Change-Number: 7799850
      Gerrit-PatchSet: 7
      Gerrit-Owner: Justin Novosad <ju...@chromium.org>
      Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
      Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
      Gerrit-Reviewer: Mike Dougherty <mich...@chromium.org>
      Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
      Gerrit-Attention: Justin Novosad <ju...@chromium.org>
      Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
      Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Comment-Date: Wed, 06 May 2026 04:54:57 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Justin Novosad (Gerrit)

      unread,
      May 11, 2026, 11:40:21 AM (10 days ago) May 11
      to Mike Dougherty, Mark Cogan, Etienne Pierre-Doray, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
      Attention needed from Etienne Pierre-Doray, Mike Dougherty and Rohit Rao

      Justin Novosad added 5 comments

      Patchset-level comments
      File-level comment, Patchset 7:
      Mike Dougherty . resolved

      I added a few nits but in general I don't feel like I know enough about perfetto to provide great feedback on this overall. I don't love how it needs to propagate the location manually through all the layers in the follow-up CL, but maybe that's just how tracing works on other platforms too?

      Justin Novosad

      This is really to address an iOS-specific problem. With Blink+V8 we don't do anything like this to propagate locations because Blink-based Chrome doesn't do much hard-coded script injection. The preferred approach with Blink is to use built-in browser extensions, which are trackable by other means.

      File ios/web/js_messaging/web_view_js_utils.h
      Line 54, Patchset 7: const base::Location& location = FROM_HERE);
      Mike Dougherty . resolved

      After the follow-up lands, would be it a good idea to remove the `FROM_HERE` default to ensure call sites pass in their own value of location?

      Justin Novosad

      Yeah, that's a reasonable idea. I'll just have to check whether all call sites are indeed API wrappers. If there are places that use this directly, then maybe not.

      Line 16, Patchset 7:typedef void (^ExecuteJavaScriptCompletionHandler)(id, NSError*);
      Mike Dougherty . resolved

      I don't think we need this typedef as it just adds an extra indirection for readers trying to understand which params are passed to the completion handler.

      Justin Novosad

      Done

      Line 10, Patchset 7:#import <string_view>
      Mike Dougherty . resolved

      is this necessary?

      Justin Novosad

      Done

      File ios/web/js_messaging/web_view_js_utils.mm
      Line 206, Patchset 7: perfetto::NamedTrack("Injected Script", trace_id),
      Mike Dougherty . resolved

      I would recommend the term "Executed" or "Evaluated" instead. We use the term "Injected" to refer to JS that is added to WebFrames on webpage load, which is a specific type of JavaScript execution.

      Justin Novosad

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Etienne Pierre-Doray
      • Mike Dougherty
      • Rohit Rao
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
        Gerrit-Change-Number: 7799850
        Gerrit-PatchSet: 7
        Gerrit-Owner: Justin Novosad <ju...@chromium.org>
        Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
        Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
        Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
        Gerrit-Reviewer: Mike Dougherty <mich...@chromium.org>
        Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
        Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
        Gerrit-Attention: Mike Dougherty <mich...@chromium.org>
        Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
        Gerrit-Comment-Date: Mon, 11 May 2026 15:40:16 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Mike Dougherty <mich...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Mike Dougherty (Gerrit)

        unread,
        May 11, 2026, 1:46:49 PM (10 days ago) May 11
        to Justin Novosad, Mark Cogan, Etienne Pierre-Doray, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
        Attention needed from Etienne Pierre-Doray, Justin Novosad and Rohit Rao

        Mike Dougherty voted and added 1 comment

        Votes added by Mike Dougherty

        Code-Review+1

        1 comment

        Patchset-level comments
        File-level comment, Patchset 8 (Latest):
        Mike Dougherty . unresolved

        OWNERS lgtm, but please ensure you get someone familiar with TRACE_EVENT_* to review all files as well before landing

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Etienne Pierre-Doray
        • Justin Novosad
        • Rohit Rao
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
          Gerrit-Change-Number: 7799850
          Gerrit-PatchSet: 8
          Gerrit-Owner: Justin Novosad <ju...@chromium.org>
          Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
          Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
          Gerrit-Reviewer: Mike Dougherty <mich...@chromium.org>
          Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
          Gerrit-Attention: Justin Novosad <ju...@chromium.org>
          Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
          Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Comment-Date: Mon, 11 May 2026 17:46:35 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Etienne Pierre-Doray (Gerrit)

          unread,
          May 11, 2026, 2:47:59 PM (10 days ago) May 11
          to Justin Novosad, Mike Dougherty, Mark Cogan, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
          Attention needed from Justin Novosad and Rohit Rao

          Etienne Pierre-Doray voted and added 1 comment

          Votes added by Etienne Pierre-Doray

          Code-Review+1

          1 comment

          Patchset-level comments
          Etienne Pierre-Doray . resolved

          LGTM

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Justin Novosad
          • Rohit Rao
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
          Gerrit-Change-Number: 7799850
          Gerrit-PatchSet: 8
          Gerrit-Owner: Justin Novosad <ju...@chromium.org>
          Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
          Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
          Gerrit-Reviewer: Mike Dougherty <mich...@chromium.org>
          Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
          Gerrit-Attention: Justin Novosad <ju...@chromium.org>
          Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
          Gerrit-Comment-Date: Mon, 11 May 2026 18:47:49 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Justin Novosad (Gerrit)

          unread,
          May 14, 2026, 2:14:40 PM (7 days ago) May 14
          to Etienne Pierre-Doray, Mike Dougherty, Mark Cogan, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
          Attention needed from Rohit Rao

          Justin Novosad added 1 comment

          Patchset-level comments
          Mike Dougherty . resolved

          OWNERS lgtm, but please ensure you get someone familiar with TRACE_EVENT_* to review all files as well before landing

          Justin Novosad

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Rohit Rao
          Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement satisfiedCode-Owners
            • requirement satisfiedCode-Review
            • requirement satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
            Gerrit-Change-Number: 7799850
            Gerrit-PatchSet: 8
            Gerrit-Owner: Justin Novosad <ju...@chromium.org>
            Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
            Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
            Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
            Gerrit-Reviewer: Mike Dougherty <mich...@chromium.org>
            Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
            Gerrit-Attention: Rohit Rao <rohi...@chromium.org>
            Gerrit-Comment-Date: Thu, 14 May 2026 18:14:32 +0000
            satisfied_requirement
            open
            diffy

            Justin Novosad (Gerrit)

            unread,
            May 14, 2026, 2:14:42 PM (7 days ago) May 14
            to Etienne Pierre-Doray, Mike Dougherty, Mark Cogan, Rohit Rao, Chromium LUCI CQ, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org
            Attention needed from Rohit Rao

            Justin Novosad voted Commit-Queue+2

            Commit-Queue+2
            Gerrit-Comment-Date: Thu, 14 May 2026 18:14:36 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            open
            diffy

            Chromium LUCI CQ (Gerrit)

            unread,
            May 14, 2026, 6:10:02 PM (7 days ago) May 14
            to Justin Novosad, Etienne Pierre-Doray, Mike Dougherty, Mark Cogan, Rohit Rao, chromium...@chromium.org, browser-comp...@chromium.org, gcasto+w...@chromium.org, ios-revie...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, spang...@chromium.org, tmartino+tran...@chromium.org, tracing...@chromium.org, vasilii+watchlis...@chromium.org, wfh+...@chromium.org

            Chromium LUCI CQ submitted the change

            Unreviewed changes

            8 is the latest approved patch-set.
            No files were changed between the latest approved patch-set and the submitted one.

            Change information

            Commit message:
            [iOS Tracing] Add async trace events that track JS calls

            This change adds a tracing track on iOS that records the durations of
            javascript execution tasks that are dispatched to webkit.

            The tracing was added to the ExecuteJavaScript and
            ExecuteAsyncJavaScript functions in web_view_js_utils.mm, which are the
            entrypoints that all other JS execution APIs use under the hood.
            Bug: 507888935
            Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
            Reviewed-by: Mike Dougherty <mich...@chromium.org>
            Reviewed-by: Etienne Pierre-Doray <etie...@chromium.org>
            Commit-Queue: Justin Novosad <ju...@chromium.org>
            Cr-Commit-Position: refs/heads/main@{#1630792}
            Files:
            • M base/trace_event/builtin_categories.h
            • M ios/web/js_messaging/web_view_js_utils.h
            • M ios/web/js_messaging/web_view_js_utils.mm
            Change size: M
            Delta: 3 files changed, 85 insertions(+), 13 deletions(-)
            Branch: refs/heads/main
            Submit Requirements:
            • requirement satisfiedCode-Review: +1 by Etienne Pierre-Doray, +1 by Mike Dougherty
            Open in Gerrit
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: merged
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Ia34dde4f3cfd6eb64853083677563f2bf807e8c9
            Gerrit-Change-Number: 7799850
            Gerrit-PatchSet: 10
            Gerrit-Owner: Justin Novosad <ju...@chromium.org>
            Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
            Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
            Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
            Gerrit-Reviewer: Mark Cogan <ma...@chromium.org>
            Gerrit-Reviewer: Mike Dougherty <mich...@chromium.org>
            Gerrit-Reviewer: Rohit Rao <rohi...@chromium.org>
            open
            diffy
            satisfied_requirement
            Reply all
            Reply to author
            Forward
            0 new messages