summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 23:05:05 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 23:05:05 +0000
commitb0534d44bc813d61df64ae32dd015e865c254d5f (patch)
treedfe2e0100c41d206d26924b530ba9d599252b3fd
parent11203f01dc03d31b89558b9cba0cf3ffe4d6511c (diff)
downloadchromium_src-b0534d44bc813d61df64ae32dd015e865c254d5f.zip
chromium_src-b0534d44bc813d61df64ae32dd015e865c254d5f.tar.gz
chromium_src-b0534d44bc813d61df64ae32dd015e865c254d5f.tar.bz2
Potential fix for duplicate crash reports on Windows.
BUG=24638 TEST=Not sure how the duplicate crash reports were getting generated so can not test that but made sure that the crash reporting works fine. Review URL: http://codereview.chromium.org/385030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31847 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/breakpad_win.cc30
1 files changed, 19 insertions, 11 deletions
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc
index fd635fc..297a034 100644
--- a/chrome/app/breakpad_win.cc
+++ b/chrome/app/breakpad_win.cc
@@ -147,9 +147,6 @@ struct CrashReporterInfo {
std::wstring process_type;
};
-// flag to indicate that we are already handling an exception.
-volatile LONG handling_exception = 0;
-
// 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
@@ -159,12 +156,6 @@ volatile LONG handling_exception = 0;
bool DumpDoneCallback(const wchar_t*, const wchar_t*, void*,
EXCEPTION_POINTERS* ex_info,
MDRawAssertionInfo*, bool) {
- // Capture every thread except the first one in the sleep. We don't
- // want multiple threads to concurrently execute the rest of the code.
- if (::InterlockedCompareExchange(&handling_exception, 1, 0) == 1) {
- ::Sleep(INFINITE);
- }
-
// If the exception is because there was a problem loading a delay-loaded
// module, then show the user a dialog explaining the problem and then exit.
if (DelayLoadFailureExceptionMessageBox(ex_info))
@@ -188,6 +179,22 @@ bool DumpDoneCallback(const wchar_t*, const wchar_t*, void*,
return true;
}
+// flag to indicate that we are already handling an exception.
+volatile LONG handling_exception = 0;
+
+// This callback is executed when the Chrome process has crashed and *before*
+// the crash dump is created. To prevent duplicate crash reports we
+// make every thread calling this method, except the very first one,
+// go to sleep.
+bool FilterCallback(void*, EXCEPTION_POINTERS*, MDRawAssertionInfo*) {
+ // Capture every thread except the first one in the sleep. We don't
+ // want multiple threads to concurrently report exceptions.
+ if (::InterlockedCompareExchange(&handling_exception, 1, 0) == 1) {
+ ::Sleep(INFINITE);
+ }
+ return true;
+}
+
// Previous unhandled filter. Will be called if not null when we
// intercept a crash.
LPTOP_LEVEL_EXCEPTION_FILTER previous_filter = NULL;
@@ -349,8 +356,9 @@ static DWORD __stdcall InitCrashReporterThread(void* param) {
bool full_dump = command.HasSwitch(switches::kFullMemoryCrashReport);
MINIDUMP_TYPE dump_type = full_dump ? MiniDumpWithFullMemory : MiniDumpNormal;
- g_breakpad = new google_breakpad::ExceptionHandler(temp_dir, NULL, callback,
- NULL, google_breakpad::ExceptionHandler::HANDLER_ALL,
+ g_breakpad = new google_breakpad::ExceptionHandler(temp_dir, &FilterCallback,
+ callback, NULL,
+ google_breakpad::ExceptionHandler::HANDLER_ALL,
dump_type, pipe_name.c_str(), info->custom_info);
if (!g_breakpad->IsOutOfProcess()) {