tracing: Relocate database persistence layer and decouple metrics provider [chromium/src : main]

0 views
Skip to first unread message

Justin Cohen (Gerrit)

unread,
May 6, 2026, 2:12:15 PMMay 6
to Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, android-web...@chromium.org, droger+w...@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 3 (Latest):
Justin Cohen . resolved

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 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: Ia4a04ee69e24554889137f9ea6fe3578ab087283
Gerrit-Change-Number: 7817289
Gerrit-PatchSet: 3
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: Wed, 06 May 2026 18:12:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Etienne Pierre-Doray (Gerrit)

unread,
May 11, 2026, 12:58:46 PM (10 days ago) May 11
to Justin Cohen, Code Review Nudger, Chromium LUCI CQ, chromium...@chromium.org, android-web...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Justin Cohen

Etienne Pierre-Doray added 8 comments

File components/tracing/BUILD.gn
Line 93, Patchset 3 (Latest): "//content/public/browser",
Etienne Pierre-Doray . unresolved

I think this isn't needed at all anymore with BackgroundTracingMetricsProvider changes

File components/tracing/common/background_tracing_metrics_provider.h
Line 65, Patchset 3 (Latest): base::OnceCallback<
void(std::optional<std::string> compressed_trace_content,
std::optional<std::string> serialized_system_profile,
base::OnceClosure upload_complete)> callback) = 0;
Etienne Pierre-Doray . unresolved

Nit: let's define an alias (OnTraceToUploadCallback) to use here and in derived classes.

File content/browser/tracing/background_tracing_manager_impl.cc
Line 581, Patchset 3 (Latest): db_path = database_dir->Append(FILE_PATH_LITERAL("trace_report.db"));
Etienne Pierre-Doray . unresolved

This is already included in GetLocalTracesDirectory?

Line 985, Patchset 3 (Latest): if (self && !success) {
self->trace_report_manager_.reset();
}
Etienne Pierre-Doray . unresolved

Let's keep the existing behavior: if this fails, trace_report_manager_ is left non-null, but every subsequent operation will fail. This prevent trying to reopen the database each time this is called.

File services/tracing/public/cpp/background_tracing/trace_report_manager.cc
Line 43, Patchset 3 (Latest): if (!database_) {
database_ = {new TraceReportDatabase,
base::OnTaskRunnerDeleter(database_task_runner_)};
}
Etienne Pierre-Doray . unresolved

Let's move this in constructor and assume that `database_` is always valid.

Line 64, Patchset 3 (Latest): std::optional<ClientTraceReport> client_report =
db->GetNextReportPendingUpload();
if (client_report) {
result.pending_report =
std::optional<BaseTraceReport>(*client_report);
}
Etienne Pierre-Doray . unresolved

Nit: Does it works to rely on optional conversion?
`result.pending_report = std::move(client_report)`

Line 118, Patchset 3 (Latest): if (!database_) {
ui_runner->PostTask(
FROM_HERE, base::BindOnce(std::move(on_done), std::nullopt, false));
return;
}
Etienne Pierre-Doray . unresolved

Here and throughout file below: we previously assumed that database_ is initialized once and never reset. If initialization fails, it's kept non-null but operation will fail.
So it should be enough to make this `CHECK(database_)`

