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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 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
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/metrics/histogram.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // Convert from a string -> string DictionaryValue to a 179 // Convert from a string -> string DictionaryValue to a
180 // ModelType -> int64 map. 180 // ModelType -> int64 map.
181 for (base::DictionaryValue::key_iterator it = 181 for (base::DictionaryValue::key_iterator it =
182 max_versions_dict->begin_keys(); 182 max_versions_dict->begin_keys();
183 it != max_versions_dict->end_keys(); ++it) { 183 it != max_versions_dict->end_keys(); ++it) {
184 int model_type_int = 0; 184 int model_type_int = 0;
185 if (!base::StringToInt(*it, &model_type_int)) { 185 if (!base::StringToInt(*it, &model_type_int)) {
186 LOG(WARNING) << "Invalid model type key: " << *it; 186 LOG(WARNING) << "Invalid model type key: " << *it;
187 continue; 187 continue;
188 } 188 }
189 if ((model_type_int < syncable::FIRST_REAL_MODEL_TYPE) || 189 if ((model_type_int < syncer::FIRST_REAL_MODEL_TYPE) ||
190 (model_type_int >= syncable::MODEL_TYPE_COUNT)) { 190 (model_type_int >= syncer::MODEL_TYPE_COUNT)) {
191 LOG(WARNING) << "Out-of-range model type key: " << model_type_int; 191 LOG(WARNING) << "Out-of-range model type key: " << model_type_int;
192 continue; 192 continue;
193 } 193 }
194 const syncable::ModelType model_type = 194 const syncer::ModelType model_type =
195 syncable::ModelTypeFromInt(model_type_int); 195 syncer::ModelTypeFromInt(model_type_int);
196 std::string max_version_str; 196 std::string max_version_str;
197 CHECK(max_versions_dict->GetString(*it, &max_version_str)); 197 CHECK(max_versions_dict->GetString(*it, &max_version_str));
198 int64 max_version = 0; 198 int64 max_version = 0;
199 if (!base::StringToInt64(max_version_str, &max_version)) { 199 if (!base::StringToInt64(max_version_str, &max_version)) {
200 LOG(WARNING) << "Invalid max invalidation version for " 200 LOG(WARNING) << "Invalid max invalidation version for "
201 << syncable::ModelTypeToString(model_type) << ": " 201 << syncer::ModelTypeToString(model_type) << ": "
202 << max_version_str; 202 << max_version_str;
203 continue; 203 continue;
204 } 204 }
205 invalidation::ObjectId id; 205 invalidation::ObjectId id;
206 if (!syncer::RealModelTypeToObjectId(model_type, &id)) { 206 if (!syncer::RealModelTypeToObjectId(model_type, &id)) {
207 DLOG(WARNING) << "Invalid model type: " << model_type; 207 DLOG(WARNING) << "Invalid model type: " << model_type;
208 continue; 208 continue;
209 } 209 }
210 (*map)[id] = max_version; 210 (*map)[id] = max_version;
211 } 211 }
(...skipping 15 matching lines...) Expand all
227 utf8_state); 227 utf8_state);
228 } 228 }
229 229
230 void InvalidatorStorage::Clear() { 230 void InvalidatorStorage::Clear() {
231 DCHECK(thread_checker_.CalledOnValidThread()); 231 DCHECK(thread_checker_.CalledOnValidThread());
232 pref_service_->ClearPref(prefs::kInvalidatorMaxInvalidationVersions); 232 pref_service_->ClearPref(prefs::kInvalidatorMaxInvalidationVersions);
233 pref_service_->ClearPref(prefs::kInvalidatorInvalidationState); 233 pref_service_->ClearPref(prefs::kInvalidatorInvalidationState);
234 } 234 }
235 235
236 } // namespace browser_sync 236 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698