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 #if defined(OS_WIN) | 5 #if defined(OS_WIN) |
6 #include <windows.h> | 6 #include <windows.h> |
7 #endif | 7 #endif |
8 | 8 |
9 #include "content/gpu/gpu_watchdog_thread.h" | 9 #include "content/gpu/gpu_watchdog_thread.h" |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 GpuWatchdogThread::GpuWatchdogTaskObserver::GpuWatchdogTaskObserver( | 81 GpuWatchdogThread::GpuWatchdogTaskObserver::GpuWatchdogTaskObserver( |
82 GpuWatchdogThread* watchdog) | 82 GpuWatchdogThread* watchdog) |
83 : watchdog_(watchdog) { | 83 : watchdog_(watchdog) { |
84 } | 84 } |
85 | 85 |
86 GpuWatchdogThread::GpuWatchdogTaskObserver::~GpuWatchdogTaskObserver() { | 86 GpuWatchdogThread::GpuWatchdogTaskObserver::~GpuWatchdogTaskObserver() { |
87 } | 87 } |
88 | 88 |
89 void GpuWatchdogThread::GpuWatchdogTaskObserver::WillProcessTask( | 89 void GpuWatchdogThread::GpuWatchdogTaskObserver::WillProcessTask( |
90 base::TimeTicks time_posted) { | 90 const base::PendingTask& pending_task) { |
91 watchdog_->CheckArmed(); | 91 watchdog_->CheckArmed(); |
92 } | 92 } |
93 | 93 |
94 void GpuWatchdogThread::GpuWatchdogTaskObserver::DidProcessTask( | 94 void GpuWatchdogThread::GpuWatchdogTaskObserver::DidProcessTask( |
95 base::TimeTicks time_posted) { | 95 const base::PendingTask& pending_task) { |
96 watchdog_->CheckArmed(); | 96 watchdog_->CheckArmed(); |
97 } | 97 } |
98 | 98 |
99 GpuWatchdogThread::~GpuWatchdogThread() { | 99 GpuWatchdogThread::~GpuWatchdogThread() { |
100 // Verify that the thread was explicitly stopped. If the thread is stopped | 100 // Verify that the thread was explicitly stopped. If the thread is stopped |
101 // implicitly by the destructor, CleanUp() will not be called. | 101 // implicitly by the destructor, CleanUp() will not be called. |
102 DCHECK(!weak_factory_.HasWeakPtrs()); | 102 DCHECK(!weak_factory_.HasWeakPtrs()); |
103 | 103 |
104 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
105 CloseHandle(watched_thread_handle_); | 105 CloseHandle(watched_thread_handle_); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // not increasing. The other is where either the kernel hangs and never | 254 // not increasing. The other is where either the kernel hangs and never |
255 // returns to user level or where user level code | 255 // returns to user level or where user level code |
256 // calls into kernel level repeatedly, giving up its quanta before it is | 256 // calls into kernel level repeatedly, giving up its quanta before it is |
257 // tracked, for example a loop that repeatedly Sleeps. | 257 // tracked, for example a loop that repeatedly Sleeps. |
258 return base::TimeDelta::FromMilliseconds(static_cast<int64>( | 258 return base::TimeDelta::FromMilliseconds(static_cast<int64>( |
259 (user_time64.QuadPart + kernel_time64.QuadPart) / 10000)); | 259 (user_time64.QuadPart + kernel_time64.QuadPart) / 10000)); |
260 } | 260 } |
261 #endif | 261 #endif |
262 | 262 |
263 } // namespace content | 263 } // namespace content |
OLD | NEW |