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

Unified Diff: chrome/installer/setup/installer_crash_reporter_client.cc

Issue 1561663003: CL for perf tryjob on win (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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
Index: chrome/installer/setup/installer_crash_reporter_client.cc
diff --git a/chrome/installer/setup/installer_crash_reporter_client.cc b/chrome/installer/setup/installer_crash_reporter_client.cc
index b96ed37870244bedd7948120d031e4e851cbf176..59987d8dcfedf0d7782f6c65de5345ea457bf0af 100644
--- a/chrome/installer/setup/installer_crash_reporter_client.cc
+++ b/chrome/installer/setup/installer_crash_reporter_client.cc
@@ -5,18 +5,77 @@
#include "chrome/installer/setup/installer_crash_reporter_client.h"
#include "base/debug/crash_logging.h"
+#include "base/debug/leak_annotations.h"
#include "base/environment.h"
#include "base/file_version_info.h"
+#include "base/logging.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_version.h"
#include "chrome/common/env_vars.h"
-#include "chrome/installer/setup/installer_crash_reporting.h"
#include "chrome/installer/util/google_update_settings.h"
+#include "chrome/installer/util/installer_crash_reporting.h"
+#include "chrome/installer/util/installer_state.h"
+#include "components/crash/content/app/breakpad_win.h"
+#include "components/crash/content/app/crash_keys_win.h"
#include "components/crash/core/common/crash_keys.h"
+namespace {
+
+#if defined(COMPONENT_BUILD)
+// Installed via base::debug::SetCrashKeyReportingFunctions.
+void SetCrashKeyValue(const base::StringPiece& key,
+ const base::StringPiece& value) {
+ DCHECK(breakpad::CrashKeysWin::keeper());
+ breakpad::CrashKeysWin::keeper()->SetCrashKeyValue(base::UTF8ToUTF16(key),
+ base::UTF8ToUTF16(value));
+}
+
+// Installed via base::debug::SetCrashKeyReportingFunctions.
+void ClearCrashKey(const base::StringPiece& key) {
+ DCHECK(breakpad::CrashKeysWin::keeper());
+ breakpad::CrashKeysWin::keeper()->ClearCrashKeyValue(base::UTF8ToUTF16(key));
+}
+#endif // COMPONENT_BUILD
+
+} // namespace
+
+void InstallerCrashReporterClient::Configure(
+ const installer::InstallerState& installer_state) {
+ // This is inspired by work done in various parts of Chrome startup to connect
+ // to the crash service. Since the installer does not split its work between
+ // a stub .exe and a main .dll, crash reporting can be configured in one place
+ // right here.
+
+ // Create the crash client and install it (a la MainDllLoader::Launch).
+ InstallerCrashReporterClient *crash_client =
+ new InstallerCrashReporterClient(!installer_state.system_install());
+ ANNOTATE_LEAKING_OBJECT_PTR(crash_client);
+ crash_reporter::SetCrashReporterClient(crash_client);
+
+ breakpad::InitCrashReporter("Chrome Installer");
+
+ // Set up crash keys and the client id (a la child_process_logging::Init()).
+#if defined(COMPONENT_BUILD)
+ // breakpad::InitCrashReporter takes care of this for static builds but not
+ // component builds due to intricacies of chrome.exe and chrome.dll sharing a
+ // copy of base.dll in that case (for details, see the comment in
+ // components/crash/content/app/breakpad_win.cc).
+ crash_client->RegisterCrashKeys();
+ base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValue, &ClearCrashKey);
+#endif // COMPONENT_BUILD
+
+ scoped_ptr<metrics::ClientInfo> client_info =
+ GoogleUpdateSettings::LoadMetricsClientInfo();
+ if (client_info)
+ crash_client->SetCrashReporterClientIdFromGUID(client_info->client_id);
+ // TODO(grt): A lack of a client_id at this point generally means that Chrome
+ // has yet to have been launched and picked one. Consider creating it and
+ // setting it here for Chrome to use.
+}
+
InstallerCrashReporterClient::InstallerCrashReporterClient(
bool is_per_user_install)
: is_per_user_install_(is_per_user_install) {
« no previous file with comments | « chrome/installer/setup/installer_crash_reporter_client.h ('k') | chrome/installer/setup/installer_crash_reporting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698