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

Unified Diff: content/gpu/gpu_main.cc

Issue 17074009: Created multi-process-friendly PowerMonitor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed message export for unit tests Created 7 years, 5 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
Index: content/gpu/gpu_main.cc
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index 221361feae2df5fe75e05fa3fe72fc60ca889f83..3b5148497a4a1004bdd39cf0950a0066f12bd7a1 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -11,6 +11,7 @@
#include "base/debug/trace_event.h"
#include "base/lazy_instance.h"
#include "base/message_loop.h"
+#include "base/power_monitor/power_monitor.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
@@ -19,6 +20,7 @@
#include "content/child/child_process.h"
#include "content/common/gpu/gpu_config.h"
#include "content/common/gpu/gpu_messages.h"
+#include "content/common/power_monitor_broadcast_source.h"
#include "content/common/sandbox_linux.h"
#include "content/gpu/gpu_child_thread.h"
#include "content/gpu/gpu_process.h"
@@ -169,6 +171,9 @@ int GpuMain(const MainFunctionParams& parameters) {
delayed_watchdog_enable = true;
#endif
+ PowerMonitorBroadcastSource* power_monitor_source =
+ new PowerMonitorBroadcastSource();
+ base::PowerMonitor power_monitor(power_monitor_source);
scoped_refptr<GpuWatchdogThread> watchdog_thread;
// Start the GPU watchdog only after anything that is expected to be time
@@ -283,6 +288,9 @@ int GpuMain(const MainFunctionParams& parameters) {
dead_on_arrival,
gpu_info,
deferred_messages.Get());
+
+ child_thread->channel()->AddFilter(power_monitor_source->MessageFilter());
piman 2013/07/12 21:09:58 So, what is meant to happen on Android, where the
bajones 2013/07/13 00:33:20 That's a good point. I've added a guard on in_brow
piman 2013/07/13 00:44:41 That's not exactly what I had in mind... On Androi
+
while (!deferred_messages.Get().empty())
deferred_messages.Get().pop();

Powered by Google App Engine
This is Rietveld 408576698