tracing: Extract scenario controller and relocate database persistence [chromium/src : main]

0 views
Skip to first unread message

Justin Cohen (Gerrit)

unread,
May 12, 2026, 1:28:40 PM (9 days ago) May 12
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 3 comments

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

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

Justin Cohen

Done

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

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));
```

Justin Cohen

Done

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

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

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: 14
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 17:28:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
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