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

Unified Diff: shell/context.cc

Issue 791493006: De-client tracing.TraceController interface (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: hook mojo shell up again Created 6 years 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 | « shell/context.h ('k') | sky/viewer/viewer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/context.cc
diff --git a/shell/context.cc b/shell/context.cc
index cd65273ae99839d1e47f6bb9febfde2f7883ca67..91ee054d8b921950e8f5abd29e84112a4845a892 100644
--- a/shell/context.cc
+++ b/shell/context.cc
@@ -114,6 +114,26 @@ bool ConfigureURLMappings(const std::string& mappings,
} // namespace
+class Context::TracingServiceProvider : public ServiceProvider {
+ public:
+ explicit TracingServiceProvider(ScopedMessagePipeHandle handle)
+ : binding_(this, handle.Pass()) {}
+ ~TracingServiceProvider() override {}
+
+ void ConnectToService(const mojo::String& service_name,
+ ScopedMessagePipeHandle client_handle) override {
+ if (service_name != tracing::TraceController::Name_) {
+ client_handle.reset();
+ return;
+ }
+ trace_controller_.Bind(client_handle.Pass());
+ }
+
+ private:
+ TraceControllerImpl trace_controller_;
+ StrongBinding<ServiceProvider> binding_;
qsr 2014/12/19 09:47:14 I might be missing something, but if I understand
jamesr 2014/12/29 18:57:58 You are correct. I'll get rid of the scoped_ptr (
+};
+
Context::Context() : application_manager_(this) {
DCHECK(!base::MessageLoop::current());
}
@@ -182,10 +202,12 @@ bool Context::Init() {
// was implemented by src\mojo\spy\websocket_server.h and .cc.
}
- tracing::TraceDataCollectorPtr trace_data_collector_ptr;
- application_manager_.ConnectToService(GURL("mojo:tracing"),
- &trace_data_collector_ptr);
- TracingImpl::Create(trace_data_collector_ptr.Pass());
+ MessagePipe pipe;
+ ServiceProviderPtr spp;
+ tracing_sp_.reset(new Context::TracingServiceProvider(pipe.handle0.Pass()));
+ spp.Bind(pipe.handle1.Pass());
qsr 2014/12/19 09:47:14 Did we lose the ability to bury the pipes with the
jamesr 2014/12/29 18:57:58 I think hiding these makes this code a lot harder
qsr 2015/01/05 13:38:31 Hum... Ok, I have a tendency to think the opposite
+ application_manager_.ConnectToApplication(GURL("mojo:tracing"), GURL(""),
+ spp.Pass());
if (listener_)
listener_->WaitForListening();
« no previous file with comments | « shell/context.h ('k') | sky/viewer/viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698