diff options
author | nsylvain@google.com <nsylvain@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-31 18:26:01 +0000 |
---|---|---|
committer | nsylvain@google.com <nsylvain@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-31 18:26:01 +0000 |
commit | b3358a60841326bc3da7222191994e33135339ad (patch) | |
tree | 54b9d2ec310a9030eaefc2564547123f0f362a60 /chrome | |
parent | dc36e9c53d3760bbdc4253b786c4686f4cf7a3ea (diff) | |
download | chromium_src-b3358a60841326bc3da7222191994e33135339ad.zip chromium_src-b3358a60841326bc3da7222191994e33135339ad.tar.gz chromium_src-b3358a60841326bc3da7222191994e33135339ad.tar.bz2 |
We did not display "Chrome crashed, Do you want to restart chrome" when breakpad is not initialized. Now we register a exception filter all the time.
BUG:1302309
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/breakpad.cc | 26 | ||||
-rw-r--r-- | chrome/app/breakpad.h | 4 | ||||
-rw-r--r-- | chrome/app/main.cc | 3 |
3 files changed, 30 insertions, 3 deletions
diff --git a/chrome/app/breakpad.cc b/chrome/app/breakpad.cc index 6cbea27..26bafd7 100644 --- a/chrome/app/breakpad.cc +++ b/chrome/app/breakpad.cc @@ -108,8 +108,6 @@ const wchar_t kEnvShowRestart[] = L"CHROME_CRASHED"; const wchar_t kRtlLocaleDirection[] = L"RIGHT_TO_LEFT"; const wchar_t kLtrLocaleDirection[] = L"LEFT_TO_RIGHT"; -} // namespace - // This callback is executed when the browser process has crashed, after // the crash dump has been created. We need to minimize the amount of work // done here since we have potentially corrupted process. Our job is to @@ -137,6 +135,23 @@ bool DumpDoneCallback(const wchar_t*, const wchar_t*, void*, return true; } +// Previous unhandled filter. Will be called if not null when we +// intercept a crash. +LPTOP_LEVEL_EXCEPTION_FILTER previous_filter = NULL; + +// Exception filter used when breakpad is not enabled. We just display +// the "Do you want to restart" message and then we call the previous filter. +long WINAPI ChromeExceptionFilter(EXCEPTION_POINTERS* info) { + DumpDoneCallback(NULL, NULL, NULL, info, NULL, false); + + if (previous_filter) + return previous_filter(info); + + return EXCEPTION_EXECUTE_HANDLER; +} + +} // namespace + // This function is executed by the child process that DumpDoneCallback() // spawned and basically just shows the 'chrome has crashed' dialog if // the CHROME_CRASHED environment variable is present. @@ -221,9 +236,16 @@ unsigned __stdcall InitCrashReporterThread(void* param) { return 0; } +void InitDefaultCrashCallback() { + previous_filter = SetUnhandledExceptionFilter(ChromeExceptionFilter); +} + void InitCrashReporter(std::wstring dll_path) { CommandLine command; if (!command.HasSwitch(switches::kDisableBreakpad)) { + // Disable the message box for assertions. + _CrtSetReportMode(_CRT_ASSERT, 0); + // Query the custom_info now because if we do it in the thread it's going to // fail in the sandbox. The thread will delete this object. CrashReporterInfo* info = new CrashReporterInfo; diff --git a/chrome/app/breakpad.h b/chrome/app/breakpad.h index ad87567..2d0f9f8e 100644 --- a/chrome/app/breakpad.h +++ b/chrome/app/breakpad.h @@ -37,6 +37,10 @@ // or directly for the plugin and renderer process. void InitCrashReporter(std::wstring dll_path); +// Intercepts a crash but does not process it, just ask if we want to restart +// the browser or not. +void InitDefaultCrashCallback(); + // Initializes the crash reporter in chrome. unsigned __stdcall InitCrashReporterThread(void* param); diff --git a/chrome/app/main.cc b/chrome/app/main.cc index f309e17..cbcfdee 100644 --- a/chrome/app/main.cc +++ b/chrome/app/main.cc @@ -71,8 +71,9 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev_instance, // Initialize the crash reporter. if (GoogleUpdateSettings::GetCollectStatsConsent()) { - _CrtSetReportMode(_CRT_ASSERT, 0); InitCrashReporter(client.GetDLLPath()); + } else { + InitDefaultCrashCallback(); } bool exit_now = false; |