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

Unified Diff: gpu/ipc/service/gpu_watchdog_thread.h

Issue 2389633003: Throttle GpuWatchdogThread task posting (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | gpu/ipc/service/gpu_watchdog_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/gpu_watchdog_thread.h
diff --git a/gpu/ipc/service/gpu_watchdog_thread.h b/gpu/ipc/service/gpu_watchdog_thread.h
index cbb828d7f4e9f9ccf63487d7135fd6214a61c342..0489286dfe6e85194820b7e7d8efc7d0da6bbf2e 100644
--- a/gpu/ipc/service/gpu_watchdog_thread.h
+++ b/gpu/ipc/service/gpu_watchdog_thread.h
@@ -5,6 +5,7 @@
#ifndef GPU_IPC_SERVICE_GPU_WATCHDOG_THREAD_H_
#define GPU_IPC_SERVICE_GPU_WATCHDOG_THREAD_H_
+#include "base/atomicops.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
@@ -37,10 +38,7 @@ class GPU_EXPORT GpuWatchdogThread
public:
static scoped_refptr<GpuWatchdogThread> Create();
- // Accessible on watched thread but only modified by watchdog thread.
- bool armed() const { return armed_; }
void PostAcknowledge();
-
void CheckArmed();
// Must be called after a PowerMonitor has been created. Can be called from
@@ -97,9 +95,14 @@ class GPU_EXPORT GpuWatchdogThread
base::MessageLoop* watched_message_loop_;
base::TimeDelta timeout_;
- volatile bool armed_;
+ bool armed_;
GpuWatchdogTaskObserver task_observer_;
+ // |awaiting_acknowledge_| is only ever read on the watched thread, but may
+ // be modified on either the watched or watchdog thread. Reads/writes should
+ // be careful to ensure that appropriate synchronization is used.
+ base::subtle::Atomic32 awaiting_acknowledge_;
+
// True if the watchdog should wait for a certain amount of CPU to be used
// before killing the process.
bool use_thread_cpu_time_;
« no previous file with comments | « no previous file | gpu/ipc/service/gpu_watchdog_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698