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 "base/process_util.h" | 5 #include "base/process_util.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <winternl.h> | 8 #include <winternl.h> |
9 #include <psapi.h> | 9 #include <psapi.h> |
10 | 10 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } | 180 } |
181 if (exitcode == STILL_ACTIVE) { | 181 if (exitcode == STILL_ACTIVE) { |
182 // The process is likely not dead or it used 0x103 as exit code. | 182 // The process is likely not dead or it used 0x103 as exit code. |
183 NOTREACHED(); | 183 NOTREACHED(); |
184 return false; | 184 return false; |
185 } | 185 } |
186 | 186 |
187 // Warning, this is not generic code; it heavily depends on the way | 187 // Warning, this is not generic code; it heavily depends on the way |
188 // the rest of the code kills a process. | 188 // the rest of the code kills a process. |
189 | 189 |
190 if (exitcode == 0 || // Normal termination. | 190 if (exitcode == PROCESS_END_NORMAL_TERMINATON || |
191 exitcode == 1 || // Killed by task manager. | 191 exitcode == PROCESS_END_KILLED_BY_USER || |
192 exitcode == 14 || // Killed because of a bad message. | 192 exitcode == PROCESS_END_PROCESS_WAS_HUNG || |
193 exitcode == 16 || // Killed by hung detector (see ResultCodes) | |
194 exitcode == 0xC0000354 || // STATUS_DEBUGGER_INACTIVE. | 193 exitcode == 0xC0000354 || // STATUS_DEBUGGER_INACTIVE. |
195 exitcode == 0xC000013A || // Control-C/end session. | 194 exitcode == 0xC000013A || // Control-C/end session. |
196 exitcode == 0x40010004) { // Debugger terminated process/end session. | 195 exitcode == 0x40010004) { // Debugger terminated process/end session. |
197 return false; | 196 return false; |
198 } | 197 } |
199 | 198 |
200 // All other exit codes indicate crashes. | 199 // All other exit codes indicate crashes. |
201 | 200 |
202 // TODO(jar): Remove histogramming code when UMA stats are consistent with | 201 // TODO(jar): Remove histogramming code when UMA stats are consistent with |
203 // other crash metrics. | 202 // other crash metrics. |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 void EnableTerminationOnHeapCorruption() { | 611 void EnableTerminationOnHeapCorruption() { |
613 // Ignore the result code. Supported on XP SP3 and Vista. | 612 // Ignore the result code. Supported on XP SP3 and Vista. |
614 HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); | 613 HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); |
615 } | 614 } |
616 | 615 |
617 void RaiseProcessToHighPriority() { | 616 void RaiseProcessToHighPriority() { |
618 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); | 617 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); |
619 } | 618 } |
620 | 619 |
621 } // namespace process_util | 620 } // namespace process_util |
OLD | NEW |