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