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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (power_monitor) | 145 if (power_monitor) |
146 power_monitor->RemoveObserver(this); | 146 power_monitor->RemoveObserver(this); |
147 | 147 |
148 #if defined(USE_X11) | 148 #if defined(USE_X11) |
149 if (tty_file_) | 149 if (tty_file_) |
150 fclose(tty_file_); | 150 fclose(tty_file_); |
151 XDestroyWindow(display_, window_); | 151 XDestroyWindow(display_, window_); |
152 XCloseDisplay(display_); | 152 XCloseDisplay(display_); |
153 #endif | 153 #endif |
154 | 154 |
155 watched_message_loop_->RemoveTaskObserver(&task_observer_); | 155 if (base::MessageLoop::current()) |
| 156 watched_message_loop_->RemoveTaskObserver(&task_observer_); |
156 } | 157 } |
157 | 158 |
158 void GpuWatchdogThread::OnAcknowledge() { | 159 void GpuWatchdogThread::OnAcknowledge() { |
159 CHECK(base::PlatformThread::CurrentId() == GetThreadId()); | 160 CHECK(base::PlatformThread::CurrentId() == GetThreadId()); |
160 | 161 |
161 // The check has already been acknowledged and another has already been | 162 // The check has already been acknowledged and another has already been |
162 // scheduled by a previous call to OnAcknowledge. It is normal for a | 163 // scheduled by a previous call to OnAcknowledge. It is normal for a |
163 // watched thread to see armed_ being true multiple times before | 164 // watched thread to see armed_ being true multiple times before |
164 // the OnAcknowledge task is run on the watchdog thread. | 165 // the OnAcknowledge task is run on the watchdog thread. |
165 if (!armed_) | 166 if (!armed_) |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 int tty_number; | 476 int tty_number; |
476 size_t num_res = sscanf(tty_string, "tty%d\n", &tty_number); | 477 size_t num_res = sscanf(tty_string, "tty%d\n", &tty_number); |
477 if (num_res == 1) | 478 if (num_res == 1) |
478 return tty_number; | 479 return tty_number; |
479 } | 480 } |
480 return -1; | 481 return -1; |
481 } | 482 } |
482 #endif | 483 #endif |
483 | 484 |
484 } // namespace gpu | 485 } // namespace gpu |
OLD | NEW |