Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/app/breakpad_win.cc

Issue 283024: Prevent multiple threads from executing the DumpDoneCallback handler... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include <vector> 10 #include <vector>
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return &custom_info_browser; 127 return &custom_info_browser;
128 } 128 }
129 129
130 // Contains the information needed by the worker thread. 130 // Contains the information needed by the worker thread.
131 struct CrashReporterInfo { 131 struct CrashReporterInfo {
132 google_breakpad::CustomClientInfo* custom_info; 132 google_breakpad::CustomClientInfo* custom_info;
133 std::wstring dll_path; 133 std::wstring dll_path;
134 std::wstring process_type; 134 std::wstring process_type;
135 }; 135 };
136 136
137 // flag to indicate that we are already handling an exception.
138 volatile LONG handling_exception = 0;
139
137 // This callback is executed when the browser process has crashed, after 140 // This callback is executed when the browser process has crashed, after
138 // the crash dump has been created. We need to minimize the amount of work 141 // the crash dump has been created. We need to minimize the amount of work
139 // done here since we have potentially corrupted process. Our job is to 142 // done here since we have potentially corrupted process. Our job is to
140 // spawn another instance of chrome which will show a 'chrome has crashed' 143 // spawn another instance of chrome which will show a 'chrome has crashed'
141 // dialog. This code needs to live in the exe and thus has no access to 144 // dialog. This code needs to live in the exe and thus has no access to
142 // facilities such as the i18n helpers. 145 // facilities such as the i18n helpers.
143 bool DumpDoneCallback(const wchar_t*, const wchar_t*, void*, 146 bool DumpDoneCallback(const wchar_t*, const wchar_t*, void*,
144 EXCEPTION_POINTERS* ex_info, 147 EXCEPTION_POINTERS* ex_info,
145 MDRawAssertionInfo*, bool) { 148 MDRawAssertionInfo*, bool) {
149 // Capture every thread except the first one in the sleep. We don't
150 // want multiple threads to concurrently execute the rest of the code.
151 if (::InterlockedCompareExchange(&handling_exception, 1, 0) == 1) {
152 ::Sleep(INFINITE);
Nicolas Sylvain 2009/10/16 22:58:46 why not just return false?
cpu_(ooo_6.6-7.5) 2009/10/17 00:54:19 Because we are in the exception hander still so th
153 }
154
146 // If the exception is because there was a problem loading a delay-loaded 155 // If the exception is because there was a problem loading a delay-loaded
147 // module, then show the user a dialog explaining the problem and then exit. 156 // module, then show the user a dialog explaining the problem and then exit.
148 if (DelayLoadFailureExceptionMessageBox(ex_info)) 157 if (DelayLoadFailureExceptionMessageBox(ex_info))
149 return true; 158 return true;
150 159
151 // We set CHROME_CRASHED env var. If the CHROME_RESTART is present. 160 // We set CHROME_CRASHED env var. If the CHROME_RESTART is present.
152 // This signals the child process to show the 'chrome has crashed' dialog. 161 // This signals the child process to show the 'chrome has crashed' dialog.
153 if (!::GetEnvironmentVariableW(env_vars::kRestartInfo, NULL, 0)) 162 if (!::GetEnvironmentVariableW(env_vars::kRestartInfo, NULL, 0))
154 return true; 163 return true;
155 ::SetEnvironmentVariableW(env_vars::kShowRestart, L"1"); 164 ::SetEnvironmentVariableW(env_vars::kShowRestart, L"1");
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 if (QueueUserWorkItem( 374 if (QueueUserWorkItem(
366 &InitCrashReporterThread, 375 &InitCrashReporterThread,
367 info.release(), 376 info.release(),
368 WT_EXECUTELONGFUNCTION) == 0) { 377 WT_EXECUTELONGFUNCTION) == 0) {
369 // We failed to queue to the worker pool, initialize in this thread. 378 // We failed to queue to the worker pool, initialize in this thread.
370 InitCrashReporterThread(info.release()); 379 InitCrashReporterThread(info.release());
371 } 380 }
372 } 381 }
373 } 382 }
374 } 383 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698