Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1078)

Unified Diff: services/tracing/tracing_app.cc

Issue 1932843002: Add TraceProviderRegistry and implementation in tracing service/application. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/tracing/tracing_app.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/tracing/tracing_app.cc
diff --git a/services/tracing/tracing_app.cc b/services/tracing/tracing_app.cc
index a3721f60671814af2eff03f4a3aa98f611bd253d..18a2ea4a96a9af8828f41342e4b56d86469aaa86 100644
--- a/services/tracing/tracing_app.cc
+++ b/services/tracing/tracing_app.cc
@@ -24,19 +24,14 @@ bool TracingApp::ConfigureIncomingConnection(
// to connect to the TraceProvider interface to see if the application
// connecting to us wants to be traced. They can refuse the connection or
// close the pipe if not.
+ // TODO(vtl): Remove this once we remove the "wrong way" ServiceProvider.
TraceProviderPtr provider_ptr;
connection->ConnectToService(&provider_ptr);
- if (tracing_active_) {
- TraceRecorderPtr recorder_ptr;
- recorder_impls_.push_back(
- new TraceRecorderImpl(GetProxy(&recorder_ptr), sink_.get()));
- provider_ptr->StartTracing(tracing_categories_, recorder_ptr.Pass());
- }
- provider_ptrs_.AddInterfacePtr(provider_ptr.Pass());
+ RegisterTraceProvider(provider_ptr.PassInterfaceHandle());
+
return true;
}
-// mojo::InterfaceFactory<TraceCollector> implementation.
void TracingApp::Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<TraceCollector> request) {
if (collector_binding_.is_bound()) {
@@ -47,7 +42,11 @@ void TracingApp::Create(mojo::ApplicationConnection* connection,
collector_binding_.Bind(request.Pass());
}
-// tracing::TraceCollector implementation.
+void TracingApp::Create(mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<TraceProviderRegistry> request) {
+ provider_registry_bindings_.AddBinding(this, request.Pass());
jamesr 2016/04/28 20:59:02 at what point do we start saying std::move(request
+}
+
void TracingApp::Start(mojo::ScopedDataPipeProducerHandle stream,
const mojo::String& categories) {
tracing_categories_ = categories;
@@ -126,6 +125,18 @@ void TracingApp::StopAndFlush() {
AllDataCollected();
}
+void TracingApp::RegisterTraceProvider(
+ mojo::InterfaceHandle<TraceProvider> trace_provider) {
+ auto provider_ptr = TraceProviderPtr::Create(trace_provider.Pass());
+ if (tracing_active_) {
+ TraceRecorderPtr recorder_ptr;
+ recorder_impls_.push_back(
+ new TraceRecorderImpl(GetProxy(&recorder_ptr), sink_.get()));
+ provider_ptr->StartTracing(tracing_categories_, recorder_ptr.Pass());
+ }
+ provider_ptrs_.AddInterfacePtr(provider_ptr.Pass());
+}
+
void TracingApp::AllDataCollected() {
recorder_impls_.clear();
sink_.reset();
« no previous file with comments | « services/tracing/tracing_app.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698