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

Side by Side Diff: chrome/installer/setup/installer_crash_reporting.cc

Issue 1478273003: Add an installer crash key for the currently installed version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@installer_crash_keys_cmdline
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « chrome/installer/setup/installer_crash_reporting.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/installer/setup/installer_crash_reporting.h" 5 #include "chrome/installer/setup/installer_crash_reporting.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/leak_annotations.h" 8 #include "base/debug/leak_annotations.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/version.h"
11 #include "chrome/installer/setup/installer_crash_reporter_client.h" 12 #include "chrome/installer/setup/installer_crash_reporter_client.h"
12 #include "chrome/installer/util/google_update_settings.h" 13 #include "chrome/installer/util/google_update_settings.h"
14 #include "chrome/installer/util/installation_state.h"
grt (UTC plus 2) 2015/11/27 19:04:24 nit: unused
13 #include "chrome/installer/util/installer_state.h" 15 #include "chrome/installer/util/installer_state.h"
14 #include "components/crash/content/app/breakpad_win.h" 16 #include "components/crash/content/app/breakpad_win.h"
15 #include "components/crash/content/app/crash_keys_win.h" 17 #include "components/crash/content/app/crash_keys_win.h"
16 #include "components/crash/core/common/crash_keys.h" 18 #include "components/crash/core/common/crash_keys.h"
17 19
18 namespace installer { 20 namespace installer {
19 21
20 namespace { 22 namespace {
21 23
22 // Crash Keys 24 // Crash Keys
23 25
26 const char kCurrentVersion[] = "current-version";
24 const char kDistributionType[] = "dist-type"; 27 const char kDistributionType[] = "dist-type";
25 const char kIsMultiInstall[] = "multi-install"; 28 const char kIsMultiInstall[] = "multi-install";
26 const char kIsSystemLevel[] = "system-level"; 29 const char kIsSystemLevel[] = "system-level";
27 const char kOperation[] = "operation"; 30 const char kOperation[] = "operation";
28 const char kStateKey[] = "state-key"; 31 const char kStateKey[] = "state-key";
29 32
30 #if defined(COMPONENT_BUILD) 33 #if defined(COMPONENT_BUILD)
31 // Installed via base::debug::SetCrashKeyReportingFunctions. 34 // Installed via base::debug::SetCrashKeyReportingFunctions.
32 void SetCrashKeyValue(const base::StringPiece& key, 35 void SetCrashKeyValue(const base::StringPiece& key,
33 const base::StringPiece& value) { 36 const base::StringPiece& value) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (client_info) 111 if (client_info)
109 crash_client->SetCrashReporterClientIdFromGUID(client_info->client_id); 112 crash_client->SetCrashReporterClientIdFromGUID(client_info->client_id);
110 // TODO(grt): A lack of a client_id at this point generally means that Chrome 113 // TODO(grt): A lack of a client_id at this point generally means that Chrome
111 // has yet to have been launched and picked one. Consider creating it and 114 // has yet to have been launched and picked one. Consider creating it and
112 // setting it here for Chrome to use. 115 // setting it here for Chrome to use.
113 } 116 }
114 117
115 size_t RegisterCrashKeys() { 118 size_t RegisterCrashKeys() {
116 const base::debug::CrashKey kFixedKeys[] = { 119 const base::debug::CrashKey kFixedKeys[] = {
117 { crash_keys::kClientId, crash_keys::kSmallSize }, 120 { crash_keys::kClientId, crash_keys::kSmallSize },
121 { kCurrentVersion, crash_keys::kSmallSize },
118 { kDistributionType, crash_keys::kSmallSize }, 122 { kDistributionType, crash_keys::kSmallSize },
119 { kIsMultiInstall, crash_keys::kSmallSize }, 123 { kIsMultiInstall, crash_keys::kSmallSize },
120 { kIsSystemLevel, crash_keys::kSmallSize }, 124 { kIsSystemLevel, crash_keys::kSmallSize },
121 { kOperation, crash_keys::kSmallSize }, 125 { kOperation, crash_keys::kSmallSize },
122 126
123 // This is a Windows registry key, which maxes out at 255 chars. 127 // This is a Windows registry key, which maxes out at 255 chars.
124 // (kMediumSize actually maxes out at 252 chars on Windows, but potentially 128 // (kMediumSize actually maxes out at 252 chars on Windows, but potentially
125 // truncating such a small amount is a fair tradeoff compared to using 129 // truncating such a small amount is a fair tradeoff compared to using
126 // kLargeSize, which is wasteful.) 130 // kLargeSize, which is wasteful.)
127 { kStateKey, crash_keys::kMediumSize }, 131 { kStateKey, crash_keys::kMediumSize },
(...skipping 17 matching lines...) Expand all
145 149
146 const std::wstring state_key = state.state_key(); 150 const std::wstring state_key = state.state_key();
147 if (!state_key.empty()) 151 if (!state_key.empty())
148 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key)); 152 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key));
149 } 153 }
150 154
151 void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { 155 void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) {
152 crash_keys::SetSwitchesFromCommandLine(command_line); 156 crash_keys::SetSwitchesFromCommandLine(command_line);
153 } 157 }
154 158
159 void SetCurrentVersionCrashKey(const base::Version* current_version) {
160 if (current_version) {
161 base::debug::SetCrashKeyValue(kCurrentVersion,
162 current_version->GetString());
163 } else {
164 base::debug::ClearCrashKey(kCurrentVersion);
165 }
166 }
167
155 } // namespace installer 168 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/installer_crash_reporting.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698