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/service_manager/service_manager_context.h" | 5 #include "content/browser/service_manager/service_manager_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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 service_manager::mojom::ServiceFactoryPtr service_factory; | 71 service_manager::mojom::ServiceFactoryPtr service_factory; |
72 BindInterface(process_host, mojo::MakeRequest(&service_factory)); | 72 BindInterface(process_host, mojo::MakeRequest(&service_factory)); |
73 service_factory->CreateService(std::move(request), service_name); | 73 service_factory->CreateService(std::move(request), service_name); |
74 } | 74 } |
75 | 75 |
76 // Request service_manager::mojom::ServiceFactory from GPU process host. Must be | 76 // Request service_manager::mojom::ServiceFactory from GPU process host. Must be |
77 // called on IO thread. | 77 // called on IO thread. |
78 void StartServiceInGpuProcess(const std::string& service_name, | 78 void StartServiceInGpuProcess(const std::string& service_name, |
79 service_manager::mojom::ServiceRequest request) { | 79 service_manager::mojom::ServiceRequest request) { |
80 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 80 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
81 GpuProcessHost* process_host = | 81 GpuProcessHost* process_host = GpuProcessHost::Get(); |
82 GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED); | |
83 if (!process_host) { | 82 if (!process_host) { |
84 DLOG(ERROR) << "GPU process host not available."; | 83 DLOG(ERROR) << "GPU process host not available."; |
85 return; | 84 return; |
86 } | 85 } |
87 | 86 |
88 service_manager::mojom::ServiceFactoryPtr service_factory; | 87 service_manager::mojom::ServiceFactoryPtr service_factory; |
89 // TODO(xhwang): It's possible that |process_host| is non-null, but the actual | 88 // TODO(xhwang): It's possible that |process_host| is non-null, but the actual |
90 // process is dead. In that case, |request| will be dropped and application | 89 // process is dead. In that case, |request| will be dropped and application |
91 // load requests through ServiceFactory will also fail. Make sure we handle | 90 // load requests through ServiceFactory will also fail. Make sure we handle |
92 // these cases correctly. | 91 // these cases correctly. |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 base::Bind(&DestroyConnectorOnIOThread)); | 364 base::Bind(&DestroyConnectorOnIOThread)); |
366 } | 365 } |
367 | 366 |
368 // static | 367 // static |
369 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { | 368 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { |
370 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 369 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
371 return g_io_thread_connector.Get().get(); | 370 return g_io_thread_connector.Get().get(); |
372 } | 371 } |
373 | 372 |
374 } // namespace content | 373 } // namespace content |
OLD | NEW |