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

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: Rebase 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 <iterator> 7 #include <iterator>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/crash_logging.h" 11 #include "base/debug/crash_logging.h"
12 #include "base/debug/leak_annotations.h" 12 #include "base/debug/leak_annotations.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/version.h"
16 #include "chrome/installer/setup/installer_crash_reporter_client.h" 17 #include "chrome/installer/setup/installer_crash_reporter_client.h"
17 #include "chrome/installer/util/google_update_settings.h" 18 #include "chrome/installer/util/google_update_settings.h"
18 #include "chrome/installer/util/installer_state.h" 19 #include "chrome/installer/util/installer_state.h"
19 #include "components/crash/content/app/breakpad_win.h" 20 #include "components/crash/content/app/breakpad_win.h"
20 #include "components/crash/content/app/crash_keys_win.h" 21 #include "components/crash/content/app/crash_keys_win.h"
21 #include "components/crash/core/common/crash_keys.h" 22 #include "components/crash/core/common/crash_keys.h"
22 23
23 namespace installer { 24 namespace installer {
24 25
25 namespace { 26 namespace {
26 27
27 // Crash Keys 28 // Crash Keys
28 29
30 const char kCurrentVersion[] = "current-version";
29 const char kDistributionType[] = "dist-type"; 31 const char kDistributionType[] = "dist-type";
30 const char kIsMultiInstall[] = "multi-install"; 32 const char kIsMultiInstall[] = "multi-install";
31 const char kIsSystemLevel[] = "system-level"; 33 const char kIsSystemLevel[] = "system-level";
32 const char kOperation[] = "operation"; 34 const char kOperation[] = "operation";
33 const char kStateKey[] = "state-key"; 35 const char kStateKey[] = "state-key";
34 36
35 #if defined(COMPONENT_BUILD) 37 #if defined(COMPONENT_BUILD)
36 // Installed via base::debug::SetCrashKeyReportingFunctions. 38 // Installed via base::debug::SetCrashKeyReportingFunctions.
37 void SetCrashKeyValue(const base::StringPiece& key, 39 void SetCrashKeyValue(const base::StringPiece& key,
38 const base::StringPiece& value) { 40 const base::StringPiece& value) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (client_info) 115 if (client_info)
114 crash_client->SetCrashReporterClientIdFromGUID(client_info->client_id); 116 crash_client->SetCrashReporterClientIdFromGUID(client_info->client_id);
115 // TODO(grt): A lack of a client_id at this point generally means that Chrome 117 // TODO(grt): A lack of a client_id at this point generally means that Chrome
116 // has yet to have been launched and picked one. Consider creating it and 118 // has yet to have been launched and picked one. Consider creating it and
117 // setting it here for Chrome to use. 119 // setting it here for Chrome to use.
118 } 120 }
119 121
120 size_t RegisterCrashKeys() { 122 size_t RegisterCrashKeys() {
121 const base::debug::CrashKey kFixedKeys[] = { 123 const base::debug::CrashKey kFixedKeys[] = {
122 { crash_keys::kClientId, crash_keys::kSmallSize }, 124 { crash_keys::kClientId, crash_keys::kSmallSize },
125 { kCurrentVersion, crash_keys::kSmallSize },
123 { kDistributionType, crash_keys::kSmallSize }, 126 { kDistributionType, crash_keys::kSmallSize },
124 { kIsMultiInstall, crash_keys::kSmallSize }, 127 { kIsMultiInstall, crash_keys::kSmallSize },
125 { kIsSystemLevel, crash_keys::kSmallSize }, 128 { kIsSystemLevel, crash_keys::kSmallSize },
126 { kOperation, crash_keys::kSmallSize }, 129 { kOperation, crash_keys::kSmallSize },
127 130
128 // This is a Windows registry key, which maxes out at 255 chars. 131 // This is a Windows registry key, which maxes out at 255 chars.
129 // (kMediumSize actually maxes out at 252 chars on Windows, but potentially 132 // (kMediumSize actually maxes out at 252 chars on Windows, but potentially
130 // truncating such a small amount is a fair tradeoff compared to using 133 // truncating such a small amount is a fair tradeoff compared to using
131 // kLargeSize, which is wasteful.) 134 // kLargeSize, which is wasteful.)
132 { kStateKey, crash_keys::kMediumSize }, 135 { kStateKey, crash_keys::kMediumSize },
(...skipping 17 matching lines...) Expand all
150 153
151 const base::string16 state_key = state.state_key(); 154 const base::string16 state_key = state.state_key();
152 if (!state_key.empty()) 155 if (!state_key.empty())
153 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key)); 156 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key));
154 } 157 }
155 158
156 void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { 159 void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) {
157 crash_keys::SetSwitchesFromCommandLine(command_line, nullptr); 160 crash_keys::SetSwitchesFromCommandLine(command_line, nullptr);
158 } 161 }
159 162
163 void SetCurrentVersionCrashKey(const base::Version* current_version) {
164 if (current_version) {
165 base::debug::SetCrashKeyValue(kCurrentVersion,
166 current_version->GetString());
167 } else {
168 base::debug::ClearCrashKey(kCurrentVersion);
169 }
170 }
171
160 } // namespace installer 172 } // 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