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

Side by Side Diff: chrome/browser/sync/invalidations/invalidator_storage.cc

Issue 10603007: Add UMA tracking for sync.max_invalidation_versions pref migration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: src.git changes are no fun Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/sync/invalidations/invalidator_storage.h" 5 #include "chrome/browser/sync/invalidations/invalidator_storage.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h"
9 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
10 #include "base/values.h" 11 #include "base/values.h"
11 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
13 #include "sync/internal_api/public/syncable/model_type.h" 14 #include "sync/internal_api/public/syncable/model_type.h"
14 15
15 using csync::InvalidationVersionMap; 16 using csync::InvalidationVersionMap;
16 17
17 namespace browser_sync { 18 namespace browser_sync {
18 19
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 const base::DictionaryValue* max_versions_dict = 154 const base::DictionaryValue* max_versions_dict =
154 pref_service_->GetDictionary(prefs::kSyncMaxInvalidationVersions); 155 pref_service_->GetDictionary(prefs::kSyncMaxInvalidationVersions);
155 CHECK(max_versions_dict); 156 CHECK(max_versions_dict);
156 if (!max_versions_dict->empty()) { 157 if (!max_versions_dict->empty()) {
157 InvalidationVersionMap max_versions; 158 InvalidationVersionMap max_versions;
158 DeserializeMap(max_versions_dict, &max_versions); 159 DeserializeMap(max_versions_dict, &max_versions);
159 base::ListValue max_versions_list; 160 base::ListValue max_versions_list;
160 SerializeToList(max_versions, &max_versions_list); 161 SerializeToList(max_versions, &max_versions_list);
161 pref_service_->Set(prefs::kInvalidatorMaxInvalidationVersions, 162 pref_service_->Set(prefs::kInvalidatorMaxInvalidationVersions,
162 max_versions_list); 163 max_versions_list);
164 UMA_HISTOGRAM_BOOLEAN("InvalidatorStorage.MigrateInvalidationVersionsPref",
165 true);
166 } else {
167 UMA_HISTOGRAM_BOOLEAN("InvalidatorStorage.MigrateInvalidationVersionsPref",
168 false);
163 } 169 }
164 pref_service_->ClearPref(prefs::kSyncMaxInvalidationVersions); 170 pref_service_->ClearPref(prefs::kSyncMaxInvalidationVersions);
165 } 171 }
166 172
167 // Legacy migration code. 173 // Legacy migration code.
168 // static 174 // static
169 void InvalidatorStorage::DeserializeMap( 175 void InvalidatorStorage::DeserializeMap(
170 const base::DictionaryValue* max_versions_dict, 176 const base::DictionaryValue* max_versions_dict,
171 InvalidationVersionMap* map) { 177 InvalidationVersionMap* map) {
172 map->clear(); 178 map->clear();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 utf8_state); 227 utf8_state);
222 } 228 }
223 229
224 void InvalidatorStorage::Clear() { 230 void InvalidatorStorage::Clear() {
225 DCHECK(non_thread_safe_.CalledOnValidThread()); 231 DCHECK(non_thread_safe_.CalledOnValidThread());
226 pref_service_->ClearPref(prefs::kInvalidatorMaxInvalidationVersions); 232 pref_service_->ClearPref(prefs::kInvalidatorMaxInvalidationVersions);
227 pref_service_->ClearPref(prefs::kInvalidatorInvalidationState); 233 pref_service_->ClearPref(prefs::kInvalidatorInvalidationState);
228 } 234 }
229 235
230 } // namespace browser_sync 236 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698