Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: content/gpu/gpu_watchdog_thread.h

Issue 1980263002: GPU Watchdog to check I/O before terminating GPU process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed feedback Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 bool suspended_; 122 bool suspended_;
121 123
122 // The time the last OnSuspend and OnResume was called. 124 // The time the last OnSuspend and OnResume was called.
123 base::Time suspend_time_; 125 base::Time suspend_time_;
124 base::Time resume_time_; 126 base::Time resume_time_;
125 127
126 // This is the time the last check was sent. 128 // This is the time the last check was sent.
127 base::Time check_time_; 129 base::Time check_time_;
128 base::TimeTicks check_timeticks_; 130 base::TimeTicks check_timeticks_;
129 131
132 // Writing to this temp file is used as an additional step before crashing the
133 // process. That should help to distinguish true hangs from the cases when the
134 // watched thread is running slow being blocked on hard faults or other I/O.
135 base::File temp_file_for_io_checking_;
136 base::TimeDelta io_check_duration_;
137
130 #if defined(OS_CHROMEOS) 138 #if defined(OS_CHROMEOS)
131 FILE* tty_file_; 139 FILE* tty_file_;
132 #endif 140 #endif
133 141
134 #if defined(USE_X11) 142 #if defined(USE_X11)
135 XDisplay* display_; 143 XDisplay* display_;
136 gfx::AcceleratedWidget window_; 144 gfx::AcceleratedWidget window_;
137 XAtom atom_; 145 XAtom atom_;
138 #endif 146 #endif
139 147
140 base::WeakPtrFactory<GpuWatchdogThread> weak_factory_; 148 base::WeakPtrFactory<GpuWatchdogThread> weak_factory_;
141 149
142 DISALLOW_COPY_AND_ASSIGN(GpuWatchdogThread); 150 DISALLOW_COPY_AND_ASSIGN(GpuWatchdogThread);
143 }; 151 };
144 152
145 } // namespace content 153 } // namespace content
146 154
147 #endif // CONTENT_GPU_GPU_WATCHDOG_THREAD_H_ 155 #endif // CONTENT_GPU_GPU_WATCHDOG_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698