| 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/service.h" | 5 #include "services/tracing/service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "mojo/public/cpp/system/wait.h" | 16 #include "mojo/public/cpp/system/wait.h" |
| 17 #include "services/service_manager/public/cpp/service_info.h" | 17 #include "services/service_manager/public/cpp/bind_source_info.h" |
| 18 | 18 |
| 19 namespace tracing { | 19 namespace tracing { |
| 20 | 20 |
| 21 Service::Service() : collector_binding_(this), tracing_active_(false) { | 21 Service::Service() : collector_binding_(this), tracing_active_(false) { |
| 22 registry_.AddInterface<mojom::Factory>(this); | 22 registry_.AddInterface<mojom::Factory>(this); |
| 23 registry_.AddInterface<mojom::Collector>(this); | 23 registry_.AddInterface<mojom::Collector>(this); |
| 24 registry_.AddInterface<mojom::StartupPerformanceDataCollector>(this); | 24 registry_.AddInterface<mojom::StartupPerformanceDataCollector>(this); |
| 25 } | 25 } |
| 26 Service::~Service() {} | 26 Service::~Service() {} |
| 27 | 27 |
| 28 void Service::OnBindInterface(const service_manager::ServiceInfo& source_info, | 28 void Service::OnBindInterface( |
| 29 const std::string& interface_name, | 29 const service_manager::BindSourceInfo& source_info, |
| 30 mojo::ScopedMessagePipeHandle interface_pipe) { | 30 const std::string& interface_name, |
| 31 mojo::ScopedMessagePipeHandle interface_pipe) { |
| 31 registry_.BindInterface(source_info.identity, interface_name, | 32 registry_.BindInterface(source_info.identity, interface_name, |
| 32 std::move(interface_pipe)); | 33 std::move(interface_pipe)); |
| 33 } | 34 } |
| 34 | 35 |
| 35 bool Service::OnServiceManagerConnectionLost() { | 36 bool Service::OnServiceManagerConnectionLost() { |
| 36 // TODO(beng): This is only required because Service isn't run by | 37 // TODO(beng): This is only required because Service isn't run by |
| 37 // ServiceRunner - instead it's launched automatically by the standalone | 38 // ServiceRunner - instead it's launched automatically by the standalone |
| 38 // service manager. It shouldn't be. | 39 // service manager. It shouldn't be. |
| 39 base::MessageLoop::current()->QuitWhenIdle(); | 40 base::MessageLoop::current()->QuitWhenIdle(); |
| 40 return false; | 41 return false; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 const GetStartupPerformanceTimesCallback& callback) { | 182 const GetStartupPerformanceTimesCallback& callback) { |
| 182 callback.Run(startup_performance_times_.Clone()); | 183 callback.Run(startup_performance_times_.Clone()); |
| 183 } | 184 } |
| 184 | 185 |
| 185 void Service::AllDataCollected() { | 186 void Service::AllDataCollected() { |
| 186 recorder_impls_.clear(); | 187 recorder_impls_.clear(); |
| 187 sink_.reset(); | 188 sink_.reset(); |
| 188 } | 189 } |
| 189 | 190 |
| 190 } // namespace tracing | 191 } // namespace tracing |
| OLD | NEW |