| 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 "content/browser/mojo/mojo_shell_context.h" | 5 #include "content/browser/mojo/mojo_shell_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 16 #include "components/profile_service/profile_app.h" | 16 #include "components/profile_service/profile_app.h" |
| 17 #include "content/browser/gpu/gpu_process_host.h" | 17 #include "content/browser/gpu/gpu_process_host.h" |
| 18 #include "content/common/gpu/gpu_process_launch_causes.h" | |
| 19 #include "content/common/mojo/current_thread_loader.h" | 18 #include "content/common/mojo/current_thread_loader.h" |
| 20 #include "content/common/mojo/mojo_shell_connection_impl.h" | 19 #include "content/common/mojo/mojo_shell_connection_impl.h" |
| 21 #include "content/common/mojo/static_loader.h" | 20 #include "content/common/mojo/static_loader.h" |
| 22 #include "content/common/process_control.mojom.h" | 21 #include "content/common/process_control.mojom.h" |
| 23 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/content_browser_client.h" | 23 #include "content/public/browser/content_browser_client.h" |
| 25 #include "content/public/browser/utility_process_host.h" | 24 #include "content/public/browser/utility_process_host.h" |
| 26 #include "content/public/browser/utility_process_host_client.h" | 25 #include "content/public/browser/utility_process_host_client.h" |
| 27 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
| 28 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 29 #include "content/public/common/service_registry.h" | 28 #include "content/public/common/service_registry.h" |
| 29 #include "gpu/ipc/common/gpu_process_launch_causes.h" |
| 30 #include "mojo/public/cpp/bindings/interface_request.h" | 30 #include "mojo/public/cpp/bindings/interface_request.h" |
| 31 #include "mojo/public/cpp/bindings/string.h" | 31 #include "mojo/public/cpp/bindings/string.h" |
| 32 #include "mojo/services/catalog/factory.h" | 32 #include "mojo/services/catalog/factory.h" |
| 33 #include "mojo/services/catalog/store.h" | 33 #include "mojo/services/catalog/store.h" |
| 34 #include "mojo/shell/connect_params.h" | 34 #include "mojo/shell/connect_params.h" |
| 35 #include "mojo/shell/loader.h" | 35 #include "mojo/shell/loader.h" |
| 36 #include "mojo/shell/native_runner.h" | 36 #include "mojo/shell/native_runner.h" |
| 37 #include "mojo/shell/public/cpp/identity.h" | 37 #include "mojo/shell/public/cpp/identity.h" |
| 38 #include "mojo/shell/public/cpp/shell_client.h" | 38 #include "mojo/shell/public/cpp/shell_client.h" |
| 39 #include "mojo/shell/public/interfaces/connector.mojom.h" | 39 #include "mojo/shell/public/interfaces/connector.mojom.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 DISALLOW_COPY_AND_ASSIGN(UtilityProcessLoader); | 112 DISALLOW_COPY_AND_ASSIGN(UtilityProcessLoader); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 // Request mojom::ProcessControl from GPU process host. Must be called on IO | 115 // Request mojom::ProcessControl from GPU process host. Must be called on IO |
| 116 // thread. | 116 // thread. |
| 117 void RequestGpuProcessControl( | 117 void RequestGpuProcessControl( |
| 118 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 118 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
| 119 BrowserChildProcessHostDelegate* process_host = | 119 BrowserChildProcessHostDelegate* process_host = |
| 120 GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 120 GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 121 CAUSE_FOR_GPU_LAUNCH_MOJO_SETUP); | 121 gpu::CAUSE_FOR_GPU_LAUNCH_MOJO_SETUP); |
| 122 if (!process_host) { | 122 if (!process_host) { |
| 123 DLOG(ERROR) << "GPU process host not available."; | 123 DLOG(ERROR) << "GPU process host not available."; |
| 124 return; | 124 return; |
| 125 } | 125 } |
| 126 | 126 |
| 127 // TODO(xhwang): It's possible that |process_host| is non-null, but the actual | 127 // TODO(xhwang): It's possible that |process_host| is non-null, but the actual |
| 128 // process is dead. In that case, |request| will be dropped and application | 128 // process is dead. In that case, |request| will be dropped and application |
| 129 // load requests through mojom::ProcessControl will also fail. Make sure we | 129 // load requests through mojom::ProcessControl will also fail. Make sure we |
| 130 // handle | 130 // handle |
| 131 // these cases correctly. | 131 // these cases correctly. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 mojo::Identity source_id(requestor_name, user_id); | 308 mojo::Identity source_id(requestor_name, user_id); |
| 309 params->set_source(source_id); | 309 params->set_source(source_id); |
| 310 params->set_target(mojo::Identity(name, user_id)); | 310 params->set_target(mojo::Identity(name, user_id)); |
| 311 params->set_remote_interfaces(std::move(request)); | 311 params->set_remote_interfaces(std::move(request)); |
| 312 params->set_local_interfaces(std::move(exposed_services)); | 312 params->set_local_interfaces(std::move(exposed_services)); |
| 313 params->set_connect_callback(callback); | 313 params->set_connect_callback(callback); |
| 314 shell_->Connect(std::move(params)); | 314 shell_->Connect(std::move(params)); |
| 315 } | 315 } |
| 316 | 316 |
| 317 } // namespace content | 317 } // namespace content |
| OLD | NEW |