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

Unified Diff: chrome/app/breakpad_win.cc

Issue 23453032: Chrome.BrowserCrashDumpAttempts needs to account for multiple dumps from the same browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/breakpad_win.cc
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc
index 9fc453127f3215c29f3f2f59fdc8600a7c93f43d..2a616f6ca508d7b4e36e0b8d5050c9d80ae30b49 100644
--- a/chrome/app/breakpad_win.cc
+++ b/chrome/app/breakpad_win.cc
@@ -13,6 +13,7 @@
#include <algorithm>
#include <vector>
+#include "base/atomicops.h"
#include "base/basictypes.h"
#include "base/base_switches.h"
#include "base/command_line.h"
@@ -127,6 +128,7 @@ static HKEY g_browser_crash_dump_regkey = NULL;
static const wchar_t kBrowserCrashDumpValueFormatStr[] = L"%08x-%08x";
static const int kBrowserCrashDumpValueLength = 17;
static wchar_t g_browser_crash_dump_value[kBrowserCrashDumpValueLength+1] = {0};
+static base::subtle::Atomic32 g_browser_crash_dump_count = 0;
cpu_(ooo_6.6-7.5) 2013/09/04 23:29:45 aka int32 btw
Roger McFarlane (Chromium) 2013/09/05 13:57:53 Yes, I know. But this communicates the intended us
void InitBrowserCrashDumpsRegKey() {
DCHECK(g_browser_crash_dump_regkey == NULL);
@@ -142,6 +144,7 @@ void InitBrowserCrashDumpsRegKey() {
return;
}
+ // Hold the registry key in a global for update on crash dump.
g_browser_crash_dump_regkey = regkey.Take();
// We use the current process id and the curren tick count as a (hopefully)
@@ -159,11 +162,24 @@ void InitBrowserCrashDumpsRegKey() {
}
void SendSmokeSignalForCrashDump() {
- if (g_browser_crash_dump_regkey != NULL) {
- base::win::RegKey regkey(g_browser_crash_dump_regkey);
- regkey.WriteValue(g_browser_crash_dump_value, 1);
- g_browser_crash_dump_regkey = NULL;
- }
+ // If we're not a browser (or the registry is unavailable to us for some
+ // reason) then there's nothing to do.
+ if (g_browser_crash_dump_regkey == NULL)
+ return;
+
+ // Increment the number of crash dumps and persist it to the registry.
+ // Note that there is a race condition here: the final count could be off by
+ // one if two dumps are triggered at the same moment and the registry writes
+ // happen to be committed in the reverse order of the atomic increments.
+ // We'll live with this, as we don't want to attempt any "real" work while
+ // we may be in a crashing state.
+ base::win::RegKey regkey(g_browser_crash_dump_regkey);
+ regkey.WriteValue(
+ g_browser_crash_dump_value,
+ base::subtle::NoBarrier_AtomicIncrement(&g_browser_crash_dump_count, 1));
+
+ // Don't let regkey auto-close the key. More crash dumps may follow.
+ ignore_result(regkey.Take());
}
// Dumps the current process memory.
« no previous file with comments | « no previous file | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698