[iOS tracing] Move StartupTracingController to components/tracing/common [chromium/src : main]

0 views
Skip to first unread message

Justin Cohen (Gerrit)

unread,
Apr 13, 2026, 2:47:15 PM (13 days ago) Apr 13
to Etienne Pierre-Doray, chromiu...@luci-project-accounts.iam.gserviceaccount.com, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Etienne Pierre-Doray

Justin Cohen voted and added 1 comment

Votes added by Justin Cohen

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 17 (Latest):
Justin Cohen . resolved

I don't love the SetAndroidPathGeneratorCallback and SetIoTaskRunner hack, but otherwise it's a straighforward move. wdyt?

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
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: I98c9178d2e8bfb4fdfd9b02056a1eee63edc7059
Gerrit-Change-Number: 7750890
Gerrit-PatchSet: 17
Gerrit-Owner: Justin Cohen <justi...@google.com>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Justin Cohen <justi...@google.com>
Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Comment-Date: Mon, 13 Apr 2026 18:47:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Etienne Pierre-Doray (Gerrit)

unread,
Apr 13, 2026, 4:35:13 PM (13 days ago) Apr 13
to Justin Cohen, chromiu...@luci-project-accounts.iam.gserviceaccount.com, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Justin Cohen

Etienne Pierre-Doray added 3 comments

Patchset-level comments
Etienne Pierre-Doray . resolved

Mostly LG

