| 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 #include "gpu/ipc/service/gpu_watchdog_thread.h" | 5 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 void GpuWatchdogThread::CheckArmed() { | 104 void GpuWatchdogThread::CheckArmed() { |
| 105 // If the watchdog is |awaiting_acknowledge_|, reset this variable to false | 105 // If the watchdog is |awaiting_acknowledge_|, reset this variable to false |
| 106 // and post an acknowledge task now. No barrier is needed as | 106 // and post an acknowledge task now. No barrier is needed as |
| 107 // |awaiting_acknowledge_| is only ever read from this thread. | 107 // |awaiting_acknowledge_| is only ever read from this thread. |
| 108 if (base::subtle::NoBarrier_CompareAndSwap(&awaiting_acknowledge_, true, | 108 if (base::subtle::NoBarrier_CompareAndSwap(&awaiting_acknowledge_, true, |
| 109 false)) | 109 false)) |
| 110 PostAcknowledge(); | 110 PostAcknowledge(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void GpuWatchdogThread::ReportProgress() { |
| 114 CheckArmed(); |
| 115 } |
| 116 |
| 113 void GpuWatchdogThread::Init() { | 117 void GpuWatchdogThread::Init() { |
| 114 // Schedule the first check. | 118 // Schedule the first check. |
| 115 OnCheck(false); | 119 OnCheck(false); |
| 116 } | 120 } |
| 117 | 121 |
| 118 void GpuWatchdogThread::CleanUp() { | 122 void GpuWatchdogThread::CleanUp() { |
| 119 weak_factory_.InvalidateWeakPtrs(); | 123 weak_factory_.InvalidateWeakPtrs(); |
| 120 } | 124 } |
| 121 | 125 |
| 122 GpuWatchdogThread::GpuWatchdogTaskObserver::GpuWatchdogTaskObserver( | 126 GpuWatchdogThread::GpuWatchdogTaskObserver::GpuWatchdogTaskObserver( |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 int tty_number; | 485 int tty_number; |
| 482 size_t num_res = sscanf(tty_string, "tty%d\n", &tty_number); | 486 size_t num_res = sscanf(tty_string, "tty%d\n", &tty_number); |
| 483 if (num_res == 1) | 487 if (num_res == 1) |
| 484 return tty_number; | 488 return tty_number; |
| 485 } | 489 } |
| 486 return -1; | 490 return -1; |
| 487 } | 491 } |
| 488 #endif | 492 #endif |
| 489 | 493 |
| 490 } // namespace gpu | 494 } // namespace gpu |
| OLD | NEW |