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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
16 #include "base/process.h" | 16 #include "base/process.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
19 #include "content/public/common/result_codes.h" | 19 #include "content/public/common/result_codes.h" |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 namespace { | 22 namespace { |
23 const int64 kCheckPeriodMs = 2000; | 23 const int64 kCheckPeriodMs = 2000; |
24 } // namespace | 24 } // namespace |
25 | 25 |
26 GpuWatchdogThread::GpuWatchdogThread(int timeout) | 26 GpuWatchdogThread::GpuWatchdogThread(int timeout) |
27 : base::Thread("Watchdog"), | 27 : base::Thread("Watchdog"), |
28 watched_message_loop_(MessageLoop::current()), | 28 watched_message_loop_(base::MessageLoop::current()), |
29 timeout_(base::TimeDelta::FromMilliseconds(timeout)), | 29 timeout_(base::TimeDelta::FromMilliseconds(timeout)), |
30 armed_(false), | 30 armed_(false), |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 watched_thread_handle_(0), | 32 watched_thread_handle_(0), |
33 arm_cpu_time_(), | 33 arm_cpu_time_(), |
34 #endif | 34 #endif |
35 task_observer_(this), | 35 task_observer_(this), |
36 weak_factory_(this) { | 36 weak_factory_(this) { |
37 DCHECK(timeout >= 0); | 37 DCHECK(timeout >= 0); |
38 | 38 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // not increasing. The other is where either the kernel hangs and never | 242 // not increasing. The other is where either the kernel hangs and never |
243 // returns to user level or where user level code | 243 // returns to user level or where user level code |
244 // calls into kernel level repeatedly, giving up its quanta before it is | 244 // calls into kernel level repeatedly, giving up its quanta before it is |
245 // tracked, for example a loop that repeatedly Sleeps. | 245 // tracked, for example a loop that repeatedly Sleeps. |
246 return base::TimeDelta::FromMilliseconds(static_cast<int64>( | 246 return base::TimeDelta::FromMilliseconds(static_cast<int64>( |
247 (user_time64.QuadPart + kernel_time64.QuadPart) / 10000)); | 247 (user_time64.QuadPart + kernel_time64.QuadPart) / 10000)); |
248 } | 248 } |
249 #endif | 249 #endif |
250 | 250 |
251 } // namespace content | 251 } // namespace content |
OLD | NEW |