| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shell/standalone/context.h" | 5 #include "services/shell/standalone/context.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 21 matching lines...) Expand all Loading... |
| 32 #include "mojo/edk/embedder/embedder.h" | 32 #include "mojo/edk/embedder/embedder.h" |
| 33 #include "mojo/public/cpp/bindings/strong_binding.h" | 33 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 34 #include "services/catalog/catalog.h" | 34 #include "services/catalog/catalog.h" |
| 35 #include "services/catalog/store.h" | 35 #include "services/catalog/store.h" |
| 36 #include "services/shell/connect_params.h" | 36 #include "services/shell/connect_params.h" |
| 37 #include "services/shell/public/cpp/names.h" | 37 #include "services/shell/public/cpp/names.h" |
| 38 #include "services/shell/runner/host/in_process_native_runner.h" | 38 #include "services/shell/runner/host/in_process_native_runner.h" |
| 39 #include "services/shell/runner/host/out_of_process_native_runner.h" | 39 #include "services/shell/runner/host/out_of_process_native_runner.h" |
| 40 #include "services/shell/standalone/tracer.h" | 40 #include "services/shell/standalone/tracer.h" |
| 41 #include "services/shell/switches.h" | 41 #include "services/shell/switches.h" |
| 42 #include "services/tracing/public/cpp/provider.h" |
| 42 #include "services/tracing/public/cpp/switches.h" | 43 #include "services/tracing/public/cpp/switches.h" |
| 43 #include "services/tracing/public/cpp/trace_provider_impl.h" | |
| 44 #include "services/tracing/public/cpp/tracing_impl.h" | |
| 45 #include "services/tracing/public/interfaces/tracing.mojom.h" | 44 #include "services/tracing/public/interfaces/tracing.mojom.h" |
| 46 | 45 |
| 47 #if defined(OS_MACOSX) | 46 #if defined(OS_MACOSX) |
| 48 #include "services/shell/runner/host/mach_broker.h" | 47 #include "services/shell/runner/host/mach_broker.h" |
| 49 #endif | 48 #endif |
| 50 | 49 |
| 51 namespace shell { | 50 namespace shell { |
| 52 namespace { | 51 namespace { |
| 53 | 52 |
| 54 // Used to ensure we only init once. | 53 // Used to ensure we only init once. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 65 class TracingInterfaceProvider : public mojom::InterfaceProvider { | 64 class TracingInterfaceProvider : public mojom::InterfaceProvider { |
| 66 public: | 65 public: |
| 67 TracingInterfaceProvider(Tracer* tracer, | 66 TracingInterfaceProvider(Tracer* tracer, |
| 68 mojom::InterfaceProviderRequest request) | 67 mojom::InterfaceProviderRequest request) |
| 69 : tracer_(tracer), binding_(this, std::move(request)) {} | 68 : tracer_(tracer), binding_(this, std::move(request)) {} |
| 70 ~TracingInterfaceProvider() override {} | 69 ~TracingInterfaceProvider() override {} |
| 71 | 70 |
| 72 // mojom::InterfaceProvider: | 71 // mojom::InterfaceProvider: |
| 73 void GetInterface(const mojo::String& interface_name, | 72 void GetInterface(const mojo::String& interface_name, |
| 74 mojo::ScopedMessagePipeHandle client_handle) override { | 73 mojo::ScopedMessagePipeHandle client_handle) override { |
| 75 if (tracer_ && interface_name == tracing::TraceProvider::Name_) { | 74 if (tracer_ && interface_name == tracing::mojom::Provider::Name_) { |
| 76 tracer_->ConnectToProvider( | 75 tracer_->ConnectToProvider( |
| 77 mojo::MakeRequest<tracing::TraceProvider>(std::move(client_handle))); | 76 mojo::MakeRequest<tracing::mojom::Provider>( |
| 77 std::move(client_handle))); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 Tracer* tracer_; | 82 Tracer* tracer_; |
| 83 mojo::StrongBinding<mojom::InterfaceProvider> binding_; | 83 mojo::StrongBinding<mojom::InterfaceProvider> binding_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(TracingInterfaceProvider); | 85 DISALLOW_COPY_AND_ASSIGN(TracingInterfaceProvider); |
| 86 }; | 86 }; |
| 87 | 87 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 new TracingInterfaceProvider(&tracer_, GetProxy(&tracing_local_interfaces)); | 177 new TracingInterfaceProvider(&tracer_, GetProxy(&tracing_local_interfaces)); |
| 178 | 178 |
| 179 std::unique_ptr<ConnectParams> params(new ConnectParams); | 179 std::unique_ptr<ConnectParams> params(new ConnectParams); |
| 180 params->set_source(CreateServiceManagerIdentity()); | 180 params->set_source(CreateServiceManagerIdentity()); |
| 181 params->set_target(Identity("mojo:tracing", mojom::kRootUserID)); | 181 params->set_target(Identity("mojo:tracing", mojom::kRootUserID)); |
| 182 params->set_remote_interfaces(mojo::GetProxy(&tracing_remote_interfaces)); | 182 params->set_remote_interfaces(mojo::GetProxy(&tracing_remote_interfaces)); |
| 183 params->set_local_interfaces(std::move(tracing_local_interfaces)); | 183 params->set_local_interfaces(std::move(tracing_local_interfaces)); |
| 184 service_manager_->Connect(std::move(params)); | 184 service_manager_->Connect(std::move(params)); |
| 185 | 185 |
| 186 if (command_line.HasSwitch(tracing::kTraceStartup)) { | 186 if (command_line.HasSwitch(tracing::kTraceStartup)) { |
| 187 tracing::TraceCollectorPtr coordinator; | 187 tracing::mojom::CollectorPtr coordinator; |
| 188 auto coordinator_request = GetProxy(&coordinator); | 188 auto coordinator_request = GetProxy(&coordinator); |
| 189 tracing_remote_interfaces->GetInterface( | 189 tracing_remote_interfaces->GetInterface( |
| 190 tracing::TraceCollector::Name_, coordinator_request.PassMessagePipe()); | 190 tracing::mojom::Collector::Name_, |
| 191 coordinator_request.PassMessagePipe()); |
| 191 tracer_.StartCollectingFromTracingService(std::move(coordinator)); | 192 tracer_.StartCollectingFromTracingService(std::move(coordinator)); |
| 192 } | 193 } |
| 193 | 194 |
| 194 // Record the shell startup metrics used for performance testing. | 195 // Record the shell startup metrics used for performance testing. |
| 195 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 196 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 196 tracing::kEnableStatsCollectionBindings)) { | 197 tracing::kEnableStatsCollectionBindings)) { |
| 197 tracing::StartupPerformanceDataCollectorPtr collector; | 198 tracing::mojom::StartupPerformanceDataCollectorPtr collector; |
| 198 tracing_remote_interfaces->GetInterface( | 199 tracing_remote_interfaces->GetInterface( |
| 199 tracing::StartupPerformanceDataCollector::Name_, | 200 tracing::mojom::StartupPerformanceDataCollector::Name_, |
| 200 mojo::GetProxy(&collector).PassMessagePipe()); | 201 mojo::GetProxy(&collector).PassMessagePipe()); |
| 201 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) | 202 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) |
| 202 // CurrentProcessInfo::CreationTime is only defined on some platforms. | 203 // CurrentProcessInfo::CreationTime is only defined on some platforms. |
| 203 const base::Time creation_time = base::CurrentProcessInfo::CreationTime(); | 204 const base::Time creation_time = base::CurrentProcessInfo::CreationTime(); |
| 204 collector->SetShellProcessCreationTime(creation_time.ToInternalValue()); | 205 collector->SetShellProcessCreationTime(creation_time.ToInternalValue()); |
| 205 #endif | 206 #endif |
| 206 collector->SetShellMainEntryPointTime(main_entry_time_.ToInternalValue()); | 207 collector->SetShellMainEntryPointTime(main_entry_time_.ToInternalValue()); |
| 207 } | 208 } |
| 208 } | 209 } |
| 209 | 210 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 257 |
| 257 std::unique_ptr<ConnectParams> params(new ConnectParams); | 258 std::unique_ptr<ConnectParams> params(new ConnectParams); |
| 258 params->set_source(CreateServiceManagerIdentity()); | 259 params->set_source(CreateServiceManagerIdentity()); |
| 259 params->set_target(Identity(name, mojom::kRootUserID)); | 260 params->set_target(Identity(name, mojom::kRootUserID)); |
| 260 params->set_remote_interfaces(mojo::GetProxy(&remote_interfaces)); | 261 params->set_remote_interfaces(mojo::GetProxy(&remote_interfaces)); |
| 261 params->set_local_interfaces(std::move(local_interfaces)); | 262 params->set_local_interfaces(std::move(local_interfaces)); |
| 262 service_manager_->Connect(std::move(params)); | 263 service_manager_->Connect(std::move(params)); |
| 263 } | 264 } |
| 264 | 265 |
| 265 } // namespace shell | 266 } // namespace shell |
| OLD | NEW |