Line 134, Patchset 3 (Latest): if (!database || !database->is_initialized()) {
Etienne Pierre-Doray . unresolved

Related to comment above: `!database` isn't needed (redundant).

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: Ia4a04ee69e24554889137f9ea6fe3578ab087283
    Gerrit-Change-Number: 7817289
    Gerrit-PatchSet: 3
    Gerrit-Owner: Justin Cohen <justi...@google.com>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@google.com>
    Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
    Gerrit-Attention: Justin Cohen <justi...@google.com>
    Gerrit-Comment-Date: Mon, 11 May 2026 16:58:40 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Justin Cohen (Gerrit)

    unread,
    May 11, 2026, 1:22:52 PM (10 days ago) May 11
    to Code Review Nudger, Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, android-web...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Etienne Pierre-Doray

    Justin Cohen added 1 comment

    File content/browser/tracing/background_tracing_manager_impl.cc
    Line 581, Patchset 3 (Latest): db_path = database_dir->Append(FILE_PATH_LITERAL("trace_report.db"));
    Etienne Pierre-Doray . unresolved

    This is already included in GetLocalTracesDirectory?

    Justin Cohen

    Is it? It looks like it GetLocalTracesDirectory() only returns the base directory path (mapping to chrome::DIR_LOCAL_TRACES / android_webview::DIR_LOCAL_TRACES)

    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: Ia4a04ee69e24554889137f9ea6fe3578ab087283
    Gerrit-Change-Number: 7817289
    Gerrit-PatchSet: 3
    Gerrit-Owner: Justin Cohen <justi...@google.com>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@google.com>
    Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
    Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Comment-Date: Mon, 11 May 2026 17:22:45 +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,
    May 11, 2026, 1:34:23 PM (10 days ago) May 11
    to Justin Cohen, Code Review Nudger, Chromium LUCI CQ, chromium...@chromium.org, android-web...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Justin Cohen

    Etienne Pierre-Doray added 1 comment

    File content/browser/tracing/background_tracing_manager_impl.cc
    Line 581, Patchset 3 (Latest): db_path = database_dir->Append(FILE_PATH_LITERAL("trace_report.db"));
    Etienne Pierre-Doray . unresolved

    This is already included in GetLocalTracesDirectory?

    Justin Cohen

    Is it? It looks like it GetLocalTracesDirectory() only returns the base directory path (mapping to chrome::DIR_LOCAL_TRACES / android_webview::DIR_LOCAL_TRACES)

    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: Ia4a04ee69e24554889137f9ea6fe3578ab087283
    Gerrit-Change-Number: 7817289
    Gerrit-PatchSet: 3
    Gerrit-Owner: Justin Cohen <justi...@google.com>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@google.com>
    Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
    Gerrit-Attention: Justin Cohen <justi...@google.com>
    Gerrit-Comment-Date: Mon, 11 May 2026 17:34:18 +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

    Justin Cohen (Gerrit)

    unread,
    May 11, 2026, 2:58:08 PM (10 days ago) May 11
    to Code Review Nudger, Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, android-web...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Etienne Pierre-Doray

    Justin Cohen added 9 comments

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

    Thanks, ptal!

    File components/tracing/BUILD.gn
    Line 93, Patchset 3: "//content/public/browser",
    Etienne Pierre-Doray . resolved

    I think this isn't needed at all anymore with BackgroundTracingMetricsProvider changes

    Justin Cohen

    Done

    File components/tracing/common/background_tracing_metrics_provider.h
    Line 65, Patchset 3: base::OnceCallback<

    void(std::optional<std::string> compressed_trace_content,
    std::optional<std::string> serialized_system_profile,
    base::OnceClosure upload_complete)> callback) = 0;
    Etienne Pierre-Doray . resolved

    Nit: let's define an alias (OnTraceToUploadCallback) to use here and in derived classes.

    Justin Cohen

    Done

    File content/browser/tracing/background_tracing_manager_impl.cc
    Line 581, Patchset 3: db_path = database_dir->Append(FILE_PATH_LITERAL("trace_report.db"));
    Etienne Pierre-Doray . resolved

    This is already included in GetLocalTracesDirectory?

    Justin Cohen

    Is it? It looks like it GetLocalTracesDirectory() only returns the base directory path (mapping to chrome::DIR_LOCAL_TRACES / android_webview::DIR_LOCAL_TRACES)

    Etienne Pierre-Doray

    Oh sorry, it's included in TraceReportDatabase::OpenDatabase rather:

    https://source.chromium.org/chromium/chromium/src/+/main:services/tracing/public/cpp/background_tracing/trace_report_database.cc;l=110?q=TraceReportDatabase%20OpenDatabase&ss=chromium

    Justin Cohen

    Done

    Line 985, Patchset 3: if (self && !success) {
    self->trace_report_manager_.reset();
    }
    Etienne Pierre-Doray . resolved

    Let's keep the existing behavior: if this fails, trace_report_manager_ is left non-null, but every subsequent operation will fail. This prevent trying to reopen the database each time this is called.

    Justin Cohen

    Done

    File services/tracing/public/cpp/background_tracing/trace_report_manager.cc
    Line 43, Patchset 3: if (!database_) {

    database_ = {new TraceReportDatabase,
    base::OnTaskRunnerDeleter(database_task_runner_)};
    }
    Etienne Pierre-Doray . resolved

    Let's move this in constructor and assume that `database_` is always valid.

    Justin Cohen

    Done

    Line 64, Patchset 3: std::optional<ClientTraceReport> client_report =

    db->GetNextReportPendingUpload();
    if (client_report) {
    result.pending_report =
    std::optional<BaseTraceReport>(*client_report);
    }
    Etienne Pierre-Doray . resolved

    Nit: Does it works to rely on optional conversion?
    `result.pending_report = std::move(client_report)`

    Justin Cohen

    Done

    Line 118, Patchset 3: if (!database_) {

    ui_runner->PostTask(
    FROM_HERE, base::BindOnce(std::move(on_done), std::nullopt, false));
    return;
    }
    Etienne Pierre-Doray . resolved

    Here and throughout file below: we previously assumed that database_ is initialized once and never reset. If initialization fails, it's kept non-null but operation will fail.
    So it should be enough to make this `CHECK(database_)`

    Justin Cohen

    Done

    Line 134, Patchset 3: if (!database || !database->is_initialized()) {
    Etienne Pierre-Doray . resolved

    Related to comment above: `!database` isn't needed (redundant).

    Justin Cohen

    Done

    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: Ia4a04ee69e24554889137f9ea6fe3578ab087283
      Gerrit-Change-Number: 7817289
      Gerrit-PatchSet: 5
      Gerrit-Owner: Justin Cohen <justi...@google.com>
      Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Justin Cohen <justi...@google.com>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Comment-Date: Mon, 11 May 2026 18:58:03 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Etienne Pierre-Doray (Gerrit)

      unread,
      May 11, 2026, 4:10:22 PM (10 days ago) May 11
      to Justin Cohen, Code Review Nudger, Chromium LUCI CQ, chromium...@chromium.org, android-web...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
      Attention needed from Justin Cohen

      Etienne Pierre-Doray added 6 comments

      File content/browser/tracing/background_tracing_manager_impl.cc
      Line 70, Patchset 5 (Parent):// We limit uploads of 1 trace per scenario over a period of 7 days. Since
      // traces live in the database for longer than 7 days, their TTL doesn't affect
      // this unless the database is manually cleared.
      Etienne Pierre-Doray . unresolved

      Let's keep the comment along with the variable (now moved to services/tracing/public/cpp/background_tracing/trace_report_manager.cc)

      Line 843, Patchset 5 (Parent): trace_report, std::move(receive_callback),
      Etienne Pierre-Doray . unresolved

      Can we keep the `receive_callback` running synchronously? Ideally this simply becomes

      ```
      auto on_finalize_complete = base::BindOnce(&BackgroundTracingManagerImpl::OnFinalizeComplete,
      weak_factory_.GetWeakPtr());
      trace_report_manager_->LoadTraceContent(
      uuid,
      std::move(receive_callback), // runs synchronously
      std::move(on_finalize_complete) // runs on UI task runner
      );
      ```

      Which chains GetTraceContent -> receive_callback -> UploadComplete -> OnFinalizeComplete (really which we had coroutines)

      And "Tracing.Background.Scenario.Upload" can probably move to OnFinalizeComplete

      File services/tracing/public/cpp/background_tracing/trace_report_manager.h
      Line 80, Patchset 5 (Latest): void Reset();
      Etienne Pierre-Doray . unresolved

      Is this needed, or could we simply rely on in-memory database getting cleaned up?

      File services/tracing/public/cpp/background_tracing/trace_report_manager.cc
      Line 109, Patchset 5 (Latest): if (!database->is_initialized()) {

      ui_runner->PostTask(
      FROM_HERE,
      base::BindOnce(std::move(on_done), std::nullopt, false));
      return;
      }
      Etienne Pierre-Doray . unresolved

      Previously we just dropped it, because we'd already reported failure to initialize database.

      Line 115, Patchset 5 (Latest):#if BUILDFLAG(IS_IOS)
      if (privacy_filter_enabled) {
      PrivacyFilteringCheck::RemoveBlockedFields(serialized_trace);
      }
      #endif
      Etienne Pierre-Doray . unresolved

      I'll have to think about this, but since this CL is a move/refactor, I think it makes more sense to introduce in follow-up.

      Line 143, Patchset 5 (Latest): ui_runner->PostTask(
      FROM_HERE,
      base::BindOnce(std::move(on_done),
      std::move(report_to_upload), false));
      Etienne Pierre-Doray . unresolved

      Previously we just dropped it, and thus not reporting an error for quota limitation.

      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: Ia4a04ee69e24554889137f9ea6fe3578ab087283
        Gerrit-Change-Number: 7817289
        Gerrit-PatchSet: 5
        Gerrit-Owner: Justin Cohen <justi...@google.com>
        Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
        Gerrit-Reviewer: Justin Cohen <justi...@google.com>
        Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
        Gerrit-Attention: Justin Cohen <justi...@google.com>
        Gerrit-Comment-Date: Mon, 11 May 2026 20:10:16 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Justin Cohen (Gerrit)

        unread,
        May 11, 2026, 4:53:29 PM (10 days ago) May 11
        to Code Review Nudger, Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, android-web...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
        Attention needed from Etienne Pierre-Doray

        Justin Cohen voted and added 7 comments

        Votes added by Justin Cohen

        Commit-Queue+1

        7 comments

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

        ptal

        File content/browser/tracing/background_tracing_manager_impl.cc
        Line 70, Patchset 5 (Parent):// We limit uploads of 1 trace per scenario over a period of 7 days. Since
        // traces live in the database for longer than 7 days, their TTL doesn't affect
        // this unless the database is manually cleared.
        Etienne Pierre-Doray . resolved

        Let's keep the comment along with the variable (now moved to services/tracing/public/cpp/background_tracing/trace_report_manager.cc)

        Justin Cohen

        Done

        Line 843, Patchset 5 (Parent): trace_report, std::move(receive_callback),
        Etienne Pierre-Doray . resolved

        Can we keep the `receive_callback` running synchronously? Ideally this simply becomes

        ```
        auto on_finalize_complete = base::BindOnce(&BackgroundTracingManagerImpl::OnFinalizeComplete,
        weak_factory_.GetWeakPtr());
        trace_report_manager_->LoadTraceContent(
        uuid,
        std::move(receive_callback), // runs synchronously
        std::move(on_finalize_complete) // runs on UI task runner
        );
        ```

        Which chains GetTraceContent -> receive_callback -> UploadComplete -> OnFinalizeComplete (really which we had coroutines)

        And "Tracing.Background.Scenario.Upload" can probably move to OnFinalizeComplete

        Justin Cohen

        Done

        File services/tracing/public/cpp/background_tracing/trace_report_manager.h
        Line 80, Patchset 5: void Reset();
        Etienne Pierre-Doray . resolved

        Is this needed, or could we simply rely on in-memory database getting cleaned up?

        Justin Cohen

        Done

        File services/tracing/public/cpp/background_tracing/trace_report_manager.cc
        Line 109, Patchset 5: if (!database->is_initialized()) {

        ui_runner->PostTask(
        FROM_HERE,
        base::BindOnce(std::move(on_done), std::nullopt, false));
        return;
        }
        Etienne Pierre-Doray . resolved

        Previously we just dropped it, because we'd already reported failure to initialize database.

        Justin Cohen

        Done

        Line 115, Patchset 5:#if BUILDFLAG(IS_IOS)

        if (privacy_filter_enabled) {
        PrivacyFilteringCheck::RemoveBlockedFields(serialized_trace);
        }
        #endif
        Etienne Pierre-Doray . unresolved

        I'll have to think about this, but since this CL is a move/refactor, I think it makes more sense to introduce in follow-up.

        Justin Cohen

        OK -- for now I'm leaving it in this CL. Alternatively I can move it to https://crrev.com/c/7819834 ? Or would you prefer something different.

        Line 143, Patchset 5: ui_runner->PostTask(

        FROM_HERE,
        base::BindOnce(std::move(on_done),
        std::move(report_to_upload), false));
        Etienne Pierre-Doray . resolved

        Previously we just dropped it, and thus not reporting an error for quota limitation.

        Justin Cohen

        Done

        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: Ia4a04ee69e24554889137f9ea6fe3578ab087283
        Gerrit-Change-Number: 7817289
        Gerrit-PatchSet: 6
        Gerrit-Owner: Justin Cohen <justi...@google.com>
        Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
        Gerrit-Reviewer: Justin Cohen <justi...@google.com>
        Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
        Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
        Gerrit-Comment-Date: Mon, 11 May 2026 20:53:24 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Justin Cohen (Gerrit)

        unread,
        May 11, 2026, 10:18:57 PM (10 days ago) May 11
        to Code Review Nudger, Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, android-web...@chromium.org, droger+w...@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

        File services/tracing/public/cpp/background_tracing/trace_report_manager.cc
        Line 115, Patchset 5:#if BUILDFLAG(IS_IOS)
        if (privacy_filter_enabled) {
        PrivacyFilteringCheck::RemoveBlockedFields(serialized_trace);
        }
        #endif
        Etienne Pierre-Doray . resolved

        I'll have to think about this, but since this CL is a move/refactor, I think it makes more sense to introduce in follow-up.

        Justin Cohen

        OK -- for now I'm leaving it in this CL. Alternatively I can move it to https://crrev.com/c/7819834 ? Or would you prefer something different.

        Justin Cohen

        I misread -- moving it to the child CL.

        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: Ia4a04ee69e24554889137f9ea6fe3578ab087283
          Gerrit-Change-Number: 7817289
          Gerrit-PatchSet: 7
          Gerrit-Owner: Justin Cohen <justi...@google.com>
          Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Reviewer: Justin Cohen <justi...@google.com>
          Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
          Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Comment-Date: Tue, 12 May 2026 02:18:50 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Etienne Pierre-Doray (Gerrit)

          unread,
          May 12, 2026, 9:03:28 AM (9 days ago) May 12
          to Justin Cohen, Code Review Nudger, Chromium LUCI CQ, chromium...@chromium.org, android-web...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
          Attention needed from Justin Cohen

          Etienne Pierre-Doray added 3 comments

          File content/browser/tracing/background_tracing_manager_impl.cc
          Line 257, Patchset 6: std::optional<std::string> system_profile) {
          Etienne Pierre-Doray . unresolved

          Nit: This is the only caller of this version of LoadTraceContent() I think, so we could remove system_profile?

          File services/tracing/public/cpp/background_tracing/trace_report_manager.cc
          Line 208, Patchset 6: database_task_runner_->PostTaskAndReplyWithResult(
          Etienne Pierre-Doray . unresolved

          I meant we can skip the hop back to the "original" task runner (to do CompleteUpload). Something like:

          ```

          auto ui_runner = base::SequencedTaskRunner::GetCurrentDefault();
          auto on_upload_complete = base::BindPostTask(database_task_runner_, base::BindOnce([](
          tracing::TraceReportDatabase* database,
          base::Token uuid
          base::OnceCallback<...> on_finalize_complete) {
          std::optional<ClientTraceReport> next_report;
          if (database->UploadComplete(uuid, base::Time::Now())) {
          next_report = database->GetNextReportPendingUpload();
          }
          std::move(on_finalize_complete).Run(std::move(next_report), true);
          }, database_.get(), uuid,base::BindPostTask(ui_runner, std::move(on_finalize_complete))));

          auto load_trace_content = base::BindOnce([](
          tracing::TraceReportDatabase* database,
          base::Token uuid,
          base::OnceCallback<...> receive_callback,
          base::OnceCallback<...> on_upload_complete) {
          auto compressed_trace_content = database->GetTraceContent(uuid);
          if (!compressed_trace_content) {
          std::move(receive_callback)
          .Run(std::nullopt, std::nullopt, base::NullCallback());
          } else {
          auto serialized_system_profile = database->GetSystemProfile(uuid);
          std::move(receive_callback)
          .Run(std::move(compressed_trace_content),
          std::move(serialized_system_profile), std::move(upload_complete));
          }
          }, database_.get(), uuid, std::move(receive_callback), std::move(on_upload_complete));

          database_task_runner_->PostTask(database_task_runner_, std::move(load_trace_content));
          ```

          Line 219, Patchset 6: [](base::WeakPtr<TraceReportManager> self, base::Token uuid,
          Etienne Pierre-Doray . unresolved

          Nit: I think we can plumb TraceReportDatabase* the same we we do in other functions (and thus don't need a WeakPtrFactory), see above.

          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: Ia4a04ee69e24554889137f9ea6fe3578ab087283
            Gerrit-Change-Number: 7817289
            Gerrit-PatchSet: 9
            Gerrit-Owner: Justin Cohen <justi...@google.com>
            Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
            Gerrit-Reviewer: Justin Cohen <justi...@google.com>
            Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
            Gerrit-Attention: Justin Cohen <justi...@google.com>
            Gerrit-Comment-Date: Tue, 12 May 2026 13:03:22 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy
            Reply all
            Reply to author
            Forward
            0 new messages