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

Unified Diff: content/child/child_thread_impl.cc

Issue 2510033002: [Device Service] Move PowerMonitor into the Device Service (Closed)
Patch Set: Created 4 years, 1 month 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
Index: content/child/child_thread_impl.cc
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index a92624a1e45009ec55dd987fe5406cbac5eaec29..d1a5e11ae6c095b88f4a7cd4068be046126c6c91 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -67,6 +67,7 @@
#include "mojo/edk/embedder/scoped_ipc_support.h"
#include "mojo/public/cpp/system/buffer.h"
#include "mojo/public/cpp/system/platform_handle.h"
+#include "services/device/public/cpp/constants.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/interface_factory.h"
#include "services/service_manager/public/cpp/interface_provider.h"
@@ -538,10 +539,17 @@ void ChildThreadImpl::Init(const Options& options) {
channel_->AddFilter(new ChildMemoryMessageFilter());
}
- // In single process mode we may already have a power monitor
+ // In single process mode we may already have a power monitor.
if (!base::PowerMonitor::Get()) {
+ std::unique_ptr<service_manager::Connection> device_connection;
+ service_manager::InterfaceProvider* remote_interfaces = nullptr;
+ if (service_manager_connection_) {
leonhsl(Using Gerrit) 2016/11/17 10:28:03 Should we use DCHECK(service_manager_connection_)
blundell 2016/11/22 16:46:44 I'm not sure either. Ken?
Ken Rockot(use gerrit already) 2016/11/22 17:23:40 There are still a few edge cases where there is no
+ device_connection = service_manager_connection_->GetConnector()->Connect(
+ device::kDeviceServiceName);
+ remote_interfaces = device_connection->GetRemoteInterfaces();
+ }
std::unique_ptr<device::PowerMonitorBroadcastSource> power_monitor_source(
- new device::PowerMonitorBroadcastSource(GetRemoteInterfaces()));
+ new device::PowerMonitorBroadcastSource(remote_interfaces));
power_monitor_.reset(
new base::PowerMonitor(std::move(power_monitor_source)));

Powered by Google App Engine
This is Rietveld 408576698