| OLD | NEW |
| 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 "components/crash/core/common/crash_keys.h" | 5 #include "components/crash/core/common/crash_keys.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // the application is running. | 86 // the application is running. |
| 87 base::debug::ClearCrashKey(kMetricsClientId); | 87 base::debug::ClearCrashKey(kMetricsClientId); |
| 88 #endif | 88 #endif |
| 89 } | 89 } |
| 90 | 90 |
| 91 void SetVariationsList(const std::vector<std::string>& variations) { | 91 void SetVariationsList(const std::vector<std::string>& variations) { |
| 92 base::debug::SetCrashKeyValue(kNumVariations, | 92 base::debug::SetCrashKeyValue(kNumVariations, |
| 93 base::StringPrintf("%" PRIuS, variations.size())); | 93 base::StringPrintf("%" PRIuS, variations.size())); |
| 94 | 94 |
| 95 std::string variations_string; | 95 std::string variations_string; |
| 96 variations_string.reserve(kLargeSize); | 96 variations_string.reserve(kHugeSize); |
| 97 | 97 |
| 98 for (size_t i = 0; i < variations.size(); ++i) { | 98 for (size_t i = 0; i < variations.size(); ++i) { |
| 99 const std::string& variation = variations[i]; | 99 const std::string& variation = variations[i]; |
| 100 // Do not truncate an individual experiment. | 100 // Do not truncate an individual experiment. |
| 101 if (variations_string.size() + variation.size() >= kLargeSize) | 101 if (variations_string.size() + variation.size() >= kHugeSize) |
| 102 break; | 102 break; |
| 103 variations_string += variation; | 103 variations_string += variation; |
| 104 variations_string += ","; | 104 variations_string += ","; |
| 105 } | 105 } |
| 106 | 106 |
| 107 base::debug::SetCrashKeyValue(kVariations, variations_string); | 107 base::debug::SetCrashKeyValue(kVariations, variations_string); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void GetCrashKeysForCommandLineSwitches( | 110 void GetCrashKeysForCommandLineSwitches( |
| 111 std::vector<base::debug::CrashKey>* keys) { | 111 std::vector<base::debug::CrashKey>* keys) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 std::string key = base::StringPrintf(kSwitchFormat, key_i++); | 161 std::string key = base::StringPrintf(kSwitchFormat, key_i++); |
| 162 base::debug::SetCrashKeyValue(key, switch_str); | 162 base::debug::SetCrashKeyValue(key, switch_str); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // Clear any remaining switches. | 165 // Clear any remaining switches. |
| 166 for (; key_i <= kSwitchesMaxCount; ++key_i) | 166 for (; key_i <= kSwitchesMaxCount; ++key_i) |
| 167 base::debug::ClearCrashKey(base::StringPrintf(kSwitchFormat, key_i)); | 167 base::debug::ClearCrashKey(base::StringPrintf(kSwitchFormat, key_i)); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace crash_keys | 170 } // namespace crash_keys |
| OLD | NEW |