| 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/system/wait.h" | 10 #include "mojo/public/cpp/system/wait.h" |
| 11 | 11 |
| 12 namespace tracing { | 12 namespace tracing { |
| 13 | 13 |
| 14 TracingApp::TracingApp() : collector_binding_(this), tracing_active_(false) {} | 14 TracingApp::TracingApp() : collector_binding_(this), tracing_active_(false) {} |
| 15 | 15 |
| 16 TracingApp::~TracingApp() {} | 16 TracingApp::~TracingApp() {} |
| 17 | 17 |
| 18 bool TracingApp::ConfigureIncomingConnection( | 18 bool TracingApp::ConfigureIncomingConnection( |
| 19 mojo::ApplicationConnection* connection) { | 19 mojo::ServiceProviderImpl* service_provider_impl) { |
| 20 connection->GetServiceProviderImpl().AddService<TraceCollector>( | 20 service_provider_impl->AddService<TraceCollector>( |
| 21 [this](const mojo::ConnectionContext& connection_context, | 21 [this](const mojo::ConnectionContext& connection_context, |
| 22 mojo::InterfaceRequest<TraceCollector> trace_collector_request) { | 22 mojo::InterfaceRequest<TraceCollector> trace_collector_request) { |
| 23 if (collector_binding_.is_bound()) { | 23 if (collector_binding_.is_bound()) { |
| 24 LOG(ERROR) << "Another application is already connected to tracing."; | 24 LOG(ERROR) << "Another application is already connected to tracing."; |
| 25 return; | 25 return; |
| 26 } | 26 } |
| 27 | 27 |
| 28 collector_binding_.Bind(trace_collector_request.Pass()); | 28 collector_binding_.Bind(trace_collector_request.Pass()); |
| 29 }); | 29 }); |
| 30 connection->GetServiceProviderImpl().AddService<TraceProviderRegistry>( | 30 service_provider_impl->AddService<TraceProviderRegistry>( |
| 31 [this](const mojo::ConnectionContext& connection_context, | 31 [this](const mojo::ConnectionContext& connection_context, |
| 32 mojo::InterfaceRequest<TraceProviderRegistry> | 32 mojo::InterfaceRequest<TraceProviderRegistry> |
| 33 trace_provider_registry_request) { | 33 trace_provider_registry_request) { |
| 34 provider_registry_bindings_.AddBinding( | 34 provider_registry_bindings_.AddBinding( |
| 35 this, trace_provider_registry_request.Pass()); | 35 this, trace_provider_registry_request.Pass()); |
| 36 }); | 36 }); |
| 37 return true; | 37 return true; |
| 38 } | 38 } |
| 39 | 39 |
| 40 void TracingApp::Start(mojo::ScopedDataPipeProducerHandle stream, | 40 void TracingApp::Start(mojo::ScopedDataPipeProducerHandle stream, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 126 } |
| 127 provider_ptrs_.AddInterfacePtr(provider_ptr.Pass()); | 127 provider_ptrs_.AddInterfacePtr(provider_ptr.Pass()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void TracingApp::AllDataCollected() { | 130 void TracingApp::AllDataCollected() { |
| 131 recorder_impls_.clear(); | 131 recorder_impls_.clear(); |
| 132 sink_.reset(); | 132 sink_.reset(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace tracing | 135 } // namespace tracing |
| OLD | NEW |