Fix enumeration of tracing categories for ARC tracing agents
ARC tracing agents aren't owned by TracingControllerImpl;
add a function in the base TracedProcess registry that all agents
register with, to populate the tracing categories.
R=​ssid@chromium.org
BUG=941295
Change-Id: Ia2a2dd763be8961fe3f322499a1e3d8429bc249c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1519328
Reviewed-by: ssid <ssid@chromium.org>
Commit-Queue: oysteine <oysteine@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#640386}(cherry picked from commit ad4923fbcaf6a728f4c2908212b73eef929e80f2)
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1524406
Reviewed-by: oysteine <oysteine@chromium.org>
Cr-Commit-Position: refs/branch-heads/3683@{#821}
Cr-Branched-From: e51029943e0a38dd794b73caaf6373d5496ae783-refs/heads/master@{#625896}
diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc
index beed93a..758526f 100644
--- a/content/browser/tracing/tracing_controller_impl.cc
+++ b/content/browser/tracing/tracing_controller_impl.cc
@@ -298,10 +298,7 @@
bool TracingControllerImpl::GetCategories(GetCategoriesDoneCallback callback) {
std::set<std::string> category_set;
-
- tracing::TraceEventAgent::GetInstance()->GetCategories(&category_set);
- for (auto& agent : agents_)
- agent->GetCategories(&category_set);
+ tracing::TracedProcessImpl::GetInstance()->GetCategories(&category_set);
std::move(callback).Run(category_set);
return true;
diff --git a/services/tracing/public/cpp/traced_process_impl.cc b/services/tracing/public/cpp/traced_process_impl.cc
index e380d01..7ae592a 100644
--- a/services/tracing/public/cpp/traced_process_impl.cc
+++ b/services/tracing/public/cpp/traced_process_impl.cc
@@ -105,4 +105,10 @@
tracing::mojom::PerfettoServicePtr(std::move(request->perfetto_service)));
}
+void TracedProcessImpl::GetCategories(std::set<std::string>* category_set) {
+ for (auto* agent : agents_) {
+ agent->GetCategories(category_set);
+ }
+}
+
} // namespace tracing
diff --git a/services/tracing/public/cpp/traced_process_impl.h b/services/tracing/public/cpp/traced_process_impl.h
index 1522fdf..5d7a503a6 100644
--- a/services/tracing/public/cpp/traced_process_impl.h
+++ b/services/tracing/public/cpp/traced_process_impl.h
@@ -35,6 +35,9 @@
void RegisterAgent(BaseAgent* agent);
void UnregisterAgent(BaseAgent* agent);
+ // Populate categories from all of the registered agents.
+ void GetCategories(std::set<std::string>* category_set);
+
private:
friend class base::NoDestructor<TracedProcessImpl>;
TracedProcessImpl();