| 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 "mojo/shell/standalone/context.h" | 5 #include "mojo/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 16 matching lines...) Expand all Loading... |
| 27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 28 #include "components/tracing/tracing_switches.h" | 28 #include "components/tracing/tracing_switches.h" |
| 29 #include "mojo/edk/embedder/embedder.h" | 29 #include "mojo/edk/embedder/embedder.h" |
| 30 #include "mojo/public/cpp/bindings/strong_binding.h" | 30 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 31 #include "mojo/services/tracing/public/cpp/switches.h" | 31 #include "mojo/services/tracing/public/cpp/switches.h" |
| 32 #include "mojo/services/tracing/public/cpp/trace_provider_impl.h" | 32 #include "mojo/services/tracing/public/cpp/trace_provider_impl.h" |
| 33 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 33 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
| 34 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" | 34 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" |
| 35 #include "mojo/shell/application_loader.h" | 35 #include "mojo/shell/application_loader.h" |
| 36 #include "mojo/shell/connect_params.h" | 36 #include "mojo/shell/connect_params.h" |
| 37 #include "mojo/shell/runner/host/command_line_switch.h" | |
| 38 #include "mojo/shell/runner/host/in_process_native_runner.h" | 37 #include "mojo/shell/runner/host/in_process_native_runner.h" |
| 39 #include "mojo/shell/runner/host/out_of_process_native_runner.h" | 38 #include "mojo/shell/runner/host/out_of_process_native_runner.h" |
| 40 #include "mojo/shell/standalone/tracer.h" | 39 #include "mojo/shell/standalone/tracer.h" |
| 41 #include "mojo/shell/switches.h" | 40 #include "mojo/shell/switches.h" |
| 42 #include "mojo/util/filename_util.h" | 41 #include "mojo/util/filename_util.h" |
| 43 #include "url/gurl.h" | 42 #include "url/gurl.h" |
| 44 | 43 |
| 45 namespace mojo { | 44 namespace mojo { |
| 46 namespace shell { | 45 namespace shell { |
| 47 namespace { | 46 namespace { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 91 |
| 93 void OnInstanceQuit(const GURL& url, const Identity& identity) { | 92 void OnInstanceQuit(const GURL& url, const Identity& identity) { |
| 94 if (url == identity.url()) | 93 if (url == identity.url()) |
| 95 base::MessageLoop::current()->QuitWhenIdle(); | 94 base::MessageLoop::current()->QuitWhenIdle(); |
| 96 } | 95 } |
| 97 | 96 |
| 98 } // namespace | 97 } // namespace |
| 99 | 98 |
| 100 Context::Context() | 99 Context::Context() |
| 101 : io_thread_(CreateIOThread("io_thread")), | 100 : io_thread_(CreateIOThread("io_thread")), |
| 102 main_entry_time_(base::Time::Now()) {} | 101 main_entry_time_(base::Time::Now()), |
| 102 native_runner_delegate_(nullptr) {} |
| 103 | 103 |
| 104 Context::~Context() { | 104 Context::~Context() { |
| 105 DCHECK(!base::MessageLoop::current()); | 105 DCHECK(!base::MessageLoop::current()); |
| 106 blocking_pool_->Shutdown(); | 106 blocking_pool_->Shutdown(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // static | 109 // static |
| 110 void Context::EnsureEmbedderIsInitialized() { | 110 void Context::EnsureEmbedderIsInitialized() { |
| 111 static base::LazyInstance<Setup>::Leaky setup = LAZY_INSTANCE_INITIALIZER; | 111 static base::LazyInstance<Setup>::Leaky setup = LAZY_INSTANCE_INITIALIZER; |
| 112 setup.Get(); | 112 setup.Get(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 138 if (command_line.HasSwitch(switches::kSingleProcess)) { | 138 if (command_line.HasSwitch(switches::kSingleProcess)) { |
| 139 #if defined(COMPONENT_BUILD) | 139 #if defined(COMPONENT_BUILD) |
| 140 LOG(ERROR) << "Running Mojo in single process component build, which isn't " | 140 LOG(ERROR) << "Running Mojo in single process component build, which isn't " |
| 141 << "supported because statics in apps interact. Use static build" | 141 << "supported because statics in apps interact. Use static build" |
| 142 << " or don't pass --single-process."; | 142 << " or don't pass --single-process."; |
| 143 #endif | 143 #endif |
| 144 runner_factory.reset( | 144 runner_factory.reset( |
| 145 new InProcessNativeRunnerFactory(blocking_pool_.get())); | 145 new InProcessNativeRunnerFactory(blocking_pool_.get())); |
| 146 } else { | 146 } else { |
| 147 runner_factory.reset(new OutOfProcessNativeRunnerFactory( | 147 runner_factory.reset(new OutOfProcessNativeRunnerFactory( |
| 148 blocking_pool_.get(), command_line_switches_)); | 148 blocking_pool_.get(), native_runner_delegate_)); |
| 149 } | 149 } |
| 150 application_manager_.reset(new ApplicationManager( | 150 application_manager_.reset(new ApplicationManager( |
| 151 std::move(runner_factory), blocking_pool_.get(), true)); | 151 std::move(runner_factory), blocking_pool_.get(), true)); |
| 152 | 152 |
| 153 shell::mojom::InterfaceProviderPtr tracing_remote_interfaces; | 153 shell::mojom::InterfaceProviderPtr tracing_remote_interfaces; |
| 154 shell::mojom::InterfaceProviderPtr tracing_local_interfaces; | 154 shell::mojom::InterfaceProviderPtr tracing_local_interfaces; |
| 155 new TracingInterfaceProvider(&tracer_, GetProxy(&tracing_local_interfaces)); | 155 new TracingInterfaceProvider(&tracer_, GetProxy(&tracing_local_interfaces)); |
| 156 | 156 |
| 157 scoped_ptr<ConnectParams> params(new ConnectParams); | 157 scoped_ptr<ConnectParams> params(new ConnectParams); |
| 158 params->set_source(Identity(GURL("mojo:shell"), std::string(), | 158 params->set_source(Identity(GURL("mojo:shell"), std::string(), |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 scoped_ptr<ConnectParams> params(new ConnectParams); | 229 scoped_ptr<ConnectParams> params(new ConnectParams); |
| 230 params->set_target( | 230 params->set_target( |
| 231 Identity(url, std::string(), GetPermissiveCapabilityFilter())); | 231 Identity(url, std::string(), GetPermissiveCapabilityFilter())); |
| 232 params->set_remote_interfaces(GetProxy(&remote_interfaces)); | 232 params->set_remote_interfaces(GetProxy(&remote_interfaces)); |
| 233 params->set_local_interfaces(std::move(local_interfaces)); | 233 params->set_local_interfaces(std::move(local_interfaces)); |
| 234 application_manager_->Connect(std::move(params)); | 234 application_manager_->Connect(std::move(params)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace shell | 237 } // namespace shell |
| 238 } // namespace mojo | 238 } // namespace mojo |
| OLD | NEW |