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 #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" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 if (NULL == child_process.m_h) { | 141 if (NULL == child_process.m_h) { |
142 break; | 142 break; |
143 } | 143 } |
144 // Before swinging the axe, do some sanity checks to make | 144 // Before swinging the axe, do some sanity checks to make |
145 // sure this window still belongs to the same process | 145 // sure this window still belongs to the same process |
146 DWORD process_id_check = 0; | 146 DWORD process_id_check = 0; |
147 GetWindowThreadProcessId(child_window, &process_id_check); | 147 GetWindowThreadProcessId(child_window, &process_id_check); |
148 if (process_id_check != child_window_process_id) { | 148 if (process_id_check != child_window_process_id) { |
149 break; | 149 break; |
150 } | 150 } |
151 TerminateProcess(child_process, ResultCodes::HUNG); | 151 TerminateProcess(child_process, content::RESULT_CODE_HUNG); |
152 WaitForSingleObject(child_process, kTerminateTimeout); | 152 WaitForSingleObject(child_process, kTerminateTimeout); |
153 child_process.Close(); | 153 child_process.Close(); |
154 break; | 154 break; |
155 } | 155 } |
156 default: { | 156 default: { |
157 break; | 157 break; |
158 } | 158 } |
159 } | 159 } |
160 } else { | 160 } else { |
161 RemoveProp(child_window, kHungChildWindowTimeout); | 161 RemoveProp(child_window, kHungChildWindowTimeout); |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 return continue_hang_detection; | 165 return continue_hang_detection; |
166 } | 166 } |
167 | 167 |
168 BOOL CALLBACK HungWindowDetector::ChildWndEnumProc(HWND child_window, | 168 BOOL CALLBACK HungWindowDetector::ChildWndEnumProc(HWND child_window, |
169 LPARAM param) { | 169 LPARAM param) { |
170 HungWindowDetector* detector_instance = | 170 HungWindowDetector* detector_instance = |
171 reinterpret_cast<HungWindowDetector*>(param); | 171 reinterpret_cast<HungWindowDetector*>(param); |
172 if (NULL == detector_instance) { | 172 if (NULL == detector_instance) { |
173 NOTREACHED(); | 173 NOTREACHED(); |
174 return FALSE; | 174 return FALSE; |
175 } | 175 } |
176 | 176 |
177 return detector_instance->CheckChildWindow(child_window); | 177 return detector_instance->CheckChildWindow(child_window); |
178 } | 178 } |
OLD | NEW |