| 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 <map> |
| 7 #include <memory> | 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <utility> | 10 #include <utility> |
| 10 | 11 |
| 11 #include "base/bind.h" | 12 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 13 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
| 14 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 const base::string16& process_name, | 64 const base::string16& process_name, |
| 64 bool use_sandbox, | 65 bool use_sandbox, |
| 65 service_manager::mojom::ServiceRequest request) { | 66 service_manager::mojom::ServiceRequest request) { |
| 66 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 67 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 67 UtilityProcessHost* process_host = | 68 UtilityProcessHost* process_host = |
| 68 UtilityProcessHost::Create(nullptr, nullptr); | 69 UtilityProcessHost::Create(nullptr, nullptr); |
| 69 process_host->SetName(process_name); | 70 process_host->SetName(process_name); |
| 70 if (!use_sandbox) | 71 if (!use_sandbox) |
| 71 process_host->DisableSandbox(); | 72 process_host->DisableSandbox(); |
| 72 process_host->Start(); | 73 process_host->Start(); |
| 74 process_host->RegisterMojoServices(); |
| 73 service_manager::mojom::ServiceFactoryPtr service_factory; | 75 service_manager::mojom::ServiceFactoryPtr service_factory; |
| 74 BindInterface(process_host, mojo::MakeRequest(&service_factory)); | 76 BindInterface(process_host, mojo::MakeRequest(&service_factory)); |
| 75 service_factory->CreateService(std::move(request), service_name); | 77 service_factory->CreateService(std::move(request), service_name); |
| 76 } | 78 } |
| 77 | 79 |
| 78 // Request service_manager::mojom::ServiceFactory from GPU process host. Must be | 80 // Request service_manager::mojom::ServiceFactory from GPU process host. Must be |
| 79 // called on IO thread. | 81 // called on IO thread. |
| 80 void StartServiceInGpuProcess(const std::string& service_name, | 82 void StartServiceInGpuProcess(const std::string& service_name, |
| 81 service_manager::mojom::ServiceRequest request) { | 83 service_manager::mojom::ServiceRequest request) { |
| 82 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 84 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 base::Bind(&DestroyConnectorOnIOThread)); | 374 base::Bind(&DestroyConnectorOnIOThread)); |
| 373 } | 375 } |
| 374 | 376 |
| 375 // static | 377 // static |
| 376 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { | 378 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { |
| 377 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 379 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 378 return g_io_thread_connector.Get().get(); | 380 return g_io_thread_connector.Get().get(); |
| 379 } | 381 } |
| 380 | 382 |
| 381 } // namespace content | 383 } // namespace content |
| OLD | NEW |