OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__ | 5 #ifndef CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__ |
6 #define CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__ | 6 #define CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "chrome/common/worker_thread_ticker.h" | 10 #include "chrome/common/worker_thread_ticker.h" |
11 | 11 |
12 // This class provides the following functionality: | 12 // This class provides the following functionality: |
13 // Given a top-level window handle, it enumerates all descendant windows | 13 // Given a top-level window handle, it enumerates all descendant windows |
14 // of that window and, on finding a window that belongs to a different | 14 // of that window and, on finding a window that belongs to a different |
15 // thread from that of the top-level window, it tests to see if that window | 15 // thread from that of the top-level window, it tests to see if that window |
16 // is responding to messages. It does this test by first calling the | 16 // is responding to messages. It does this test by first calling the |
17 // IsHungAppWindow API and, additionally (since the IsHungAppWindow API | 17 // IsHungAppWindow API and, additionally (since the IsHungAppWindow API |
18 // does not deal correctly with suspended threads), send a dummy message | 18 // does not deal correctly with suspended threads), send a dummy message |
19 // (WM_NULL) to the window and verifies that the call does not timeout. | 19 // (WM_NULL) to the window and verifies that the call does not timeout. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 static BOOL CALLBACK ChildWndEnumProc(HWND child_window, LPARAM param); | 74 static BOOL CALLBACK ChildWndEnumProc(HWND child_window, LPARAM param); |
75 | 75 |
76 // Pointer to the HungWindowNotification callback interface. This class does | 76 // Pointer to the HungWindowNotification callback interface. This class does |
77 // not RefCount this pointer and it is assumed that the pointer will be valid | 77 // not RefCount this pointer and it is assumed that the pointer will be valid |
78 // throughout the lifetime of this class. | 78 // throughout the lifetime of this class. |
79 HungWindowNotification* notification_; | 79 HungWindowNotification* notification_; |
80 HWND top_level_window_; | 80 HWND top_level_window_; |
81 | 81 |
82 // How long do we wait before we consider a window hung (in ms) | 82 // How long do we wait before we consider a window hung (in ms) |
83 int message_response_timeout_; | 83 int message_response_timeout_; |
84 Lock hang_detection_lock_; | 84 base::Lock hang_detection_lock_; |
85 // Indicates if this object is currently enumerating hung windows | 85 // Indicates if this object is currently enumerating hung windows |
86 bool enumerating_; | 86 bool enumerating_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(HungWindowDetector); | 88 DISALLOW_COPY_AND_ASSIGN(HungWindowDetector); |
89 }; | 89 }; |
90 | 90 |
91 | 91 |
92 #endif // CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__ | 92 #endif // CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__ |
OLD | NEW |