After startup, don't measure CPU time in timing out GPU watchdog.
It's possible for the main thread to hang on a GPU event or waiting for
the OS, so if CPU usage is required for timing out the watchdog then
it's possible it'll never time out.
The GPU process may be preempted often on startup, so it makes sense to
check for CPU time then. However once the GPU process is processing
tasks smoothly that should be much less common, so CPU time checking can
be disabled. Time lost due to suspend/resume events should be handled by
the PowerMonitor, and this code seems to work on other platforms without
issues.
BUG=588342
Review URL: https://codereview.chromium.org/1776553002
Cr-Commit-Position: refs/heads/master@{#381126}
diff --git a/content/gpu/gpu_watchdog_thread.h b/content/gpu/gpu_watchdog_thread.h
index 4370d83..480e585 100644
--- a/content/gpu/gpu_watchdog_thread.h
+++ b/content/gpu/gpu_watchdog_thread.h
@@ -97,6 +97,14 @@
volatile bool armed_;
GpuWatchdogTaskObserver task_observer_;
+ // True if the watchdog should wait for a certain amount of CPU to be used
+ // before killing the process.
+ bool use_thread_cpu_time_;
+
+ // The number of consecutive acknowledgements that had a latency less than
+ // 50ms.
+ int responsive_acknowledge_count_;
+
#if defined(OS_WIN)
void* watched_thread_handle_;
base::TimeDelta arm_cpu_time_;
@@ -108,6 +116,9 @@
bool suspended_;
+ // This is the time the last check was sent.
+ base::Time check_time_;
+
#if defined(OS_CHROMEOS)
FILE* tty_file_;
#endif