| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_HUNG_WINDOW_DETECTOR_H__ | 5 #ifndef CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__ |
| 6 #define CHROME_BROWSER_HUNG_WINDOW_DETECTOR_H__ | 6 #define CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__ |
| 7 | 7 |
| 8 #include "base/lock.h" | 8 #include "base/lock.h" |
| 9 #include "chrome/common/worker_thread_ticker.h" | 9 #include "chrome/common/worker_thread_ticker.h" |
| 10 | 10 |
| 11 // This class provides the following functionality: | 11 // This class provides the following functionality: |
| 12 // Given a top-level window handle, it enumerates all descendant windows | 12 // Given a top-level window handle, it enumerates all descendant windows |
| 13 // of that window and, on finding a window that belongs to a different | 13 // of that window and, on finding a window that belongs to a different |
| 14 // thread from that of the top-level window, it tests to see if that window | 14 // thread from that of the top-level window, it tests to see if that window |
| 15 // is responding to messages. It does this test by first calling the | 15 // is responding to messages. It does this test by first calling the |
| 16 // IsHungAppWindow API and, additionally (since the IsHungAppWindow API | 16 // IsHungAppWindow API and, additionally (since the IsHungAppWindow API |
| (...skipping 24 matching lines...) Expand all Loading... |
| 41 // child windows of the browser window to check if they are hung. | 41 // child windows of the browser window to check if they are hung. |
| 42 virtual bool OnHungWindowDetected(HWND hung_window, HWND top_level_window, | 42 virtual bool OnHungWindowDetected(HWND hung_window, HWND top_level_window, |
| 43 ActionOnHungWindow* action) = 0; | 43 ActionOnHungWindow* action) = 0; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // The notification object is not owned by this class. It is assumed that | 46 // The notification object is not owned by this class. It is assumed that |
| 47 // this pointer will be valid throughout the lifetime of this class. | 47 // this pointer will be valid throughout the lifetime of this class. |
| 48 // Ownership of this pointer is not transferred to this class. | 48 // Ownership of this pointer is not transferred to this class. |
| 49 // Note that the Initialize method needs to be called to initiate monitoring | 49 // Note that the Initialize method needs to be called to initiate monitoring |
| 50 // of hung windows. | 50 // of hung windows. |
| 51 HungWindowDetector(HungWindowNotification* notification); | 51 explicit HungWindowDetector(HungWindowNotification* notification); |
| 52 ~HungWindowDetector(); | 52 ~HungWindowDetector(); |
| 53 | 53 |
| 54 // This method initialized the monitoring of hung windows. All descendant | 54 // This method initialized the monitoring of hung windows. All descendant |
| 55 // windows of the passed-in top-level window which belong to a thread | 55 // windows of the passed-in top-level window which belong to a thread |
| 56 // different from that of the top-level window are monitored. The | 56 // different from that of the top-level window are monitored. The |
| 57 // message_response_timeout parameter indicates how long this class must | 57 // message_response_timeout parameter indicates how long this class must |
| 58 // wait for a window to respond to a sent message before it is considered | 58 // wait for a window to respond to a sent message before it is considered |
| 59 // to be non-responsive. | 59 // to be non-responsive. |
| 60 // Initialize can be called multiple times to change the actual window to | 60 // Initialize can be called multiple times to change the actual window to |
| 61 // be monitored as well as the message response timeout | 61 // be monitored as well as the message response timeout |
| (...skipping 19 matching lines...) Expand all Loading... |
| 81 // How long do we wait before we consider a window hung (in ms) | 81 // How long do we wait before we consider a window hung (in ms) |
| 82 int message_response_timeout_; | 82 int message_response_timeout_; |
| 83 Lock hang_detection_lock_; | 83 Lock hang_detection_lock_; |
| 84 // Indicates if this object is currently enumerating hung windows | 84 // Indicates if this object is currently enumerating hung windows |
| 85 bool enumerating_; | 85 bool enumerating_; |
| 86 | 86 |
| 87 DISALLOW_EVIL_CONSTRUCTORS(HungWindowDetector); | 87 DISALLOW_EVIL_CONSTRUCTORS(HungWindowDetector); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 | 90 |
| 91 #endif // CHROME_BROWSER_HUNG_WINDOW_DETECTOR_H__ | 91 #endif // CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__ |
| OLD | NEW |