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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 GetCurrentThread(), | 50 GetCurrentThread(), |
51 GetCurrentProcess(), | 51 GetCurrentProcess(), |
52 &watched_thread_handle_, | 52 &watched_thread_handle_, |
53 THREAD_QUERY_INFORMATION, | 53 THREAD_QUERY_INFORMATION, |
54 FALSE, | 54 FALSE, |
55 0); | 55 0); |
56 DCHECK(result); | 56 DCHECK(result); |
57 #endif | 57 #endif |
58 | 58 |
59 #if defined(OS_CHROMEOS) | 59 #if defined(OS_CHROMEOS) |
60 tty_file_ = base::OpenFile(base::FilePath(kTtyFilePath), "r"); | 60 tty_file_ = file_util::OpenFile(base::FilePath(kTtyFilePath), "r"); |
61 #endif | 61 #endif |
62 watched_message_loop_->AddTaskObserver(&task_observer_); | 62 watched_message_loop_->AddTaskObserver(&task_observer_); |
63 } | 63 } |
64 | 64 |
65 void GpuWatchdogThread::PostAcknowledge() { | 65 void GpuWatchdogThread::PostAcknowledge() { |
66 // Called on the monitored thread. Responds with OnAcknowledge. Cannot use | 66 // Called on the monitored thread. Responds with OnAcknowledge. Cannot use |
67 // the method factory. Rely on reference counting instead. | 67 // the method factory. Rely on reference counting instead. |
68 message_loop()->PostTask( | 68 message_loop()->PostTask( |
69 FROM_HERE, | 69 FROM_HERE, |
70 base::Bind(&GpuWatchdogThread::OnAcknowledge, this)); | 70 base::Bind(&GpuWatchdogThread::OnAcknowledge, this)); |
(...skipping 243 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 |