OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ | 5 #ifndef CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ |
6 #define CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ | 6 #define CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 bool MatchXEventAtom(XEvent* event); | 81 bool MatchXEventAtom(XEvent* event); |
82 #endif | 82 #endif |
83 | 83 |
84 void OnAddPowerObserver(); | 84 void OnAddPowerObserver(); |
85 | 85 |
86 // Implement PowerObserver. | 86 // Implement PowerObserver. |
87 void OnSuspend() override; | 87 void OnSuspend() override; |
88 void OnResume() override; | 88 void OnResume() override; |
89 | 89 |
90 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
91 base::TimeDelta GetWatchedThreadTime(); | 91 base::ThreadTicks GetWatchedThreadTime(); |
92 #endif | 92 #endif |
93 | 93 |
94 base::MessageLoop* watched_message_loop_; | 94 base::MessageLoop* watched_message_loop_; |
95 base::TimeDelta timeout_; | 95 base::TimeDelta timeout_; |
96 volatile bool armed_; | 96 volatile bool armed_; |
97 GpuWatchdogTaskObserver task_observer_; | 97 GpuWatchdogTaskObserver task_observer_; |
98 | 98 |
99 // True if the watchdog should wait for a certain amount of CPU to be used | 99 // True if the watchdog should wait for a certain amount of CPU to be used |
100 // before killing the process. | 100 // before killing the process. |
101 bool use_thread_cpu_time_; | 101 bool use_thread_cpu_time_; |
102 | 102 |
103 // The number of consecutive acknowledgements that had a latency less than | 103 // The number of consecutive acknowledgements that had a latency less than |
104 // 50ms. | 104 // 50ms. |
105 int responsive_acknowledge_count_; | 105 int responsive_acknowledge_count_; |
106 | 106 |
107 #if defined(OS_WIN) | 107 #if defined(OS_WIN) |
108 void* watched_thread_handle_; | 108 void* watched_thread_handle_; |
109 base::TimeDelta arm_cpu_time_; | 109 base::ThreadTicks arm_cpu_time_; |
110 | 110 |
111 // This measures the time that the system has been running, in units of 100 | 111 // This measures the time that the system has been running, in units of 100 |
112 // ns. | 112 // ns. |
113 ULONGLONG arm_interrupt_time_; | 113 ULONGLONG arm_interrupt_time_; |
114 #endif | 114 #endif |
115 | 115 |
116 // Time after which it's assumed that the computer has been suspended since | 116 // Time after which it's assumed that the computer has been suspended since |
117 // the task was posted. | 117 // the task was posted. |
118 base::Time suspension_timeout_; | 118 base::Time suspension_timeout_; |
119 | 119 |
(...skipping 18 matching lines...) Expand all Loading... |
138 #endif | 138 #endif |
139 | 139 |
140 base::WeakPtrFactory<GpuWatchdogThread> weak_factory_; | 140 base::WeakPtrFactory<GpuWatchdogThread> weak_factory_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(GpuWatchdogThread); | 142 DISALLOW_COPY_AND_ASSIGN(GpuWatchdogThread); |
143 }; | 143 }; |
144 | 144 |
145 } // namespace content | 145 } // namespace content |
146 | 146 |
147 #endif // CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ | 147 #endif // CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ |
OLD | NEW |