Chromium Code Reviews| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 const char kZombieTrace[] = "zombie_dealloc_bt"; | 121 const char kZombieTrace[] = "zombie_dealloc_bt"; |
| 122 | 122 |
| 123 } // namespace mac | 123 } // namespace mac |
| 124 #endif | 124 #endif |
| 125 | 125 |
| 126 #if defined(KASKO) | 126 #if defined(KASKO) |
| 127 const char kKaskoGuid[] = "kasko-guid"; | 127 const char kKaskoGuid[] = "kasko-guid"; |
| 128 const char kKaskoEquivalentGuid[] = "kasko-equivalent-guid"; | 128 const char kKaskoEquivalentGuid[] = "kasko-equivalent-guid"; |
| 129 #endif | 129 #endif |
| 130 | 130 |
| 131 const char kBug464926CrashKey[] = "bug-464926-info"; | |
| 132 | |
| 131 size_t RegisterChromeCrashKeys() { | 133 size_t RegisterChromeCrashKeys() { |
| 132 // The following keys may be chunked by the underlying crash logging system, | 134 // The following keys may be chunked by the underlying crash logging system, |
| 133 // but ultimately constitute a single key-value pair. | 135 // but ultimately constitute a single key-value pair. |
| 134 base::debug::CrashKey fixed_keys[] = { | 136 base::debug::CrashKey fixed_keys[] = { |
| 135 #if defined(OS_MACOSX) | 137 #if defined(OS_MACOSX) |
| 136 { kMetricsClientId, kSmallSize }, | 138 { kMetricsClientId, kSmallSize }, |
| 137 #else | 139 #else |
| 138 { kClientId, kSmallSize }, | 140 { kClientId, kSmallSize }, |
| 139 #endif | 141 #endif |
| 140 { kChannel, kSmallSize }, | 142 { kChannel, kSmallSize }, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 for (size_t i = 0; i < kPrinterInfoCount; ++i) { | 238 for (size_t i = 0; i < kPrinterInfoCount; ++i) { |
| 237 // Key names are 1-indexed. | 239 // Key names are 1-indexed. |
| 238 int n = base::snprintf( | 240 int n = base::snprintf( |
| 239 formatted_keys[i], formatted_key_len, kPrinterInfo, i + 1); | 241 formatted_keys[i], formatted_key_len, kPrinterInfo, i + 1); |
| 240 DCHECK_GT(n, 0); | 242 DCHECK_GT(n, 0); |
| 241 base::debug::CrashKey crash_key = { formatted_keys[i], kSmallSize }; | 243 base::debug::CrashKey crash_key = { formatted_keys[i], kSmallSize }; |
| 242 keys.push_back(crash_key); | 244 keys.push_back(crash_key); |
| 243 } | 245 } |
| 244 } | 246 } |
| 245 | 247 |
| 248 // Register a key to help investigate bug 464926. | |
|
Robert Sesek
2015/05/13 15:22:34
This should just go in the fixed_keys array.
Mark P
2015/05/13 17:50:14
Okay. Done.
In the future, you may want to revis
| |
| 249 { | |
| 250 base::debug::CrashKey crash_key = { kBug464926CrashKey, kSmallSize }; | |
| 251 keys.push_back(crash_key); | |
| 252 } | |
| 253 | |
| 246 return base::debug::InitCrashKeys(&keys.at(0), keys.size(), | 254 return base::debug::InitCrashKeys(&keys.at(0), keys.size(), |
| 247 kSingleChunkLength); | 255 kSingleChunkLength); |
| 248 } | 256 } |
| 249 | 257 |
| 250 void SetMetricsClientIdFromGUID(const std::string& metrics_client_guid) { | 258 void SetMetricsClientIdFromGUID(const std::string& metrics_client_guid) { |
| 251 std::string stripped_guid(metrics_client_guid); | 259 std::string stripped_guid(metrics_client_guid); |
| 252 // Remove all instance of '-' char from the GUID. So BCD-WXY becomes BCDWXY. | 260 // Remove all instance of '-' char from the GUID. So BCD-WXY becomes BCDWXY. |
| 253 ReplaceSubstringsAfterOffset(&stripped_guid, 0, "-", ""); | 261 ReplaceSubstringsAfterOffset(&stripped_guid, 0, "-", ""); |
| 254 if (stripped_guid.empty()) | 262 if (stripped_guid.empty()) |
| 255 return; | 263 return; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 } | 443 } |
| 436 | 444 |
| 437 ScopedPrinterInfo::~ScopedPrinterInfo() { | 445 ScopedPrinterInfo::~ScopedPrinterInfo() { |
| 438 for (size_t i = 0; i < kPrinterInfoCount; ++i) { | 446 for (size_t i = 0; i < kPrinterInfoCount; ++i) { |
| 439 std::string key = base::StringPrintf(kPrinterInfo, i + 1); | 447 std::string key = base::StringPrintf(kPrinterInfo, i + 1); |
| 440 base::debug::ClearCrashKey(key); | 448 base::debug::ClearCrashKey(key); |
| 441 } | 449 } |
| 442 } | 450 } |
| 443 | 451 |
| 444 } // namespace crash_keys | 452 } // namespace crash_keys |
| OLD | NEW |