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

Unified Diff: chrome/common/child_process_logging_win.cc

Issue 1517503004: win: Fix not setting crash keys in non-component build (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't initialize in tests Created 5 years 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/test/base/chrome_test_launcher.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 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
« no previous file with comments | « no previous file | chrome/test/base/chrome_test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698