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

Unified Diff: chrome/common/child_process_logging_win.cc

Issue 2377963002: restore LOG_FATAL crash key on windows
Patch Set: move CrashMessageHandler out of base Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/chrome_crash_reporter_client_win.cc ('k') | chrome/common/crash_keys.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/child_process_logging_win.cc
diff --git a/chrome/common/child_process_logging_win.cc b/chrome/common/child_process_logging_win.cc
index 3460812edc0551745f9264347d399e93eba0f020..4346af5b00a6cc748e2341934a46dc14a3b57ab2 100644
--- a/chrome/common/child_process_logging_win.cc
+++ b/chrome/common/child_process_logging_win.cc
@@ -8,6 +8,7 @@
#include <memory>
+#include "base/auto_reset.h"
#include "base/debug/crash_logging.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/chrome_constants.h"
@@ -52,11 +53,25 @@ void ClearCrashKeyValueTrampoline(const base::StringPiece& key) {
(clear_crash_key)(base::UTF8ToWide(key).data());
}
+// Please keep synced with one in crashpad.cc.
+void CrashMessageHandler(const std::string& message) {
+ // In case of an out-of-memory condition, this code could be reentered when
+ // constructing and storing the key. Using a static is not thread-safe, but
+ // if multiple threads are in the process of a fatal crash at the same time,
+ // this should work.
+ static bool guarded = false;
+ if (!guarded) {
+ base::AutoReset<bool> guard(&guarded, true);
+ base::debug::SetCrashKeyValue("LOG_FATAL", message);
+ }
+}
+
} // namespace
void Init() {
base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueTrampoline,
&ClearCrashKeyValueTrampoline);
+ logging::SetCrashMessageHandler(CrashMessageHandler);
// This would be handled by BreakpadClient::SetCrashClientIdFromGUID(), but
// because of the aforementioned issue, crash keys aren't ready yet at the
« no previous file with comments | « chrome/app/chrome_crash_reporter_client_win.cc ('k') | chrome/common/crash_keys.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698