OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/tracing/tracing_app.h" | 5 #include "services/tracing/tracing_app.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "mojo/public/cpp/application/service_provider_impl.h" |
10 #include "mojo/public/cpp/system/wait.h" | 11 #include "mojo/public/cpp/system/wait.h" |
11 | 12 |
12 namespace tracing { | 13 namespace tracing { |
13 | 14 |
14 TracingApp::TracingApp() : collector_binding_(this), tracing_active_(false) {} | 15 TracingApp::TracingApp() : collector_binding_(this), tracing_active_(false) {} |
15 | 16 |
16 TracingApp::~TracingApp() {} | 17 TracingApp::~TracingApp() {} |
17 | 18 |
18 bool TracingApp::ConfigureIncomingConnection( | 19 bool TracingApp::OnAcceptConnection( |
19 mojo::ServiceProviderImpl* service_provider_impl) { | 20 mojo::ServiceProviderImpl* service_provider_impl) { |
20 service_provider_impl->AddService<TraceCollector>( | 21 service_provider_impl->AddService<TraceCollector>( |
21 [this](const mojo::ConnectionContext& connection_context, | 22 [this](const mojo::ConnectionContext& connection_context, |
22 mojo::InterfaceRequest<TraceCollector> trace_collector_request) { | 23 mojo::InterfaceRequest<TraceCollector> trace_collector_request) { |
23 if (collector_binding_.is_bound()) { | 24 if (collector_binding_.is_bound()) { |
24 LOG(ERROR) << "Another application is already connected to tracing."; | 25 LOG(ERROR) << "Another application is already connected to tracing."; |
25 return; | 26 return; |
26 } | 27 } |
27 | 28 |
28 collector_binding_.Bind(trace_collector_request.Pass()); | 29 collector_binding_.Bind(trace_collector_request.Pass()); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 127 } |
127 provider_ptrs_.AddInterfacePtr(provider_ptr.Pass()); | 128 provider_ptrs_.AddInterfacePtr(provider_ptr.Pass()); |
128 } | 129 } |
129 | 130 |
130 void TracingApp::AllDataCollected() { | 131 void TracingApp::AllDataCollected() { |
131 recorder_impls_.clear(); | 132 recorder_impls_.clear(); |
132 sink_.reset(); | 133 sink_.reset(); |
133 } | 134 } |
134 | 135 |
135 } // namespace tracing | 136 } // namespace tracing |
OLD | NEW |