diff options
author | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-09 18:53:22 +0000 |
---|---|---|
committer | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-09 18:53:22 +0000 |
commit | 9d1b0158bcf46195412d15b9d1be9d479caab740 (patch) | |
tree | 76bf98efe1a3981e300f1ce02b499ee7113839d9 /chrome/common/crash_keys.cc | |
parent | b8da79f3624019a2bcd3916fc573f5f861840fb5 (diff) | |
download | chromium_src-9d1b0158bcf46195412d15b9d1be9d479caab740.zip chromium_src-9d1b0158bcf46195412d15b9d1be9d479caab740.tar.gz chromium_src-9d1b0158bcf46195412d15b9d1be9d479caab740.tar.bz2 |
Refactor SetClientID such that metrics rather than crash backs up the client id
in Google Update settings.
Consequentially, the backed up client_id now keeps its dashes and crash_keys
strips them at runtime rather than when backing it up
(https://codereview.chromium.org/372473004/ will add support for stripped
client_id backups for some time).
Also rename a lot of methods involved in setting the client id; having all of
them named "SetClientID" makes this series of calls very hard to follow!
BUG=391338
TBR=thestig
Review URL: https://codereview.chromium.org/365133005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/crash_keys.cc')
-rw-r--r-- | chrome/common/crash_keys.cc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/chrome/common/crash_keys.cc b/chrome/common/crash_keys.cc index edb6cac..84a83ef 100644 --- a/chrome/common/crash_keys.cc +++ b/chrome/common/crash_keys.cc @@ -11,7 +11,6 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/installer/util/google_update_settings.h" #if defined(OS_MACOSX) #include "breakpad/src/common/simple_string_dictionary.h" @@ -56,7 +55,7 @@ COMPILE_ASSERT(kMediumSize <= kSingleChunkLength, mac_has_medium_size_crash_key_chunks); #endif -const char kClientID[] = "guid"; +const char kClientId[] = "guid"; const char kChannel[] = "channel"; @@ -119,7 +118,7 @@ size_t RegisterChromeCrashKeys() { // The following keys may be chunked by the underlying crash logging system, // but ultimately constitute a single key-value pair. base::debug::CrashKey fixed_keys[] = { - { kClientID, kSmallSize }, + { kClientId, kSmallSize }, { kChannel, kSmallSize }, { kActiveURL, kLargeSize }, { kNumSwitches, kSmallSize }, @@ -225,15 +224,14 @@ size_t RegisterChromeCrashKeys() { kSingleChunkLength); } -void SetClientID(const std::string& client_id) { - std::string guid(client_id); +void SetCrashClientIdFromGUID(const std::string& client_guid) { + std::string stripped_guid(client_guid); // Remove all instance of '-' char from the GUID. So BCD-WXY becomes BCDWXY. - ReplaceSubstringsAfterOffset(&guid, 0, "-", ""); - if (guid.empty()) + ReplaceSubstringsAfterOffset(&stripped_guid, 0, "-", ""); + if (stripped_guid.empty()) return; - base::debug::SetCrashKeyValue(kClientID, guid); - GoogleUpdateSettings::SetMetricsId(guid); + base::debug::SetCrashKeyValue(kClientId, stripped_guid); } static bool IsBoringSwitch(const std::string& flag) { |