| 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 | 537 |
| 538 bool WrapMessageBoxWithSEH(const wchar_t* text, const wchar_t* caption, | 538 bool WrapMessageBoxWithSEH(const wchar_t* text, const wchar_t* caption, |
| 539 UINT flags, bool* exit_now) { | 539 UINT flags, bool* exit_now) { |
| 540 // We wrap the call to MessageBoxW with a SEH handler because it some | 540 // We wrap the call to MessageBoxW with a SEH handler because it some |
| 541 // machines with CursorXP, PeaDict or with FontExplorer installed it crashes | 541 // machines with CursorXP, PeaDict or with FontExplorer installed it crashes |
| 542 // uncontrollably here. Being this a best effort deal we better go away. | 542 // uncontrollably here. Being this a best effort deal we better go away. |
| 543 __try { | 543 __try { |
| 544 *exit_now = (IDOK != ::MessageBoxW(NULL, text, caption, flags)); | 544 *exit_now = (IDOK != ::MessageBoxW(NULL, text, caption, flags)); |
| 545 } __except(EXCEPTION_EXECUTE_HANDLER) { | 545 } __except(EXCEPTION_EXECUTE_HANDLER) { |
| 546 // Its not safe to continue executing, exit silently here. | 546 // Its not safe to continue executing, exit silently here. |
| 547 ::ExitProcess(chrome::RESULT_CODE_RESPAWN_FAILED); | 547 ::TerminateProcess(::GetCurrentProcess(), |
| 548 chrome::RESULT_CODE_RESPAWN_FAILED); |
| 548 } | 549 } |
| 549 | 550 |
| 550 return true; | 551 return true; |
| 551 } | 552 } |
| 552 | 553 |
| 553 // This function is executed by the child process that DumpDoneCallback() | 554 // This function is executed by the child process that DumpDoneCallback() |
| 554 // spawned and basically just shows the 'chrome has crashed' dialog if | 555 // spawned and basically just shows the 'chrome has crashed' dialog if |
| 555 // the CHROME_CRASHED environment variable is present. | 556 // the CHROME_CRASHED environment variable is present. |
| 556 bool ShowRestartDialogIfCrashed(bool* exit_now) { | 557 bool ShowRestartDialogIfCrashed(bool* exit_now) { |
| 557 if (!::GetEnvironmentVariableW(ASCIIToWide(env_vars::kShowRestart).c_str(), | 558 if (!::GetEnvironmentVariableW(ASCIIToWide(env_vars::kShowRestart).c_str(), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 587 flags, exit_now); | 588 flags, exit_now); |
| 588 } | 589 } |
| 589 | 590 |
| 590 // Crashes the process after generating a dump for the provided exception. Note | 591 // Crashes the process after generating a dump for the provided exception. Note |
| 591 // that the crash reporter should be initialized before calling this function | 592 // that the crash reporter should be initialized before calling this function |
| 592 // for it to do anything. | 593 // for it to do anything. |
| 593 extern "C" int __declspec(dllexport) CrashForException( | 594 extern "C" int __declspec(dllexport) CrashForException( |
| 594 EXCEPTION_POINTERS* info) { | 595 EXCEPTION_POINTERS* info) { |
| 595 if (g_breakpad) { | 596 if (g_breakpad) { |
| 596 g_breakpad->WriteMinidumpForException(info); | 597 g_breakpad->WriteMinidumpForException(info); |
| 597 ::ExitProcess(content::RESULT_CODE_KILLED); | 598 ::TerminateProcess(::GetCurrentProcess(), content::RESULT_CODE_KILLED); |
| 598 } | 599 } |
| 599 return EXCEPTION_CONTINUE_SEARCH; | 600 return EXCEPTION_CONTINUE_SEARCH; |
| 600 } | 601 } |
| 601 | 602 |
| 602 // Determine whether configuration management allows loading the crash reporter. | 603 // Determine whether configuration management allows loading the crash reporter. |
| 603 // Since the configuration management infrastructure is not initialized at this | 604 // Since the configuration management infrastructure is not initialized at this |
| 604 // point, we read the corresponding registry key directly. The return status | 605 // point, we read the corresponding registry key directly. The return status |
| 605 // indicates whether policy data was successfully read. If it is true, |result| | 606 // indicates whether policy data was successfully read. If it is true, |result| |
| 606 // contains the value set by policy. | 607 // contains the value set by policy. |
| 607 static bool MetricsReportingControlledByPolicy(bool* result) { | 608 static bool MetricsReportingControlledByPolicy(bool* result) { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 // Tells breakpad to handle breakpoint and single step exceptions. | 778 // Tells breakpad to handle breakpoint and single step exceptions. |
| 778 // This might break JIT debuggers, but at least it will always | 779 // This might break JIT debuggers, but at least it will always |
| 779 // generate a crashdump for these exceptions. | 780 // generate a crashdump for these exceptions. |
| 780 g_breakpad->set_handle_debug_exceptions(true); | 781 g_breakpad->set_handle_debug_exceptions(true); |
| 781 } | 782 } |
| 782 } | 783 } |
| 783 | 784 |
| 784 void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) { | 785 void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) { |
| 785 previous_filter = SetUnhandledExceptionFilter(filter); | 786 previous_filter = SetUnhandledExceptionFilter(filter); |
| 786 } | 787 } |
| OLD | NEW |