| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 service_manager_.reset(new ServiceManager(std::move(runner_factory), | 169 service_manager_.reset(new ServiceManager(std::move(runner_factory), |
| 170 catalog_->TakeService())); | 170 catalog_->TakeService())); |
| 171 | 171 |
| 172 mojom::InterfaceProviderPtr tracing_remote_interfaces; | 172 mojom::InterfaceProviderPtr tracing_remote_interfaces; |
| 173 mojom::InterfaceProviderPtr tracing_local_interfaces; | 173 mojom::InterfaceProviderPtr tracing_local_interfaces; |
| 174 mojo::MakeStrongBinding(base::MakeUnique<TracingInterfaceProvider>(&tracer_), | 174 mojo::MakeStrongBinding(base::MakeUnique<TracingInterfaceProvider>(&tracer_), |
| 175 mojo::GetProxy(&tracing_local_interfaces)); | 175 mojo::GetProxy(&tracing_local_interfaces)); |
| 176 | 176 |
| 177 std::unique_ptr<ConnectParams> params(new ConnectParams); | 177 std::unique_ptr<ConnectParams> params(new ConnectParams); |
| 178 params->set_source(CreateServiceManagerIdentity()); | 178 params->set_source(CreateServiceManagerIdentity()); |
| 179 params->set_target(Identity("mojo:tracing", mojom::kRootUserID)); | 179 params->set_target(Identity("service:tracing", mojom::kRootUserID)); |
| 180 params->set_remote_interfaces(mojo::GetProxy(&tracing_remote_interfaces)); | 180 params->set_remote_interfaces(mojo::GetProxy(&tracing_remote_interfaces)); |
| 181 service_manager_->Connect(std::move(params)); | 181 service_manager_->Connect(std::move(params)); |
| 182 | 182 |
| 183 if (command_line.HasSwitch(tracing::kTraceStartup)) { | 183 if (command_line.HasSwitch(tracing::kTraceStartup)) { |
| 184 tracing::mojom::CollectorPtr coordinator; | 184 tracing::mojom::CollectorPtr coordinator; |
| 185 auto coordinator_request = GetProxy(&coordinator); | 185 auto coordinator_request = GetProxy(&coordinator); |
| 186 tracing_remote_interfaces->GetInterface( | 186 tracing_remote_interfaces->GetInterface( |
| 187 tracing::mojom::Collector::Name_, | 187 tracing::mojom::Collector::Name_, |
| 188 coordinator_request.PassMessagePipe()); | 188 coordinator_request.PassMessagePipe()); |
| 189 tracer_.StartCollectingFromTracingService(std::move(coordinator)); | 189 tracer_.StartCollectingFromTracingService(std::move(coordinator)); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 void Context::RunCommandLineApplication() { | 233 void Context::RunCommandLineApplication() { |
| 234 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 234 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 235 base::CommandLine::StringVector args = command_line->GetArgs(); | 235 base::CommandLine::StringVector args = command_line->GetArgs(); |
| 236 for (size_t i = 0; i < args.size(); ++i) { | 236 for (size_t i = 0; i < args.size(); ++i) { |
| 237 #if defined(OS_WIN) | 237 #if defined(OS_WIN) |
| 238 std::string possible_app = base::WideToUTF8(args[i]); | 238 std::string possible_app = base::WideToUTF8(args[i]); |
| 239 #else | 239 #else |
| 240 std::string possible_app = args[i]; | 240 std::string possible_app = args[i]; |
| 241 #endif | 241 #endif |
| 242 if (GetNameType(possible_app) == "mojo") { | 242 if (GetNameType(possible_app) == kNameType_Service) { |
| 243 Run(possible_app); | 243 Run(possible_app); |
| 244 break; | 244 break; |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 void Context::Run(const std::string& name) { | 249 void Context::Run(const std::string& name) { |
| 250 service_manager_->SetInstanceQuitCallback(base::Bind(&OnInstanceQuit, name)); | 250 service_manager_->SetInstanceQuitCallback(base::Bind(&OnInstanceQuit, name)); |
| 251 | 251 |
| 252 mojom::InterfaceProviderPtr remote_interfaces; | 252 mojom::InterfaceProviderPtr remote_interfaces; |
| 253 mojom::InterfaceProviderPtr local_interfaces; | 253 mojom::InterfaceProviderPtr local_interfaces; |
| 254 | 254 |
| 255 std::unique_ptr<ConnectParams> params(new ConnectParams); | 255 std::unique_ptr<ConnectParams> params(new ConnectParams); |
| 256 params->set_source(CreateServiceManagerIdentity()); | 256 params->set_source(CreateServiceManagerIdentity()); |
| 257 params->set_target(Identity(name, mojom::kRootUserID)); | 257 params->set_target(Identity(name, mojom::kRootUserID)); |
| 258 params->set_remote_interfaces(mojo::GetProxy(&remote_interfaces)); | 258 params->set_remote_interfaces(mojo::GetProxy(&remote_interfaces)); |
| 259 service_manager_->Connect(std::move(params)); | 259 service_manager_->Connect(std::move(params)); |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace shell | 262 } // namespace shell |
| OLD | NEW |