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

Unified Diff: sync/internal_api/sync_manager_impl.cc

Issue 23754021: Invalidation trickles mega-patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 091ed289ea8ac08faf27f5bf64e6c2512c2d834e..91298a87cd1686a59fc57aa97e7bf0ada1608f6c 100644
--- a/sync/internal_api/sync_manager_impl.cc
+++ b/sync/internal_api/sync_manager_impl.cc
@@ -39,6 +39,7 @@
#include "sync/js/js_reply_handler.h"
#include "sync/notifier/invalidation_util.h"
#include "sync/notifier/invalidator.h"
+#include "sync/notifier/object_id_invalidation_map.h"
#include "sync/protocol/proto_value_conversions.h"
#include "sync/protocol/sync.pb.h"
#include "sync/syncable/directory.h"
@@ -1009,7 +1010,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());
}
@@ -1152,13 +1153,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 OrderedInvalidationList& type_invalidations =
+ invalidation_map.ForObject(*it);
+ for (OrderedInvalidationList::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->IsUnknownVersion() ? "UNKNOWN" : inv_it->GetPayload();
+ info->payload = payload;
}
}
}
@@ -1189,7 +1199,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)) {
@@ -1197,7 +1207,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);
@@ -1213,7 +1223,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