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

Unified Diff: chrome/common/child_process_logging_win.cc

Issue 1476193002: Revert of Crashpad Windows: Use the Crashpad client instead of Breakpad on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/chrome_tests_unit.gypi ('k') | chrome/common/chrome_paths.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..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
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/common/chrome_paths.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698