diff options
author | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 00:13:25 +0000 |
---|---|---|
committer | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 00:13:25 +0000 |
commit | 5832ff87058de4a6eec25fd2abb183134e834124 (patch) | |
tree | 3966720a33620d9346b828145ddf4447f8e8c3f8 /chrome/app/breakpad_win.cc | |
parent | ff8b37511ce0a3a07e416ab5ee8842fdcaa04dfe (diff) | |
download | chromium_src-5832ff87058de4a6eec25fd2abb183134e834124.zip chromium_src-5832ff87058de4a6eec25fd2abb183134e834124.tar.gz chromium_src-5832ff87058de4a6eec25fd2abb183134e834124.tar.bz2 |
Added code to restart the service process in the event of a crash.
BUG=None.
TEST=A crash in the cloud print proxy should prompt the user for a restart.
Review URL: http://codereview.chromium.org/6474030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74886 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/breakpad_win.cc')
-rw-r--r-- | chrome/app/breakpad_win.cc | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc index fc85b26..b860bef 100644 --- a/chrome/app/breakpad_win.cc +++ b/chrome/app/breakpad_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -276,6 +276,14 @@ long WINAPI ChromeExceptionFilter(EXCEPTION_POINTERS* info) { return EXCEPTION_EXECUTE_HANDLER; } +// Exception filter for the service process used when breakpad is not enabled. +// We just display the "Do you want to restart" message and then die +// (without calling the previous filter). +long WINAPI ServiceExceptionFilter(EXCEPTION_POINTERS* info) { + DumpDoneCallback(NULL, NULL, NULL, info, NULL, false); + return EXCEPTION_EXECUTE_HANDLER; +} + extern "C" void __declspec(dllexport) __cdecl SetActiveURL( const wchar_t* url_cstring) { DCHECK(url_cstring); @@ -465,10 +473,15 @@ static DWORD __stdcall InitCrashReporterThread(void* param) { info->custom_info = GetCustomInfo(info->dll_path, info->process_type); google_breakpad::ExceptionHandler::MinidumpCallback callback = NULL; + LPTOP_LEVEL_EXCEPTION_FILTER default_filter = NULL; + // We install the post-dump callback only for the browser and service + // processes. It spawns a new browser/service process. if (info->process_type == L"browser") { - // We install the post-dump callback only for the browser process. It - // spawns a new browser process. callback = &DumpDoneCallback; + default_filter = &ChromeExceptionFilter; + } else if (info->process_type == L"service") { + callback = &DumpDoneCallback; + default_filter = &ServiceExceptionFilter; } // Check whether configuration management controls crash reporting. @@ -498,9 +511,9 @@ static DWORD __stdcall InitCrashReporterThread(void* param) { if (!crash_reporting_enabled) { // Configuration managed or the user did not allow Google Update to send // crashes, we need to use our default crash handler instead, but only - // for the browser process. - if (callback) - InitDefaultCrashCallback(); + // for the browser/service processes. + if (default_filter) + InitDefaultCrashCallback(default_filter); return 0; } @@ -510,8 +523,8 @@ static DWORD __stdcall InitCrashReporterThread(void* param) { std::wstring user_sid; if (is_per_user_install) { if (!base::win::GetUserSidString(&user_sid)) { - if (callback) - InitDefaultCrashCallback(); + if (default_filter) + InitDefaultCrashCallback(default_filter); return -1; } } else { @@ -559,8 +572,8 @@ static DWORD __stdcall InitCrashReporterThread(void* param) { return 0; } -void InitDefaultCrashCallback() { - previous_filter = SetUnhandledExceptionFilter(ChromeExceptionFilter); +void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) { + previous_filter = SetUnhandledExceptionFilter(filter); } void InitCrashReporterWithDllPath(const std::wstring& dll_path) { |