OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/common/crash_keys.h" | 5 #include "chrome/common/crash_keys.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 #if defined(OS_WIN) | 273 #if defined(OS_WIN) |
274 std::string switch_str = base::WideToUTF8(argv[i]); | 274 std::string switch_str = base::WideToUTF8(argv[i]); |
275 #else | 275 #else |
276 std::string switch_str = argv[i]; | 276 std::string switch_str = argv[i]; |
277 #endif | 277 #endif |
278 | 278 |
279 // Skip uninteresting switches. | 279 // Skip uninteresting switches. |
280 if (IsBoringSwitch(switch_str)) | 280 if (IsBoringSwitch(switch_str)) |
281 continue; | 281 continue; |
282 | 282 |
| 283 // Stop if there are too many switches. |
| 284 if (i > crash_keys::kSwitchesMaxCount) |
| 285 break; |
| 286 |
283 std::string key = base::StringPrintf(kSwitch, key_i++); | 287 std::string key = base::StringPrintf(kSwitch, key_i++); |
284 base::debug::SetCrashKeyValue(key, switch_str); | 288 base::debug::SetCrashKeyValue(key, switch_str); |
285 } | 289 } |
286 | 290 |
287 // Clear any remaining switches. | 291 // Clear any remaining switches. |
288 for (; key_i <= kSwitchesMaxCount; ++key_i) { | 292 for (; key_i <= kSwitchesMaxCount; ++key_i) { |
289 base::debug::ClearCrashKey(base::StringPrintf(kSwitch, key_i)); | 293 base::debug::ClearCrashKey(base::StringPrintf(kSwitch, key_i)); |
290 } | 294 } |
291 } | 295 } |
292 | 296 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 } | 342 } |
339 | 343 |
340 ScopedPrinterInfo::~ScopedPrinterInfo() { | 344 ScopedPrinterInfo::~ScopedPrinterInfo() { |
341 for (size_t i = 0; i < kPrinterInfoCount; ++i) { | 345 for (size_t i = 0; i < kPrinterInfoCount; ++i) { |
342 std::string key = base::StringPrintf(kPrinterInfo, i + 1); | 346 std::string key = base::StringPrintf(kPrinterInfo, i + 1); |
343 base::debug::ClearCrashKey(key); | 347 base::debug::ClearCrashKey(key); |
344 } | 348 } |
345 } | 349 } |
346 | 350 |
347 } // namespace crash_keys | 351 } // namespace crash_keys |
OLD | NEW |