OLD | NEW |
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 pref_service_->Set(prefs::kInvalidatorMaxInvalidationVersions, | 115 pref_service_->Set(prefs::kInvalidatorMaxInvalidationVersions, |
116 max_versions_list); | 116 max_versions_list); |
117 } | 117 } |
118 | 118 |
119 // static | 119 // static |
120 void InvalidatorStorage::DeserializeFromList( | 120 void InvalidatorStorage::DeserializeFromList( |
121 const base::ListValue& max_versions_list, | 121 const base::ListValue& max_versions_list, |
122 InvalidationVersionMap* max_versions_map) { | 122 InvalidationVersionMap* max_versions_map) { |
123 max_versions_map->clear(); | 123 max_versions_map->clear(); |
124 for (size_t i = 0; i < max_versions_list.GetSize(); ++i) { | 124 for (size_t i = 0; i < max_versions_list.GetSize(); ++i) { |
125 DictionaryValue* value = NULL; | 125 const DictionaryValue* value = NULL; |
126 if (!max_versions_list.GetDictionary(i, &value)) { | 126 if (!max_versions_list.GetDictionary(i, &value)) { |
127 DLOG(WARNING) << "Unable to deserialize entry " << i; | 127 DLOG(WARNING) << "Unable to deserialize entry " << i; |
128 continue; | 128 continue; |
129 } | 129 } |
130 invalidation::ObjectId id; | 130 invalidation::ObjectId id; |
131 int64 max_version = 0; | 131 int64 max_version = 0; |
132 if (!ValueToObjectIdAndVersion(*value, &id, &max_version)) { | 132 if (!ValueToObjectIdAndVersion(*value, &id, &max_version)) { |
133 DLOG(WARNING) << "Error while deserializing entry " << i; | 133 DLOG(WARNING) << "Error while deserializing entry " << i; |
134 continue; | 134 continue; |
135 } | 135 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |