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

Unified Diff: content/gpu/gpu_watchdog_thread.h

Issue 22289002: Added suspend/resume detection to the GpuWatchdogThread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Derp. Null references are bad. Created 7 years, 4 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/gpu/gpu_main.cc ('k') | content/gpu/gpu_watchdog_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/gpu/gpu_watchdog_thread.h
diff --git a/content/gpu/gpu_watchdog_thread.h b/content/gpu/gpu_watchdog_thread.h
index 1ee079f5af14257180b7f84f79a0a9c45f5bbd6b..8731e41b436d27abafb4ede44ccf24b8fe8494d3 100644
--- a/content/gpu/gpu_watchdog_thread.h
+++ b/content/gpu/gpu_watchdog_thread.h
@@ -8,6 +8,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "base/power_monitor/power_observer.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "content/common/gpu/gpu_watchdog.h"
@@ -18,6 +19,7 @@ namespace content {
// and deliberately crashes if one of them does not respond after a timeout.
class GpuWatchdogThread : public base::Thread,
public GpuWatchdog,
+ public base::PowerObserver,
public base::RefCountedThreadSafe<GpuWatchdogThread> {
public:
explicit GpuWatchdogThread(int timeout);
@@ -29,6 +31,10 @@ class GpuWatchdogThread : public base::Thread,
// Implement GpuWatchdog.
virtual void CheckArmed() OVERRIDE;
+ // Must be called after a PowerMonitor has been created. Can be called from
+ // any thread.
+ void AddPowerObserver();
+
protected:
virtual void Init() OVERRIDE;
virtual void CleanUp() OVERRIDE;
@@ -58,6 +64,12 @@ class GpuWatchdogThread : public base::Thread,
void OnCheck(bool after_suspend);
void DeliberatelyTerminateToRecoverFromHang();
+ void OnAddPowerObserver();
+
+ // Implement PowerObserver.
+ virtual void OnSuspend() OVERRIDE;
+ virtual void OnResume() OVERRIDE;
+
#if defined(OS_WIN)
base::TimeDelta GetWatchedThreadTime();
#endif
@@ -78,6 +90,8 @@ class GpuWatchdogThread : public base::Thread,
base::WeakPtrFactory<GpuWatchdogThread> weak_factory_;
+ bool suspended_;
+
DISALLOW_COPY_AND_ASSIGN(GpuWatchdogThread);
};
« no previous file with comments | « content/gpu/gpu_main.cc ('k') | content/gpu/gpu_watchdog_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698