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

Unified Diff: sync/notifier/invalidation_util.cc

Issue 10702074: Refactor sync-specific parts out of SyncNotifier/SyncNotifierObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 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 side-by-side diff with in-line comments
Download patch
Index: sync/notifier/invalidation_util.cc
diff --git a/sync/notifier/invalidation_util.cc b/sync/notifier/invalidation_util.cc
index 5574a8c60ce531be47546db2496c1169b53d1462..2997c8cdec8009d83369771f469fd855db6461b0 100644
--- a/sync/notifier/invalidation_util.cc
+++ b/sync/notifier/invalidation_util.cc
@@ -36,6 +36,33 @@ bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id,
object_id.name(), model_type);
}
+ObjectIdSet ModelTypeSetToObjectIdSet(const ModelTypeSet& model_types) {
+ ObjectIdSet ids;
+ for (ModelTypeSet::Iterator iter = model_types.First(); iter.Good();
+ iter.Inc()) {
+ invalidation::ObjectId model_type_as_id;
+ if (!RealModelTypeToObjectId(iter.Get(), &model_type_as_id)) {
+ DLOG(WARNING) << "Invalid model type " << iter.Get();
+ continue;
+ }
+ ids.insert(model_type_as_id);
+ }
+ return ids;
+}
+
+ModelTypeSet ObjectIdSetToModelTypeSet(const ObjectIdSet& ids) {
+ ModelTypeSet model_types;
+ for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) {
+ ModelType model_type;
+ if (!ObjectIdToRealModelType(*it, &model_type)) {
+ DLOG(WARNING) << "Invalid object ID " << ObjectIdToString(*it);
+ continue;
+ }
+ model_types.Put(model_type);
+ }
+ return model_types;
+}
+
std::string ObjectIdToString(
const invalidation::ObjectId& object_id) {
std::stringstream ss;

Powered by Google App Engine
This is Rietveld 408576698