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

Unified Diff: sync/internal_api/sync_manager_impl.cc

Issue 23441042: Refactor common invalidation framework types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move DEPS rule Created 7 years, 2 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/internal_api/sync_manager_impl.cc
diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc
index f79213dfdc73a32f961ee077e22952ec74714f8f..418fd1fd6fa8d316e0154960d7dd6a14c0a11b16 100644
--- a/sync/internal_api/sync_manager_impl.cc
+++ b/sync/internal_api/sync_manager_impl.cc
@@ -1005,7 +1005,7 @@ base::DictionaryValue* SyncManagerImpl::NotificationInfoToValue(
for (NotificationInfoMap::const_iterator it = notification_info.begin();
it != notification_info.end(); ++it) {
- const std::string& model_type_str = ModelTypeToString(it->first);
+ const std::string model_type_str = ModelTypeToString(it->first);
value->Set(model_type_str, it->second.ToValue());
}
@@ -1148,13 +1148,22 @@ JsArgList SyncManagerImpl::GetChildNodeIds(const JsArgList& args) {
void SyncManagerImpl::UpdateNotificationInfo(
const ObjectIdInvalidationMap& invalidation_map) {
- for (ObjectIdInvalidationMap::const_iterator it = invalidation_map.begin();
- it != invalidation_map.end(); ++it) {
+ ObjectIdSet ids = invalidation_map.GetObjectIds();
+ for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) {
ModelType type = UNSPECIFIED;
- if (ObjectIdToRealModelType(it->first, &type)) {
+ if (!ObjectIdToRealModelType(*it, &type)) {
+ continue;
+ }
+ const SingleObjectInvalidationSet& type_invalidations =
+ invalidation_map.ForObject(*it);
+ for (SingleObjectInvalidationSet::const_iterator inv_it =
+ type_invalidations.begin(); inv_it != type_invalidations.end();
+ ++inv_it) {
NotificationInfo* info = &notification_info_map_[type];
info->total_count++;
- info->payload = it->second.payload;
+ std::string payload =
+ inv_it->is_unknown_version() ? "UNKNOWN" : inv_it->payload();
+ info->payload = payload;
}
}
}
@@ -1185,7 +1194,7 @@ void SyncManagerImpl::OnIncomingInvalidation(
DCHECK(thread_checker_.CalledOnValidThread());
// We should never receive IDs from non-sync objects.
- ObjectIdSet ids = ObjectIdInvalidationMapToSet(invalidation_map);
+ ObjectIdSet ids = invalidation_map.GetObjectIds();
for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) {
ModelType type;
if (!ObjectIdToRealModelType(*it, &type)) {
@@ -1193,7 +1202,7 @@ void SyncManagerImpl::OnIncomingInvalidation(
}
}
- if (invalidation_map.empty()) {
+ if (invalidation_map.Empty()) {
LOG(WARNING) << "Sync received invalidation without any type information.";
} else {
allstatus_.IncrementNudgeCounter(NUDGE_SOURCE_NOTIFICATION);
@@ -1209,7 +1218,8 @@ void SyncManagerImpl::OnIncomingInvalidation(
base::DictionaryValue details;
base::ListValue* changed_types = new base::ListValue();
details.Set("changedTypes", changed_types);
- ObjectIdSet id_set = ObjectIdInvalidationMapToSet(invalidation_map);
+
+ ObjectIdSet id_set = invalidation_map.GetObjectIds();
ModelTypeSet nudged_types = ObjectIdSetToModelTypeSet(id_set);
DCHECK(!nudged_types.Empty());
for (ModelTypeSet::Iterator it = nudged_types.First();
« no previous file with comments | « sync/internal_api/public/base/object_id_invalidation_map_test_util.cc ('k') | sync/internal_api/sync_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698