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

Unified Diff: chrome/installer/util/installer_crash_reporting.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
« no previous file with comments | « chrome/installer/util/installer_crash_reporting.h ('k') | chrome/installer/util/installer_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/installer_crash_reporting.cc
diff --git a/chrome/installer/setup/installer_crash_reporting.cc b/chrome/installer/util/installer_crash_reporting.cc
similarity index 58%
rename from chrome/installer/setup/installer_crash_reporting.cc
rename to chrome/installer/util/installer_crash_reporting.cc
index fcecd773a729cf49d90e06bd4ba7facb0d938854..e25d4af9cf1c43117ad8cee0bc3a0c9a0487b38f 100644
--- a/chrome/installer/setup/installer_crash_reporting.cc
+++ b/chrome/installer/util/installer_crash_reporting.cc
@@ -2,23 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/installer/setup/installer_crash_reporting.h"
+#include "chrome/installer/util/installer_crash_reporting.h"
#include <iterator>
#include <vector>
#include "base/command_line.h"
#include "base/debug/crash_logging.h"
-#include "base/debug/leak_annotations.h"
-#include "base/logging.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/version.h"
-#include "chrome/installer/setup/installer_crash_reporter_client.h"
-#include "chrome/installer/util/google_update_settings.h"
+#include "base/win/registry.h"
+#include "chrome/installer/util/google_update_constants.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 "chrome/installer/util/install_util.h"
#include "components/crash/core/common/crash_keys.h"
namespace installer {
@@ -27,28 +24,25 @@ namespace {
// Crash Keys
+const char kAP[] = "ap";
+const char kArchiveType[] = "archive-type";
const char kCurrentVersion[] = "current-version";
const char kDistributionType[] = "dist-type";
const char kIsMultiInstall[] = "multi-install";
const char kIsSystemLevel[] = "system-level";
const char kOperation[] = "operation";
+const char kStage[] = "stage";
const char kStateKey[] = "state-key";
-#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));
+const char *ArchiveTypeToString(ArchiveType archive_type) {
+ switch (archive_type) {
+ case ArchiveType::UNKNOWN_ARCHIVE_TYPE: return "unknown";
+ case ArchiveType::FULL_ARCHIVE_TYPE: return "full";
+ case ArchiveType::INCREMENTAL_ARCHIVE_TYPE: return "incremental";
+ }
+ NOTREACHED();
+ return "";
}
-#endif // COMPONENT_BUILD
const char *DistributionTypeToString(BrowserDistribution::Type type) {
switch (type) {
@@ -86,47 +80,17 @@ const char *OperationToString(InstallerState::Operation operation) {
} // namespace
-void ConfigureCrashReporting(const 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.
-}
-
size_t RegisterCrashKeys() {
const base::debug::CrashKey kFixedKeys[] = {
{ crash_keys::kClientId, crash_keys::kSmallSize },
+ { kAP, crash_keys::kSmallSize },
+ { kArchiveType, crash_keys::kSmallSize },
{ kCurrentVersion, crash_keys::kSmallSize },
{ kDistributionType, crash_keys::kSmallSize },
{ kIsMultiInstall, crash_keys::kSmallSize },
{ kIsSystemLevel, crash_keys::kSmallSize },
{ kOperation, crash_keys::kSmallSize },
+ { kStage, crash_keys::kSmallSize },
// This is a Windows registry key, which maxes out at 255 chars.
// (kMediumSize actually maxes out at 252 chars on Windows, but potentially
@@ -152,8 +116,17 @@ void SetInitialCrashKeys(const InstallerState& state) {
SetCrashKeyValue(kIsSystemLevel, state.system_install() ? "true" : "false");
const base::string16 state_key = state.state_key();
- if (!state_key.empty())
+ if (!state_key.empty()) {
SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key));
+
+ base::win::RegKey key;
+ if (key.Open(state.root_key(), state_key.c_str(),
+ KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) {
+ base::string16 ap_value;
+ if (key.ReadValue(google_update::kRegApField, &ap_value) == ERROR_SUCCESS)
+ SetCrashKeyValue(kAP, base::UTF16ToUTF8(ap_value));
+ }
+ }
}
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) {
@@ -169,4 +142,14 @@ void SetCurrentVersionCrashKey(const base::Version* current_version) {
}
}
+void SetStageCrashKey(InstallerStage stage) {
+ base::debug::SetCrashKeyValue(kStage,
+ base::UTF16ToUTF8(InstallUtil::StageToString(stage)));
+}
+
+void SetArchiveTypeCrashKey(ArchiveType archive_type) {
+ base::debug::SetCrashKeyValue(kArchiveType,
+ ArchiveTypeToString(archive_type));
+}
+
} // namespace installer
« no previous file with comments | « chrome/installer/util/installer_crash_reporting.h ('k') | chrome/installer/util/installer_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698