| Index: components/metrics/metrics_state_manager.cc
|
| diff --git a/components/metrics/metrics_state_manager.cc b/components/metrics/metrics_state_manager.cc
|
| index 4cae20d3ae7be6df2815d0367e2e16d5998d86ba..83d62b5f4f8bb701d04dda2d9fce792bb462494c 100644
|
| --- a/components/metrics/metrics_state_manager.cc
|
| +++ b/components/metrics/metrics_state_manager.cc
|
| @@ -92,16 +92,10 @@ void MetricsStateManager::ForceClientIdCreation() {
|
| client_id_.swap(client_id_from_prefs);
|
| }
|
|
|
| - if (!client_id_.empty()) {
|
| - // It is technically sufficient to only save a backup of the client id when
|
| - // it is initially generated below, but since the backup was only introduced
|
| - // in M38, seed it explicitly from here for some time.
|
| - BackUpCurrentClientInfo();
|
| + if (!client_id_.empty())
|
| return;
|
| - }
|
|
|
| - const std::unique_ptr<ClientInfo> client_info_backup =
|
| - LoadClientInfoAndMaybeMigrate();
|
| + const std::unique_ptr<ClientInfo> client_info_backup = LoadClientInfo();
|
| if (client_info_backup) {
|
| client_id_ = client_info_backup->client_id;
|
|
|
| @@ -233,36 +227,12 @@ void MetricsStateManager::BackUpCurrentClientInfo() {
|
| store_client_info_.Run(client_info);
|
| }
|
|
|
| -std::unique_ptr<ClientInfo>
|
| -MetricsStateManager::LoadClientInfoAndMaybeMigrate() {
|
| +std::unique_ptr<ClientInfo> MetricsStateManager::LoadClientInfo() {
|
| std::unique_ptr<ClientInfo> client_info = load_client_info_.Run();
|
|
|
| - // Prior to 2014-07, the client ID was stripped of its dashes before being
|
| - // saved. Migrate back to a proper GUID if this is the case. This migration
|
| - // code can be removed in M41+.
|
| - const size_t kGUIDLengthWithoutDashes = 32U;
|
| - if (client_info &&
|
| - client_info->client_id.length() == kGUIDLengthWithoutDashes) {
|
| - DCHECK(client_info->client_id.find('-') == std::string::npos);
|
| -
|
| - std::string client_id_with_dashes;
|
| - client_id_with_dashes.reserve(kGUIDLengthWithoutDashes + 4U);
|
| - std::string::const_iterator client_id_it = client_info->client_id.begin();
|
| - for (size_t i = 0; i < kGUIDLengthWithoutDashes + 4U; ++i) {
|
| - if (i == 8U || i == 13U || i == 18U || i == 23U) {
|
| - client_id_with_dashes.push_back('-');
|
| - } else {
|
| - client_id_with_dashes.push_back(*client_id_it);
|
| - ++client_id_it;
|
| - }
|
| - }
|
| - DCHECK(client_id_it == client_info->client_id.end());
|
| - client_info->client_id.assign(client_id_with_dashes);
|
| - }
|
| -
|
| - // The GUID retrieved (and possibly fixed above) should be valid unless
|
| - // retrieval failed. If not, return nullptr. This will result in a new GUID
|
| - // being generated by the calling function ForceClientIdCreation().
|
| + // The GUID retrieved should be valid unless retrieval failed.
|
| + // If not, return nullptr. This will result in a new GUID being generated by
|
| + // the calling function ForceClientIdCreation().
|
| if (client_info && !base::IsValidGUID(client_info->client_id))
|
| return nullptr;
|
|
|
|
|