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 <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 process_control->LoadApplication(app_name, std::move(request), | 78 process_control->LoadApplication(app_name, std::move(request), |
79 base::Bind(&OnApplicationLoaded, app_name)); | 79 base::Bind(&OnApplicationLoaded, app_name)); |
80 } | 80 } |
81 | 81 |
82 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) | 82 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
83 | 83 |
84 // Request mojom::ProcessControl from GPU process host. Must be called on IO | 84 // Request mojom::ProcessControl from GPU process host. Must be called on IO |
85 // thread. | 85 // thread. |
86 void RequestGpuProcessControl( | 86 void RequestGpuProcessControl( |
87 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 87 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
88 GpuProcessHost* process_host = | 88 BrowserChildProcessHostDelegate* process_host = |
89 GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED); | 89 GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED); |
90 if (!process_host) { | 90 if (!process_host) { |
91 DLOG(ERROR) << "GPU process host not available."; | 91 DLOG(ERROR) << "GPU process host not available."; |
92 return; | 92 return; |
93 } | 93 } |
94 | 94 |
95 // TODO(xhwang): It's possible that |process_host| is non-null, but the actual | 95 // TODO(xhwang): It's possible that |process_host| is non-null, but the actual |
96 // process is dead. In that case, |request| will be dropped and application | 96 // process is dead. In that case, |request| will be dropped and application |
97 // load requests through mojom::ProcessControl will also fail. Make sure we | 97 // load requests through mojom::ProcessControl will also fail. Make sure we |
98 // handle | 98 // handle |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 manifest_provider_.reset(); | 216 manifest_provider_.reset(); |
217 } | 217 } |
218 | 218 |
219 std::unique_ptr<BuiltinManifestProvider> manifest_provider_; | 219 std::unique_ptr<BuiltinManifestProvider> manifest_provider_; |
220 std::unique_ptr<catalog::Catalog> catalog_; | 220 std::unique_ptr<catalog::Catalog> catalog_; |
221 std::unique_ptr<shell::ServiceManager> service_manager_; | 221 std::unique_ptr<shell::ServiceManager> service_manager_; |
222 | 222 |
223 DISALLOW_COPY_AND_ASSIGN(InProcessServiceManagerContext); | 223 DISALLOW_COPY_AND_ASSIGN(InProcessServiceManagerContext); |
224 }; | 224 }; |
225 | 225 |
| 226 |
226 MojoShellContext::MojoShellContext() { | 227 MojoShellContext::MojoShellContext() { |
227 shell::mojom::ServiceRequest request; | 228 shell::mojom::ServiceRequest request; |
228 if (shell::ShellIsRemote()) { | 229 if (shell::ShellIsRemote()) { |
229 mojo::edk::SetParentPipeHandleFromCommandLine(); | 230 mojo::edk::SetParentPipeHandleFromCommandLine(); |
230 request = shell::GetServiceRequestFromCommandLine(); | 231 request = shell::GetServiceRequestFromCommandLine(); |
231 } else { | 232 } else { |
232 // Allow the embedder to register additional Mojo application manifests | 233 // Allow the embedder to register additional Mojo application manifests |
233 // beyond the default ones below. | 234 // beyond the default ones below. |
234 std::unique_ptr<ContentBrowserClient::MojoApplicationManifestMap> manifests( | 235 std::unique_ptr<ContentBrowserClient::MojoApplicationManifestMap> manifests( |
235 new ContentBrowserClient::MojoApplicationManifestMap); | 236 new ContentBrowserClient::MojoApplicationManifestMap); |
236 GetContentClient()->browser()->RegisterMojoApplicationManifests( | 237 GetContentClient()->browser()->RegisterMojoApplicationManifests( |
237 manifests.get()); | 238 manifests.get()); |
238 std::unique_ptr<BuiltinManifestProvider> manifest_provider = | 239 std::unique_ptr<BuiltinManifestProvider> manifest_provider = |
239 base::MakeUnique<BuiltinManifestProvider>(); | 240 base::MakeUnique<BuiltinManifestProvider>(); |
240 manifest_provider->AddManifests(std::move(manifests)); | 241 manifest_provider->AddManifests(std::move(manifests)); |
241 manifest_provider->AddManifestResource(kBrowserMojoApplicationName, | 242 manifest_provider->AddManifestResource(kBrowserMojoApplicationName, |
242 IDR_MOJO_CONTENT_BROWSER_MANIFEST); | 243 IDR_MOJO_CONTENT_BROWSER_MANIFEST); |
243 manifest_provider->AddManifestResource(kGpuMojoApplicationName, | 244 manifest_provider->AddManifestResource(kGpuMojoApplicationName, |
244 IDR_MOJO_CONTENT_GPU_MANIFEST); | 245 IDR_MOJO_CONTENT_GPU_MANIFEST); |
245 manifest_provider->AddManifestResource(kPluginMojoApplicationName, | |
246 IDR_MOJO_CONTENT_PLUGIN_MANIFEST); | |
247 manifest_provider->AddManifestResource(kRendererMojoApplicationName, | 246 manifest_provider->AddManifestResource(kRendererMojoApplicationName, |
248 IDR_MOJO_CONTENT_RENDERER_MANIFEST); | 247 IDR_MOJO_CONTENT_RENDERER_MANIFEST); |
249 manifest_provider->AddManifestResource(kUtilityMojoApplicationName, | 248 manifest_provider->AddManifestResource(kUtilityMojoApplicationName, |
250 IDR_MOJO_CONTENT_UTILITY_MANIFEST); | 249 IDR_MOJO_CONTENT_UTILITY_MANIFEST); |
251 manifest_provider->AddManifestResource("mojo:catalog", | 250 manifest_provider->AddManifestResource("mojo:catalog", |
252 IDR_MOJO_CATALOG_MANIFEST); | 251 IDR_MOJO_CATALOG_MANIFEST); |
253 manifest_provider->AddManifestResource(user_service::kUserServiceName, | 252 manifest_provider->AddManifestResource(user_service::kUserServiceName, |
254 IDR_MOJO_PROFILE_MANIFEST); | 253 IDR_MOJO_PROFILE_MANIFEST); |
255 | 254 |
256 in_process_context_ = new InProcessServiceManagerContext; | 255 in_process_context_ = new InProcessServiceManagerContext; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 in_process_context_->ShutDown(); | 310 in_process_context_->ShutDown(); |
312 } | 311 } |
313 | 312 |
314 // static | 313 // static |
315 shell::Connector* MojoShellContext::GetConnectorForIOThread() { | 314 shell::Connector* MojoShellContext::GetConnectorForIOThread() { |
316 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 315 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
317 return g_io_thread_connector.Get().get(); | 316 return g_io_thread_connector.Get().get(); |
318 } | 317 } |
319 | 318 |
320 } // namespace content | 319 } // namespace content |
OLD | NEW |