| 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 20 matching lines...) Expand all Loading... |
| 31 GpuWatchdogThread::GpuWatchdogThread(int timeout) | 31 GpuWatchdogThread::GpuWatchdogThread(int timeout) |
| 32 : base::Thread("Watchdog"), | 32 : base::Thread("Watchdog"), |
| 33 watched_message_loop_(base::MessageLoop::current()), | 33 watched_message_loop_(base::MessageLoop::current()), |
| 34 timeout_(base::TimeDelta::FromMilliseconds(timeout)), | 34 timeout_(base::TimeDelta::FromMilliseconds(timeout)), |
| 35 armed_(false), | 35 armed_(false), |
| 36 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 37 watched_thread_handle_(0), | 37 watched_thread_handle_(0), |
| 38 arm_cpu_time_(), | 38 arm_cpu_time_(), |
| 39 #endif | 39 #endif |
| 40 task_observer_(this), | 40 task_observer_(this), |
| 41 weak_factory_(this), | 41 suspended_(false), |
| 42 suspended_(false) { | 42 weak_factory_(this) { |
| 43 DCHECK(timeout >= 0); | 43 DCHECK(timeout >= 0); |
| 44 | 44 |
| 45 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
| 46 // GetCurrentThread returns a pseudo-handle that cannot be used by one thread | 46 // GetCurrentThread returns a pseudo-handle that cannot be used by one thread |
| 47 // to identify another. DuplicateHandle creates a "real" handle that can be | 47 // to identify another. DuplicateHandle creates a "real" handle that can be |
| 48 // used for this purpose. | 48 // used for this purpose. |
| 49 BOOL result = DuplicateHandle(GetCurrentProcess(), | 49 BOOL result = DuplicateHandle(GetCurrentProcess(), |
| 50 GetCurrentThread(), | 50 GetCurrentThread(), |
| 51 GetCurrentProcess(), | 51 GetCurrentProcess(), |
| 52 &watched_thread_handle_, | 52 &watched_thread_handle_, |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // not increasing. The other is where either the kernel hangs and never | 314 // not increasing. The other is where either the kernel hangs and never |
| 315 // returns to user level or where user level code | 315 // returns to user level or where user level code |
| 316 // calls into kernel level repeatedly, giving up its quanta before it is | 316 // calls into kernel level repeatedly, giving up its quanta before it is |
| 317 // tracked, for example a loop that repeatedly Sleeps. | 317 // tracked, for example a loop that repeatedly Sleeps. |
| 318 return base::TimeDelta::FromMilliseconds(static_cast<int64>( | 318 return base::TimeDelta::FromMilliseconds(static_cast<int64>( |
| 319 (user_time64.QuadPart + kernel_time64.QuadPart) / 10000)); | 319 (user_time64.QuadPart + kernel_time64.QuadPart) / 10000)); |
| 320 } | 320 } |
| 321 #endif | 321 #endif |
| 322 | 322 |
| 323 } // namespace content | 323 } // namespace content |
| OLD | NEW |