| 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
|
|
|