| 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 #ifndef CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ | 5 #ifndef CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ |
| 6 #define CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ | 6 #define CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ |
| 7 | 7 |
| 8 #include "base/files/file.h" | |
| 9 #include "base/macros.h" | 8 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 12 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 13 #include "base/power_monitor/power_observer.h" | 12 #include "base/power_monitor/power_observer.h" |
| 14 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 15 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 16 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 17 #include "gpu/ipc/service/gpu_watchdog.h" | 16 #include "gpu/ipc/service/gpu_watchdog.h" |
| 18 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 void DidProcessTask(const base::PendingTask& pending_task) override; | 67 void DidProcessTask(const base::PendingTask& pending_task) override; |
| 69 | 68 |
| 70 private: | 69 private: |
| 71 GpuWatchdogThread* watchdog_; | 70 GpuWatchdogThread* watchdog_; |
| 72 }; | 71 }; |
| 73 | 72 |
| 74 ~GpuWatchdogThread() override; | 73 ~GpuWatchdogThread() override; |
| 75 | 74 |
| 76 void OnAcknowledge(); | 75 void OnAcknowledge(); |
| 77 void OnCheck(bool after_suspend); | 76 void OnCheck(bool after_suspend); |
| 78 void BeginTerminating(); | |
| 79 void DeliberatelyTerminateToRecoverFromHang(); | 77 void DeliberatelyTerminateToRecoverFromHang(); |
| 80 #if defined(USE_X11) | 78 #if defined(USE_X11) |
| 81 void SetupXServer(); | 79 void SetupXServer(); |
| 82 void SetupXChangeProp(); | 80 void SetupXChangeProp(); |
| 83 bool MatchXEventAtom(XEvent* event); | 81 bool MatchXEventAtom(XEvent* event); |
| 84 #endif | 82 #endif |
| 85 | 83 |
| 86 void OnAddPowerObserver(); | 84 void OnAddPowerObserver(); |
| 87 | 85 |
| 88 // Implement PowerObserver. | 86 // Implement PowerObserver. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 bool suspended_; | 124 bool suspended_; |
| 127 | 125 |
| 128 // The time the last OnSuspend and OnResume was called. | 126 // The time the last OnSuspend and OnResume was called. |
| 129 base::Time suspend_time_; | 127 base::Time suspend_time_; |
| 130 base::Time resume_time_; | 128 base::Time resume_time_; |
| 131 | 129 |
| 132 // This is the time the last check was sent. | 130 // This is the time the last check was sent. |
| 133 base::Time check_time_; | 131 base::Time check_time_; |
| 134 base::TimeTicks check_timeticks_; | 132 base::TimeTicks check_timeticks_; |
| 135 | 133 |
| 136 #if defined(OS_WIN) | |
| 137 // Writing to this temp file is used as an additional step before crashing the | |
| 138 // process. That should help to distinguish true hangs from the cases when the | |
| 139 // watched thread is running slow being blocked on hard faults or other I/O. | |
| 140 base::File temp_file_for_io_checking_; | |
| 141 base::TimeDelta io_check_duration_; | |
| 142 #endif | |
| 143 | |
| 144 #if defined(USE_X11) | 134 #if defined(USE_X11) |
| 145 XDisplay* display_; | 135 XDisplay* display_; |
| 146 gfx::AcceleratedWidget window_; | 136 gfx::AcceleratedWidget window_; |
| 147 XAtom atom_; | 137 XAtom atom_; |
| 148 FILE* tty_file_; | 138 FILE* tty_file_; |
| 149 int host_tty_; | 139 int host_tty_; |
| 150 #endif | 140 #endif |
| 151 | 141 |
| 152 base::WeakPtrFactory<GpuWatchdogThread> weak_factory_; | 142 base::WeakPtrFactory<GpuWatchdogThread> weak_factory_; |
| 153 | 143 |
| 154 DISALLOW_COPY_AND_ASSIGN(GpuWatchdogThread); | 144 DISALLOW_COPY_AND_ASSIGN(GpuWatchdogThread); |
| 155 }; | 145 }; |
| 156 | 146 |
| 157 } // namespace content | 147 } // namespace content |
| 158 | 148 |
| 159 #endif // CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ | 149 #endif // CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ |
| OLD | NEW |