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

Unified Diff: chrome/common/crash_keys.cc

Issue 1298743002: Partially componentize chrome/common/crash_keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on iOS Created 5 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/crash_keys.cc
diff --git a/chrome/common/crash_keys.cc b/chrome/common/crash_keys.cc
index 2934d97886c9de3fa9df75fa6307bb78b852d92d..ddf5c316195417a63ea8ff959f333bee6b2c87fa 100644
--- a/chrome/common/crash_keys.cc
+++ b/chrome/common/crash_keys.cc
@@ -27,17 +27,6 @@
namespace crash_keys {
-// A small crash key, guaranteed to never be split into multiple pieces.
-const size_t kSmallSize = 63;
-
-// A medium crash key, which will be chunked on certain platforms but not
-// others. Guaranteed to never be more than four chunks.
-const size_t kMediumSize = kSmallSize * 4;
-
-// A large crash key, which will be chunked on all platforms. This should be
-// used sparingly.
-const size_t kLargeSize = kSmallSize * 16;
-
// The maximum lengths specified by breakpad include the trailing NULL, so
// the actual length of the string is one less.
#if defined(OS_MACOSX)
@@ -58,16 +47,6 @@ static_assert(kMediumSize <= kSingleChunkLength,
"mac has medium size crash key chunks");
#endif
-#if defined(OS_MACOSX)
-// Crashpad owns the "guid" key. Chrome's metrics client ID is a separate ID
-// carried in a distinct "metrics_client_id" field.
-const char kMetricsClientId[] = "metrics_client_id";
-#else
-const char kClientId[] = "guid";
-#endif
-
-const char kChannel[] = "channel";
-
const char kActiveURL[] = "url-chunk";
const char kFontKeyName[] = "font_key_name";
@@ -75,9 +54,6 @@ const char kFontKeyName[] = "font_key_name";
const char kSwitch[] = "switch-%" PRIuS;
const char kNumSwitches[] = "num-switches";
-const char kNumVariations[] = "num-experiments";
-const char kVariations[] = "variations";
-
const char kExtensionID[] = "extension-%" PRIuS;
const char kNumExtensionsCount[] = "num-extensions";
@@ -117,9 +93,6 @@ const char kNSExceptionTrace[] = "nsexception_bt";
const char kSendAction[] = "sendaction";
-const char kZombie[] = "zombie";
-const char kZombieTrace[] = "zombie_dealloc_bt";
-
} // namespace mac
#endif
@@ -257,43 +230,6 @@ size_t RegisterChromeCrashKeys() {
kSingleChunkLength);
}
-void SetMetricsClientIdFromGUID(const std::string& metrics_client_guid) {
- std::string stripped_guid(metrics_client_guid);
- // Remove all instance of '-' char from the GUID. So BCD-WXY becomes BCDWXY.
- base::ReplaceSubstringsAfterOffset(
- &stripped_guid, 0, "-", base::StringPiece());
- if (stripped_guid.empty())
- return;
-
-#if defined(OS_MACOSX)
- // The crash client ID is maintained by Crashpad and is distinct from the
- // metrics client ID, which is carried in its own key.
- base::debug::SetCrashKeyValue(kMetricsClientId, stripped_guid);
-#else
- // The crash client ID is set by the application when Breakpad is in use.
- // The same ID as the metrics client ID is used.
- base::debug::SetCrashKeyValue(kClientId, stripped_guid);
-#endif
-}
-
-void ClearMetricsClientId() {
-#if defined(OS_MACOSX)
- // Crashpad always monitors for crashes, but doesn't upload them when
- // crash reporting is disabled. The preference to upload crash reports is
- // linked to the preference for metrics reporting. When metrics reporting is
- // disabled, don't put the metrics client ID into crash dumps. This way, crash
- // reports that are saved but not uploaded will not have a metrics client ID
- // from the time that metrics reporting was disabled even if they are uploaded
- // by user action at a later date.
- //
- // Breakpad cannot be enabled or disabled without an application restart, and
- // it needs to use the metrics client ID as its stable crash client ID, so
- // leave its client ID intact even when metrics reporting is disabled while
- // the application is running.
- base::debug::ClearCrashKey(kMetricsClientId);
-#endif
-}
-
static bool IsBoringSwitch(const std::string& flag) {
static const char* const kIgnoreSwitches[] = {
switches::kEnableLogging,
@@ -397,25 +333,6 @@ void SetSwitchesFromCommandLine(const base::CommandLine* command_line) {
}
}
-void SetVariationsList(const std::vector<std::string>& variations) {
- base::debug::SetCrashKeyValue(kNumVariations,
- base::StringPrintf("%" PRIuS, variations.size()));
-
- std::string variations_string;
- variations_string.reserve(kLargeSize);
-
- for (size_t i = 0; i < variations.size(); ++i) {
- const std::string& variation = variations[i];
- // Do not truncate an individual experiment.
- if (variations_string.size() + variation.size() >= kLargeSize)
- break;
- variations_string += variation;
- variations_string += ",";
- }
-
- base::debug::SetCrashKeyValue(kVariations, variations_string);
-}
-
void SetActiveExtensions(const std::set<std::string>& extensions) {
base::debug::SetCrashKeyValue(kNumExtensionsCount,
base::StringPrintf("%" PRIuS, extensions.size()));

Powered by Google App Engine
This is Rietveld 408576698