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..0ebdcfe26a4d3fdaec391bab24362a9cae1746d3 100644 |
--- a/chrome/common/child_process_logging_win.cc |
+++ b/chrome/common/child_process_logging_win.cc |
@@ -16,7 +16,48 @@ |
namespace child_process_logging { |
+namespace { |
+ |
+// exported in breakpad_win.cc/crashpad_win.cc: |
+// void __declspec(dllexport) __cdecl SetCrashKeyValueImpl. |
+typedef void(__cdecl* SetCrashKeyValue)(const wchar_t*, const wchar_t*); |
+ |
+// exported in breakpad_win.cc/crashpad_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 = [](){ |
+ HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
+ return reinterpret_cast<SetCrashKeyValue>( |
+ exe_module ? GetProcAddress(exe_module, "SetCrashKeyValueImpl") |
+ : nullptr); |
+ }(); |
+ 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 = [](){ |
+ HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
+ return reinterpret_cast<ClearCrashKeyValue>( |
+ exe_module ? GetProcAddress(exe_module, "ClearCrashKeyValueImpl") |
+ : nullptr); |
+ }(); |
+ if (clear_crash_key) |
+ (clear_crash_key)(base::UTF8ToWide(key).data()); |
+} |
+ |
+} // namespace |
+ |
void Init() { |
+ 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 |