File components/tracing/BUILD.gn
Line 45, Patchset 17 (Latest):component("startup_tracing") {
Etienne Pierre-Doray . unresolved

If there isn't a need for this to be separate from "tracing_config" above, I'd lean towards folding it into the same target for simplicity (I think conceptually that target covers startup_tracing_controller; funnily "tracing_config" used to be called something like "startup_tracing").

File content/browser/browser_main_loop.cc
Line 1542, Patchset 17 (Latest):#if BUILDFLAG(IS_ANDROID)
tracing::StartupTracingController::GetInstance()
.SetAndroidPathGeneratorCallback(base::BindRepeating(
&content::TracingControllerAndroid::GenerateTracingFilePath));
#endif
tracing::StartupTracingController::GetInstance().SetIoTaskRunner(
content::GetIOThreadTaskRunner({}));
tracing::StartupTracingController::GetInstance().StartIfNeeded();
Etienne Pierre-Doray . unresolved

I've been slowly moving several tracing classes to RAII to avoid this awkward GetInstance() + SetSomething() pattern, and pass argument to constructor directly. (see e.g. TracingController)

WDYT of doing this to StartupTracingController:

  • StartupTracingController takes these in constructor
  • store StartupTracingController in BrowserMainLoop and BrowserTestBase (need to be accessible in StartupTracingTest)
  • Call ShutdownAndWaitForStopIfNeeded in BrowserMainLoop::PreShutdown
  • Remove GetInstance()
Open in Gerrit

Related details

Attention is currently required from:
  • Justin Cohen
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: I98c9178d2e8bfb4fdfd9b02056a1eee63edc7059
    Gerrit-Change-Number: 7750890
    Gerrit-PatchSet: 17
    Gerrit-Owner: Justin Cohen <justi...@google.com>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@google.com>
    Gerrit-Attention: Justin Cohen <justi...@google.com>
    Gerrit-Comment-Date: Mon, 13 Apr 2026 20:35:09 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Justin Cohen (Gerrit)

    unread,
    Apr 14, 2026, 12:17:37 AM (13 days ago) Apr 14
    to Etienne Pierre-Doray, chromiu...@luci-project-accounts.iam.gserviceaccount.com, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Etienne Pierre-Doray

    Justin Cohen added 2 comments

    File components/tracing/BUILD.gn
    Line 45, Patchset 17:component("startup_tracing") {
    Etienne Pierre-Doray . unresolved

    If there isn't a need for this to be separate from "tracing_config" above, I'd lean towards folding it into the same target for simplicity (I think conceptually that target covers startup_tracing_controller; funnily "tracing_config" used to be called something like "startup_tracing").

    Justin Cohen
    This was to avoid 
    ERROR Dependency cycle:
    //services/tracing/public/cpp:cpp ->
    //components/tracing:tracing_config ->
    //services/tracing/public/cpp:cpp
    File content/browser/browser_main_loop.cc
    Line 1542, Patchset 17:#if BUILDFLAG(IS_ANDROID)

    tracing::StartupTracingController::GetInstance()
    .SetAndroidPathGeneratorCallback(base::BindRepeating(
    &content::TracingControllerAndroid::GenerateTracingFilePath));
    #endif
    tracing::StartupTracingController::GetInstance().SetIoTaskRunner(
    content::GetIOThreadTaskRunner({}));
    tracing::StartupTracingController::GetInstance().StartIfNeeded();
    Etienne Pierre-Doray . unresolved

    I've been slowly moving several tracing classes to RAII to avoid this awkward GetInstance() + SetSomething() pattern, and pass argument to constructor directly. (see e.g. TracingController)

    WDYT of doing this to StartupTracingController:

    • StartupTracingController takes these in constructor
    • store StartupTracingController in BrowserMainLoop and BrowserTestBase (need to be accessible in StartupTracingTest)
    • Call ShutdownAndWaitForStopIfNeeded in BrowserMainLoop::PreShutdown
    • Remove GetInstance()
    Justin Cohen

    Sure. I'm still quite new to this area of code but I think this is what you had in mind. PTAL!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Etienne Pierre-Doray
    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: I98c9178d2e8bfb4fdfd9b02056a1eee63edc7059
    Gerrit-Change-Number: 7750890
    Gerrit-PatchSet: 32
    Gerrit-Owner: Justin Cohen <justi...@google.com>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@google.com>
    Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Comment-Date: Tue, 14 Apr 2026 04:17:29 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Arthur Sonzogni (Gerrit)

    unread,
    Apr 16, 2026, 6:19:23 AM (10 days ago) Apr 16
    to Justin Cohen, Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Etienne Pierre-Doray and Justin Cohen

    Arthur Sonzogni added 2 comments

    Commit Message
    Line 7, Patchset 33 (Latest):[iOS tracing] Move StartupTracingController to components/tracing/common
    Arthur Sonzogni . unresolved

    I will defer to components/tracing/OWNERS (e.g. @etie...@chromium.org)

    Please close this to add visibility again, and I will stamp after a sanity check.

    Line 24, Patchset 33 (Latest):Bug: 495937056
    ```
    Bug: 495937056
    Arthur Sonzogni . unresolved

    Nit: Duplicate.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Etienne Pierre-Doray
    • Justin Cohen
    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: I98c9178d2e8bfb4fdfd9b02056a1eee63edc7059
    Gerrit-Change-Number: 7750890
    Gerrit-PatchSet: 33
    Gerrit-Owner: Justin Cohen <justi...@google.com>
    Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@google.com>
    Gerrit-Attention: Justin Cohen <justi...@google.com>
    Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Comment-Date: Thu, 16 Apr 2026 10:18:59 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Justin Cohen (Gerrit)

    unread,
    Apr 17, 2026, 12:49:47 PM (9 days ago) Apr 17
    to Arthur Sonzogni, Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Arthur Sonzogni and Etienne Pierre-Doray

    Justin Cohen added 1 comment

    Commit Message
    Line 24, Patchset 33:Bug: 495937056
    ```
    Bug: 495937056
    Arthur Sonzogni . resolved

    Nit: Duplicate.

    Justin Cohen

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Arthur Sonzogni
    • Etienne Pierre-Doray
    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: I98c9178d2e8bfb4fdfd9b02056a1eee63edc7059
    Gerrit-Change-Number: 7750890
    Gerrit-PatchSet: 34
    Gerrit-Owner: Justin Cohen <justi...@google.com>
    Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@google.com>
    Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Comment-Date: Fri, 17 Apr 2026 16:49:41 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Arthur Sonzogni <arthurs...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Etienne Pierre-Doray (Gerrit)

    unread,
    Apr 20, 2026, 4:42:15 PM (6 days ago) Apr 20
    to Justin Cohen, Arthur Sonzogni, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Arthur Sonzogni and Justin Cohen

    Etienne Pierre-Doray added 4 comments

    File components/tracing/BUILD.gn
    Line 45, Patchset 17:component("startup_tracing") {
    Etienne Pierre-Doray . unresolved

    If there isn't a need for this to be separate from "tracing_config" above, I'd lean towards folding it into the same target for simplicity (I think conceptually that target covers startup_tracing_controller; funnily "tracing_config" used to be called something like "startup_tracing").

    Justin Cohen
    This was to avoid 
    ERROR Dependency cycle:
    //services/tracing/public/cpp:cpp ->
    //components/tracing:tracing_config ->
    //services/tracing/public/cpp:cpp
    Etienne Pierre-Doray

    Ah I see!
    Come to think of it, any reason we can't put startup_tracing_controller.h directly in services/tracing/public/cpp?

    File components/tracing/common/startup_tracing_controller.cc
    Line 68, Patchset 33:class EmergencyTraceFinalisationCoordinator {
    public:
    static EmergencyTraceFinalisationCoordinator& GetInstance() {
    static base::NoDestructor<EmergencyTraceFinalisationCoordinator> instance;
    return *instance;
    }
    Etienne Pierre-Doray . unresolved

    I don't like the lifetime of EmergencyTraceFinalisationCoordinator (and the design in general), and saw it's making things more complicated in the follow-up.
    I tried something here: https://chromium-review.git.corp.google.com/c/chromium/src/+/7779464
    To delete EmergencyTraceFinalisationCoordinator entirely and manage all lifetime in StartupTracingController.
    Feel free to incorporate in your CL.

    File content/browser/browser_main_loop.cc
    Line 1108, Patchset 33: if (startup_tracing_controller_) {
    startup_tracing_controller_->ShutdownAndWaitForStopIfNeeded();
    }
    Etienne Pierre-Doray . unresolved

    We might want to move this at the end of the function so the move is a no-op.

    Line 1542, Patchset 17:#if BUILDFLAG(IS_ANDROID)
    tracing::StartupTracingController::GetInstance()
    .SetAndroidPathGeneratorCallback(base::BindRepeating(
    &content::TracingControllerAndroid::GenerateTracingFilePath));
    #endif
    tracing::StartupTracingController::GetInstance().SetIoTaskRunner(
    content::GetIOThreadTaskRunner({}));
    tracing::StartupTracingController::GetInstance().StartIfNeeded();
    Etienne Pierre-Doray . resolved

    I've been slowly moving several tracing classes to RAII to avoid this awkward GetInstance() + SetSomething() pattern, and pass argument to constructor directly. (see e.g. TracingController)

    WDYT of doing this to StartupTracingController:

    • StartupTracingController takes these in constructor
    • store StartupTracingController in BrowserMainLoop and BrowserTestBase (need to be accessible in StartupTracingTest)
    • Call ShutdownAndWaitForStopIfNeeded in BrowserMainLoop::PreShutdown
    • Remove GetInstance()
    Justin Cohen

    Sure. I'm still quite new to this area of code but I think this is what you had in mind. PTAL!

    Etienne Pierre-Doray

    Yes that works!
    I didn't realize this would mean a few member function (SetDefaultBasename) need to become static for testing, but I guess that's ok.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Arthur Sonzogni
    • Justin Cohen
    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: I98c9178d2e8bfb4fdfd9b02056a1eee63edc7059
    Gerrit-Change-Number: 7750890
    Gerrit-PatchSet: 34
    Gerrit-Owner: Justin Cohen <justi...@google.com>
    Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@google.com>
    Gerrit-Attention: Justin Cohen <justi...@google.com>
    Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Comment-Date: Mon, 20 Apr 2026 20:42:11 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Justin Cohen <justi...@google.com>
    Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages