| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 | 255 |
| 256 return base::debug::InitCrashKeys(&keys.at(0), keys.size(), | 256 return base::debug::InitCrashKeys(&keys.at(0), keys.size(), |
| 257 kSingleChunkLength); | 257 kSingleChunkLength); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void SetMetricsClientIdFromGUID(const std::string& metrics_client_guid) { | 260 void SetMetricsClientIdFromGUID(const std::string& metrics_client_guid) { |
| 261 std::string stripped_guid(metrics_client_guid); | 261 std::string stripped_guid(metrics_client_guid); |
| 262 // Remove all instance of '-' char from the GUID. So BCD-WXY becomes BCDWXY. | 262 // Remove all instance of '-' char from the GUID. So BCD-WXY becomes BCDWXY. |
| 263 ReplaceSubstringsAfterOffset(&stripped_guid, 0, "-", ""); | 263 base::ReplaceSubstringsAfterOffset( |
| 264 &stripped_guid, 0, "-", base::StringPiece()); |
| 264 if (stripped_guid.empty()) | 265 if (stripped_guid.empty()) |
| 265 return; | 266 return; |
| 266 | 267 |
| 267 #if defined(OS_MACOSX) | 268 #if defined(OS_MACOSX) |
| 268 // The crash client ID is maintained by Crashpad and is distinct from the | 269 // The crash client ID is maintained by Crashpad and is distinct from the |
| 269 // metrics client ID, which is carried in its own key. | 270 // metrics client ID, which is carried in its own key. |
| 270 base::debug::SetCrashKeyValue(kMetricsClientId, stripped_guid); | 271 base::debug::SetCrashKeyValue(kMetricsClientId, stripped_guid); |
| 271 #else | 272 #else |
| 272 // The crash client ID is set by the application when Breakpad is in use. | 273 // The crash client ID is set by the application when Breakpad is in use. |
| 273 // The same ID as the metrics client ID is used. | 274 // The same ID as the metrics client ID is used. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 } | 446 } |
| 446 | 447 |
| 447 ScopedPrinterInfo::~ScopedPrinterInfo() { | 448 ScopedPrinterInfo::~ScopedPrinterInfo() { |
| 448 for (size_t i = 0; i < kPrinterInfoCount; ++i) { | 449 for (size_t i = 0; i < kPrinterInfoCount; ++i) { |
| 449 std::string key = base::StringPrintf(kPrinterInfo, i + 1); | 450 std::string key = base::StringPrintf(kPrinterInfo, i + 1); |
| 450 base::debug::ClearCrashKey(key); | 451 base::debug::ClearCrashKey(key); |
| 451 } | 452 } |
| 452 } | 453 } |
| 453 | 454 |
| 454 } // namespace crash_keys | 455 } // namespace crash_keys |
| OLD | NEW |