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

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

Issue 1481933002: Move crash keys for command-line switches to components/crash so they can be set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@installer_crash_keys
Patch Set: Get rid of default argument 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
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/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
8 #include "base/debug/leak_annotations.h" 9 #include "base/debug/leak_annotations.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/installer/setup/installer_crash_reporter_client.h" 13 #include "chrome/installer/setup/installer_crash_reporter_client.h"
13 #include "chrome/installer/util/google_update_settings.h" 14 #include "chrome/installer/util/google_update_settings.h"
14 #include "chrome/installer/util/installer_state.h" 15 #include "chrome/installer/util/installer_state.h"
15 #include "components/crash/content/app/breakpad_win.h" 16 #include "components/crash/content/app/breakpad_win.h"
16 #include "components/crash/content/app/crash_keys_win.h" 17 #include "components/crash/content/app/crash_keys_win.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 { kIsMultiInstall, crash_keys::kSmallSize }, 121 { kIsMultiInstall, crash_keys::kSmallSize },
121 { kIsSystemLevel, crash_keys::kSmallSize }, 122 { kIsSystemLevel, crash_keys::kSmallSize },
122 { kOperation, crash_keys::kSmallSize }, 123 { kOperation, crash_keys::kSmallSize },
123 124
124 // This is a Windows registry key, which maxes out at 255 chars. 125 // This is a Windows registry key, which maxes out at 255 chars.
125 // (kMediumSize actually maxes out at 252 chars on Windows, but potentially 126 // (kMediumSize actually maxes out at 252 chars on Windows, but potentially
126 // truncating such a small amount is a fair tradeoff compared to using 127 // truncating such a small amount is a fair tradeoff compared to using
127 // kLargeSize, which is wasteful.) 128 // kLargeSize, which is wasteful.)
128 { kStateKey, crash_keys::kMediumSize }, 129 { kStateKey, crash_keys::kMediumSize },
129 }; 130 };
130 return base::debug::InitCrashKeys(&kFixedKeys[0], arraysize(kFixedKeys), 131 std::vector<base::debug::CrashKey> keys(std::begin(kFixedKeys),
grt (UTC plus 2) 2015/11/28 02:04:30 #include <iterator> for std::begin and std::end #i
Joe Mason 2015/11/30 17:23:55 Done.
132 std::end(kFixedKeys));
133 crash_keys::GetCrashKeysForCommandLineSwitches(&keys);
134 return base::debug::InitCrashKeys(keys.data(), keys.size(),
131 crash_keys::kChunkMaxLength); 135 crash_keys::kChunkMaxLength);
132 } 136 }
133 137
134 void SetInitialCrashKeys(const InstallerState& state) { 138 void SetInitialCrashKeys(const InstallerState& state) {
135 using base::debug::SetCrashKeyValue; 139 using base::debug::SetCrashKeyValue;
136 140
137 SetCrashKeyValue(kDistributionType, 141 SetCrashKeyValue(kDistributionType,
138 DistributionTypeToString(state.state_type())); 142 DistributionTypeToString(state.state_type()));
139 SetCrashKeyValue(kOperation, OperationToString(state.operation())); 143 SetCrashKeyValue(kOperation, OperationToString(state.operation()));
140 SetCrashKeyValue(kIsMultiInstall, 144 SetCrashKeyValue(kIsMultiInstall,
141 state.is_multi_install() ? "true" : "false"); 145 state.is_multi_install() ? "true" : "false");
142 SetCrashKeyValue(kIsSystemLevel, state.system_install() ? "true" : "false"); 146 SetCrashKeyValue(kIsSystemLevel, state.system_install() ? "true" : "false");
143 147
144 const base::string16 state_key = state.state_key(); 148 const base::string16 state_key = state.state_key();
145 if (!state_key.empty()) 149 if (!state_key.empty())
146 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key)); 150 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key));
147 } 151 }
148 152
153 void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) {
154 crash_keys::SetSwitchesFromCommandLine(command_line, nullptr);
155 }
156
149 } // namespace installer 157 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698