Chromium Code Reviews| 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 #include "chrome/browser/hang_monitor/hung_window_detector.h" | 5 #include "chrome/browser/hang_monitor/hung_window_detector.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h" | 11 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h" |
| 12 #include "content/public/common/result_codes.h" | 12 #include "content/public/common/result_codes.h" |
| 13 | 13 |
| 14 #if defined(OS_WIN) | |
| 15 #include "base/win/win_util.h" | |
|
ananta
2015/11/18 19:13:42
Remove the OS_WIN ifdef.
| |
| 16 #endif | |
| 17 | |
| 14 const wchar_t HungWindowDetector::kHungChildWindowTimeout[] = | 18 const wchar_t HungWindowDetector::kHungChildWindowTimeout[] = |
| 15 L"Chrome_HungChildWindowTimeout"; | 19 L"Chrome_HungChildWindowTimeout"; |
| 16 | 20 |
| 17 HungWindowDetector::HungWindowDetector(HungWindowNotification* notification) | 21 HungWindowDetector::HungWindowDetector(HungWindowNotification* notification) |
| 18 : notification_(notification), | 22 : notification_(notification), |
| 19 top_level_window_(NULL), | 23 top_level_window_(NULL), |
| 20 message_response_timeout_(0), | 24 message_response_timeout_(0), |
| 21 enumerating_(false) { | 25 enumerating_(false) { |
| 22 DCHECK(NULL != notification_); | 26 DCHECK(NULL != notification_); |
| 23 } | 27 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 | 85 |
| 82 DWORD child_window_process_id = 0; | 86 DWORD child_window_process_id = 0; |
| 83 DWORD child_window_thread_id = | 87 DWORD child_window_thread_id = |
| 84 GetWindowThreadProcessId(child_window, &child_window_process_id); | 88 GetWindowThreadProcessId(child_window, &child_window_process_id); |
| 85 bool continue_hang_detection = true; | 89 bool continue_hang_detection = true; |
| 86 | 90 |
| 87 if (top_level_window_thread_id != child_window_thread_id) { | 91 if (top_level_window_thread_id != child_window_thread_id) { |
| 88 // The message timeout for a child window starts of with a default | 92 // The message timeout for a child window starts of with a default |
| 89 // value specified by the message_response_timeout_ member. It is | 93 // value specified by the message_response_timeout_ member. It is |
| 90 // tracked by a property on the child window. | 94 // tracked by a property on the child window. |
| 91 #pragma warning(disable:4311) | 95 int child_window_message_timeout = base::win::HandleToUint32( |
| 92 int child_window_message_timeout = | 96 GetProp(child_window, kHungChildWindowTimeout)); |
| 93 reinterpret_cast<int>(GetProp(child_window, kHungChildWindowTimeout)); | |
| 94 #pragma warning(default:4311) | |
| 95 if (!child_window_message_timeout) { | 97 if (!child_window_message_timeout) { |
| 96 child_window_message_timeout = message_response_timeout_; | 98 child_window_message_timeout = message_response_timeout_; |
| 97 } | 99 } |
| 98 | 100 |
| 99 DWORD_PTR result = 0; | 101 DWORD_PTR result = 0; |
| 100 if (0 == SendMessageTimeout(child_window, | 102 if (0 == SendMessageTimeout(child_window, |
| 101 WM_NULL, | 103 WM_NULL, |
| 102 0, | 104 0, |
| 103 0, | 105 0, |
| 104 SMTO_BLOCK, | 106 SMTO_BLOCK, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 LPARAM param) { | 154 LPARAM param) { |
| 153 HungWindowDetector* detector_instance = | 155 HungWindowDetector* detector_instance = |
| 154 reinterpret_cast<HungWindowDetector*>(param); | 156 reinterpret_cast<HungWindowDetector*>(param); |
| 155 if (NULL == detector_instance) { | 157 if (NULL == detector_instance) { |
| 156 NOTREACHED(); | 158 NOTREACHED(); |
| 157 return FALSE; | 159 return FALSE; |
| 158 } | 160 } |
| 159 | 161 |
| 160 return detector_instance->CheckChildWindow(child_window); | 162 return detector_instance->CheckChildWindow(child_window); |
| 161 } | 163 } |
| OLD | NEW |