Chromium Code Reviews| Index: content/browser/service_manager/service_manager_context.cc |
| diff --git a/content/browser/service_manager/service_manager_context.cc b/content/browser/service_manager/service_manager_context.cc |
| index fe9651229ad9bd52feadcd44ad6f4d7d5ed3f710..b21bcf7d07251fceb715a32c24d101b5f1830093 100644 |
| --- a/content/browser/service_manager/service_manager_context.cc |
| +++ b/content/browser/service_manager/service_manager_context.cc |
| @@ -30,6 +30,8 @@ |
| #include "services/catalog/manifest_provider.h" |
| #include "services/catalog/public/interfaces/constants.mojom.h" |
| #include "services/catalog/store.h" |
| +#include "services/device/device_service.h" |
| +#include "services/device/public/interfaces/constants.mojom.h" |
| #include "services/file/public/interfaces/constants.mojom.h" |
| #include "services/service_manager/connect_params.h" |
| #include "services/service_manager/public/cpp/connector.h" |
| @@ -274,6 +276,13 @@ ServiceManagerContext::ServiceManagerContext() { |
| std::move(request), |
| BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))); |
| + ServiceInfo device_info; |
| + device_info.factory = |
| + base::Bind(&device::CreateDeviceService, |
| + BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); |
| + ServiceManagerConnection::GetForProcess()->AddEmbeddedService( |
| + device::mojom::kServiceName, device_info); |
| + |
| ContentBrowserClient::StaticServiceMap services; |
| GetContentClient()->browser()->RegisterInProcessServices(&services); |
| for (const auto& entry : services) { |
| @@ -315,6 +324,15 @@ ServiceManagerContext::ServiceManagerContext() { |
| ServiceManagerConnection::GetForProcess()->AddServiceRequestHandler( |
| "media", base::Bind(&StartServiceInGpuProcess, "media")); |
| #endif |
| + |
| + // Initiates the first connection to device service to create the singleton |
| + // instance, later the same instance will serve all the clients wanting to |
| + // connect to device service. |
| + // TODO(rockot): Eliminate this connection once content_browser is itself a |
| + // singleton service. |
|
Ken Rockot(use gerrit already)
2017/01/09 18:15:26
Please add http://crbug.com/679407 to this note. T
leonhsl(Using Gerrit)
2017/01/10 09:23:14
Done.
|
| + std::unique_ptr<service_manager::Connection> device_connection = |
| + ServiceManagerConnection::GetForProcess()->GetConnector()->Connect( |
| + device::mojom::kServiceName); |
| } |
| ServiceManagerContext::~ServiceManagerContext() { |