Index: sync/notifier/invalidation_util.cc |
diff --git a/sync/notifier/invalidation_util.cc b/sync/notifier/invalidation_util.cc |
index 0065b50e2b99d1a990eb042d588b84c1e7726806..5b18d66f3ae8ed207ca5eb4a4f02f5f90c34c632 100644 |
--- a/sync/notifier/invalidation_util.cc |
+++ b/sync/notifier/invalidation_util.cc |
@@ -33,6 +33,32 @@ bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id, |
return NotificationTypeToRealModelType(object_id.name(), model_type); |
} |
+ObjectIdSet ModelTypeSetToObjectIdSet(const ModelTypeSet& model_types) { |
+ ObjectIdSet ids; |
+ for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { |
+ invalidation::ObjectId model_type_as_id; |
+ if (!RealModelTypeToObjectId(it.Get(), &model_type_as_id)) { |
+ DLOG(WARNING) << "Invalid model type " << it.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; |