Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2001)

Unified Diff: content/browser/service_manager/service_manager_context.cc

Issue 2510033002: [Device Service] Move PowerMonitor into the Device Service (Closed)
Patch Set: ServiceManagerContext does not hold the connection to device service Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/child/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4e3658ac45f061c689940def40eb4cd4aca0d1a5 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,15 @@ ServiceManagerContext::ServiceManagerContext() {
std::move(request),
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)));
+ // Registers the singletion device service to be embedded by browser service
+ // for now.
blundell 2017/01/06 12:28:09 I would eliminate this comment; I don't think it a
leonhsl(Using Gerrit) 2017/01/06 14:36:00 Done.
+ 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 +326,13 @@ 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
blundell 2017/01/06 12:28:09 Add below this: TODO(rockot): Eliminate this conn
leonhsl(Using Gerrit) 2017/01/06 14:36:00 OK I added a task to Ken :) Done.
+ // connect to device service.
+ std::unique_ptr<service_manager::Connection> device_connection =
+ ServiceManagerConnection::GetForProcess()->GetConnector()->Connect(
+ device::mojom::kServiceName);
}
ServiceManagerContext::~ServiceManagerContext() {
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/child/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698