| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 void GpuWatchdogThread::CleanUp() { | 78 void GpuWatchdogThread::CleanUp() { |
| 79 // The method factory must be destroyed on the watchdog thread. | 79 // The method factory must be destroyed on the watchdog thread. |
| 80 method_factory_->RevokeAll(); | 80 method_factory_->RevokeAll(); |
| 81 method_factory_.reset(); | 81 method_factory_.reset(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 GpuWatchdogThread::GpuWatchdogTaskObserver::GpuWatchdogTaskObserver( | 84 GpuWatchdogThread::GpuWatchdogTaskObserver::GpuWatchdogTaskObserver( |
| 85 GpuWatchdogThread* watchdog) | 85 GpuWatchdogThread* watchdog) |
| 86 : watchdog_(watchdog) { | 86 : watchdog_(watchdog) { |
| 87 } | 87 } |
| 88 | 88 |
| 89 GpuWatchdogThread::GpuWatchdogTaskObserver::~GpuWatchdogTaskObserver() { | 89 GpuWatchdogThread::GpuWatchdogTaskObserver::~GpuWatchdogTaskObserver() { |
| 90 } | 90 } |
| 91 | 91 |
| 92 void GpuWatchdogThread::GpuWatchdogTaskObserver::WillProcessTask( | 92 void GpuWatchdogThread::GpuWatchdogTaskObserver::WillProcessTask( |
| 93 const Task* task) | 93 base::TimeTicks time_posted) { |
| 94 { | |
| 95 watchdog_->CheckArmed(); | 94 watchdog_->CheckArmed(); |
| 96 } | 95 } |
| 97 | 96 |
| 98 void GpuWatchdogThread::GpuWatchdogTaskObserver::DidProcessTask( | 97 void GpuWatchdogThread::GpuWatchdogTaskObserver::DidProcessTask( |
| 99 const Task* task) | 98 base::TimeTicks time_posted) { |
| 100 { | |
| 101 watchdog_->CheckArmed(); | 99 watchdog_->CheckArmed(); |
| 102 } | 100 } |
| 103 | 101 |
| 104 void GpuWatchdogThread::CheckArmed() | 102 void GpuWatchdogThread::CheckArmed() { |
| 105 { | |
| 106 // Acknowledge the watchdog if it has armed itself. The watchdog will not | 103 // Acknowledge the watchdog if it has armed itself. The watchdog will not |
| 107 // change its armed state until it is acknowledged. | 104 // change its armed state until it is acknowledged. |
| 108 if (armed()) { | 105 if (armed()) { |
| 109 PostAcknowledge(); | 106 PostAcknowledge(); |
| 110 } | 107 } |
| 111 } | 108 } |
| 112 | 109 |
| 113 void GpuWatchdogThread::OnAcknowledge() { | 110 void GpuWatchdogThread::OnAcknowledge() { |
| 114 // The check has already been acknowledged and another has already been | 111 // The check has already been acknowledged and another has already been |
| 115 // scheduled by a previous call to OnAcknowledge. It is normal for a | 112 // scheduled by a previous call to OnAcknowledge. It is normal for a |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 #endif | 231 #endif |
| 235 | 232 |
| 236 LOG(ERROR) << "The GPU process hung. Terminating after " | 233 LOG(ERROR) << "The GPU process hung. Terminating after " |
| 237 << timeout_ << " ms."; | 234 << timeout_ << " ms."; |
| 238 | 235 |
| 239 volatile int* null_pointer = NULL; | 236 volatile int* null_pointer = NULL; |
| 240 *null_pointer = timeout; | 237 *null_pointer = timeout; |
| 241 | 238 |
| 242 crashed = true; | 239 crashed = true; |
| 243 } | 240 } |
| OLD | NEW |