| 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> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 service_manager::InterfaceRegistry* registry) { | 23 service_manager::InterfaceRegistry* registry) { |
| 24 registry->AddInterface<mojom::Factory>(this); | 24 registry->AddInterface<mojom::Factory>(this); |
| 25 registry->AddInterface<mojom::Collector>(this); | 25 registry->AddInterface<mojom::Collector>(this); |
| 26 registry->AddInterface<mojom::StartupPerformanceDataCollector>(this); | 26 registry->AddInterface<mojom::StartupPerformanceDataCollector>(this); |
| 27 return true; | 27 return true; |
| 28 } | 28 } |
| 29 | 29 |
| 30 bool Service::OnStop() { | 30 bool Service::OnStop() { |
| 31 // TODO(beng): This is only required because Service isn't run by | 31 // TODO(beng): This is only required because Service isn't run by |
| 32 // ServiceRunner - instead it's launched automatically by the standalone | 32 // ServiceRunner - instead it's launched automatically by the standalone |
| 33 // shell. It shouldn't be. | 33 // service manager. It shouldn't be. |
| 34 base::MessageLoop::current()->QuitWhenIdle(); | 34 base::MessageLoop::current()->QuitWhenIdle(); |
| 35 return false; | 35 return false; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void Service::Create(const service_manager::Identity& remote_identity, | 38 void Service::Create(const service_manager::Identity& remote_identity, |
| 39 mojom::FactoryRequest request) { | 39 mojom::FactoryRequest request) { |
| 40 bindings_.AddBinding(this, std::move(request)); | 40 bindings_.AddBinding(this, std::move(request)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void Service::Create(const service_manager::Identity& remote_identity, | 43 void Service::Create(const service_manager::Identity& remote_identity, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 if (satisfied & MOJO_HANDLE_SIGNAL_READABLE) | 131 if (satisfied & MOJO_HANDLE_SIGNAL_READABLE) |
| 132 recorder_impls_[index]->TryRead(); | 132 recorder_impls_[index]->TryRead(); |
| 133 else if (satisfied & MOJO_HANDLE_SIGNAL_PEER_CLOSED) | 133 else if (satisfied & MOJO_HANDLE_SIGNAL_PEER_CLOSED) |
| 134 recorder_impls_.erase(recorder_impls_.begin() + index); | 134 recorder_impls_.erase(recorder_impls_.begin() + index); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 AllDataCollected(); | 138 AllDataCollected(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void Service::SetShellProcessCreationTime(int64_t time) { | 141 void Service::SetServiceManagerProcessCreationTime(int64_t time) { |
| 142 if (startup_performance_times_.shell_process_creation_time == 0) | 142 if (startup_performance_times_.service_manager_process_creation_time == 0) |
| 143 startup_performance_times_.shell_process_creation_time = time; | 143 startup_performance_times_.service_manager_process_creation_time = time; |
| 144 } | 144 } |
| 145 | 145 |
| 146 void Service::SetShellMainEntryPointTime(int64_t time) { | 146 void Service::SetServiceManagerMainEntryPointTime(int64_t time) { |
| 147 if (startup_performance_times_.shell_main_entry_point_time == 0) | 147 if (startup_performance_times_.service_manager_main_entry_point_time == 0) |
| 148 startup_performance_times_.shell_main_entry_point_time = time; | 148 startup_performance_times_.service_manager_main_entry_point_time = time; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void Service::SetBrowserMessageLoopStartTicks(int64_t ticks) { | 151 void Service::SetBrowserMessageLoopStartTicks(int64_t ticks) { |
| 152 if (startup_performance_times_.browser_message_loop_start_ticks == 0) | 152 if (startup_performance_times_.browser_message_loop_start_ticks == 0) |
| 153 startup_performance_times_.browser_message_loop_start_ticks = ticks; | 153 startup_performance_times_.browser_message_loop_start_ticks = ticks; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void Service::SetBrowserWindowDisplayTicks(int64_t ticks) { | 156 void Service::SetBrowserWindowDisplayTicks(int64_t ticks) { |
| 157 if (startup_performance_times_.browser_window_display_ticks == 0) | 157 if (startup_performance_times_.browser_window_display_ticks == 0) |
| 158 startup_performance_times_.browser_window_display_ticks = ticks; | 158 startup_performance_times_.browser_window_display_ticks = ticks; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 177 const GetStartupPerformanceTimesCallback& callback) { | 177 const GetStartupPerformanceTimesCallback& callback) { |
| 178 callback.Run(startup_performance_times_.Clone()); | 178 callback.Run(startup_performance_times_.Clone()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void Service::AllDataCollected() { | 181 void Service::AllDataCollected() { |
| 182 recorder_impls_.clear(); | 182 recorder_impls_.clear(); |
| 183 sink_.reset(); | 183 sink_.reset(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace tracing | 186 } // namespace tracing |
| OLD | NEW |