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/app/breakpad_win.h" | 5 #include "chrome/app/breakpad_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <tchar.h> | 9 #include <tchar.h> |
| 10 | 10 |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 513 | 513 |
| 514 bool WrapMessageBoxWithSEH(const wchar_t* text, const wchar_t* caption, | 514 bool WrapMessageBoxWithSEH(const wchar_t* text, const wchar_t* caption, |
| 515 UINT flags, bool* exit_now) { | 515 UINT flags, bool* exit_now) { |
| 516 // We wrap the call to MessageBoxW with a SEH handler because it some | 516 // We wrap the call to MessageBoxW with a SEH handler because it some |
| 517 // machines with CursorXP, PeaDict or with FontExplorer installed it crashes | 517 // machines with CursorXP, PeaDict or with FontExplorer installed it crashes |
| 518 // uncontrollably here. Being this a best effort deal we better go away. | 518 // uncontrollably here. Being this a best effort deal we better go away. |
| 519 __try { | 519 __try { |
| 520 *exit_now = (IDOK != ::MessageBoxW(NULL, text, caption, flags)); | 520 *exit_now = (IDOK != ::MessageBoxW(NULL, text, caption, flags)); |
| 521 } __except(EXCEPTION_EXECUTE_HANDLER) { | 521 } __except(EXCEPTION_EXECUTE_HANDLER) { |
| 522 // Its not safe to continue executing, exit silently here. | 522 // Its not safe to continue executing, exit silently here. |
| 523 ::ExitProcess(chrome::RESULT_CODE_RESPAWN_FAILED); | 523 ::TerminateProcess(::GetCurrentProcess(), |
|
rvargas (doing something else)
2012/03/21 03:13:45
Don't you want to reset the flag from this place i
eroman
2012/03/21 04:14:31
(Didn't reset because was harder; this code is run
rvargas (doing something else)
2012/03/21 17:46:12
Right, the exe... TerminateProcess sounds good. (T
| |
| 524 chrome::RESULT_CODE_RESPAWN_FAILED); | |
| 524 } | 525 } |
| 525 | 526 |
| 526 return true; | 527 return true; |
| 527 } | 528 } |
| 528 | 529 |
| 529 // This function is executed by the child process that DumpDoneCallback() | 530 // This function is executed by the child process that DumpDoneCallback() |
| 530 // spawned and basically just shows the 'chrome has crashed' dialog if | 531 // spawned and basically just shows the 'chrome has crashed' dialog if |
| 531 // the CHROME_CRASHED environment variable is present. | 532 // the CHROME_CRASHED environment variable is present. |
| 532 bool ShowRestartDialogIfCrashed(bool* exit_now) { | 533 bool ShowRestartDialogIfCrashed(bool* exit_now) { |
| 533 if (!::GetEnvironmentVariableW(ASCIIToWide(env_vars::kShowRestart).c_str(), | 534 if (!::GetEnvironmentVariableW(ASCIIToWide(env_vars::kShowRestart).c_str(), |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 563 flags, exit_now); | 564 flags, exit_now); |
| 564 } | 565 } |
| 565 | 566 |
| 566 // Crashes the process after generating a dump for the provided exception. Note | 567 // Crashes the process after generating a dump for the provided exception. Note |
| 567 // that the crash reporter should be initialized before calling this function | 568 // that the crash reporter should be initialized before calling this function |
| 568 // for it to do anything. | 569 // for it to do anything. |
| 569 extern "C" int __declspec(dllexport) CrashForException( | 570 extern "C" int __declspec(dllexport) CrashForException( |
| 570 EXCEPTION_POINTERS* info) { | 571 EXCEPTION_POINTERS* info) { |
| 571 if (g_breakpad) { | 572 if (g_breakpad) { |
| 572 g_breakpad->WriteMinidumpForException(info); | 573 g_breakpad->WriteMinidumpForException(info); |
| 573 ::ExitProcess(content::RESULT_CODE_KILLED); | 574 ::TerminateProcess(::GetCurrentProcess(), content::RESULT_CODE_KILLED); |
| 574 } | 575 } |
| 575 return EXCEPTION_CONTINUE_SEARCH; | 576 return EXCEPTION_CONTINUE_SEARCH; |
| 576 } | 577 } |
| 577 | 578 |
| 578 // Determine whether configuration management allows loading the crash reporter. | 579 // Determine whether configuration management allows loading the crash reporter. |
| 579 // Since the configuration management infrastructure is not initialized at this | 580 // Since the configuration management infrastructure is not initialized at this |
| 580 // point, we read the corresponding registry key directly. The return status | 581 // point, we read the corresponding registry key directly. The return status |
| 581 // indicates whether policy data was successfully read. If it is true, |result| | 582 // indicates whether policy data was successfully read. If it is true, |result| |
| 582 // contains the value set by policy. | 583 // contains the value set by policy. |
| 583 static bool MetricsReportingControlledByPolicy(bool* result) { | 584 static bool MetricsReportingControlledByPolicy(bool* result) { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 753 // Tells breakpad to handle breakpoint and single step exceptions. | 754 // Tells breakpad to handle breakpoint and single step exceptions. |
| 754 // This might break JIT debuggers, but at least it will always | 755 // This might break JIT debuggers, but at least it will always |
| 755 // generate a crashdump for these exceptions. | 756 // generate a crashdump for these exceptions. |
| 756 g_breakpad->set_handle_debug_exceptions(true); | 757 g_breakpad->set_handle_debug_exceptions(true); |
| 757 } | 758 } |
| 758 } | 759 } |
| 759 | 760 |
| 760 void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) { | 761 void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) { |
| 761 previous_filter = SetUnhandledExceptionFilter(filter); | 762 previous_filter = SetUnhandledExceptionFilter(filter); |
| 762 } | 763 } |
| OLD | NEW |