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 4e3177cec6167aac14f89db2223c82cd47757977..9571701ed575f00917369c59d71a358ed1552c17 100644 |
--- a/chrome/common/child_process_logging_win.cc |
+++ b/chrome/common/child_process_logging_win.cc |
@@ -16,7 +16,57 @@ |
namespace child_process_logging { |
+namespace { |
+ |
+// exported in breakpad_win.cc: |
+// void __declspec(dllexport) __cdecl SetCrashKeyValueImpl. |
+typedef void (__cdecl *SetCrashKeyValue)(const wchar_t*, const wchar_t*); |
+ |
+// exported in breakpad_win.cc: |
+// void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl. |
+typedef void (__cdecl *ClearCrashKeyValue)(const wchar_t*); |
+ |
+void SetCrashKeyValueTrampoline(const base::StringPiece& key, |
+ const base::StringPiece& value) { |
+ static SetCrashKeyValue set_crash_key = NULL; |
+ if (!set_crash_key) { |
+ HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
+ if (!exe_module) |
+ return; |
+ set_crash_key = reinterpret_cast<SetCrashKeyValue>( |
+ GetProcAddress(exe_module, "SetCrashKeyValueImpl")); |
+ } |
+ |
+ if (set_crash_key) { |
+ (set_crash_key)(base::UTF8ToWide(key).data(), |
+ base::UTF8ToWide(value).data()); |
+ } |
+} |
+ |
+void ClearCrashKeyValueTrampoline(const base::StringPiece& key) { |
+ static ClearCrashKeyValue clear_crash_key = NULL; |
+ if (!clear_crash_key) { |
+ HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
+ if (!exe_module) |
+ return; |
+ clear_crash_key = reinterpret_cast<ClearCrashKeyValue>( |
+ GetProcAddress(exe_module, "ClearCrashKeyValueImpl")); |
+ } |
+ |
+ if (clear_crash_key) |
+ (clear_crash_key)(base::UTF8ToWide(key).data()); |
+} |
+ |
+} // namespace |
+ |
void Init() { |
+ // Note: on other platforms, this is set up during Breakpad initialization, |
+ // in ChromeBreakpadClient. But on Windows, that is before the DLL module is |
+ // loaded, which is a prerequisite of the crash key system. |
+ crash_keys::RegisterChromeCrashKeys(); |
+ base::debug::SetCrashKeyReportingFunctions( |
+ &SetCrashKeyValueTrampoline, &ClearCrashKeyValueTrampoline); |
+ |
// This would be handled by BreakpadClient::SetCrashClientIdFromGUID(), but |
// because of the aforementioned issue, crash keys aren't ready yet at the |
// time of Breakpad initialization, load the client id backed up in Google |