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

Side by Side Diff: sync/sessions/nudge_tracker.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/sessions/data_type_tracker.cc ('k') | sync/sync_internal_api.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "sync/sessions/nudge_tracker.h" 5 #include "sync/sessions/nudge_tracker.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "sync/internal_api/public/base/invalidation.h" 8 #include "sync/internal_api/public/base/invalidation.h"
9 #include "sync/notifier/invalidation_util.h" 9 #include "sync/notifier/invalidation_util.h"
10 #include "sync/notifier/object_id_invalidation_map.h" 10 #include "sync/notifier/object_id_invalidation_map.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 for (ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { 89 for (ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) {
90 DCHECK(type_trackers_.find(it.Get()) != type_trackers_.end()); 90 DCHECK(type_trackers_.find(it.Get()) != type_trackers_.end());
91 type_trackers_[it.Get()].RecordLocalRefreshRequest(); 91 type_trackers_[it.Get()].RecordLocalRefreshRequest();
92 } 92 }
93 } 93 }
94 94
95 void NudgeTracker::RecordRemoteInvalidation( 95 void NudgeTracker::RecordRemoteInvalidation(
96 const ObjectIdInvalidationMap& invalidation_map) { 96 const ObjectIdInvalidationMap& invalidation_map) {
97 updates_source_ = sync_pb::GetUpdatesCallerInfo::NOTIFICATION; 97 updates_source_ = sync_pb::GetUpdatesCallerInfo::NOTIFICATION;
98 98
99 for (ObjectIdInvalidationMap::const_iterator it = invalidation_map.begin(); 99 ObjectIdSet ids = invalidation_map.GetObjectIds();
100 it != invalidation_map.end(); ++it) { 100 for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) {
101 ModelType type; 101 ModelType type;
102 if (!ObjectIdToRealModelType(it->first, &type)) { 102 if (!ObjectIdToRealModelType(*it, &type)) {
103 NOTREACHED() 103 NOTREACHED()
104 << "Object ID " << ObjectIdToString(it->first) 104 << "Object ID " << ObjectIdToString(*it)
105 << " does not map to valid model type"; 105 << " does not map to valid model type";
106 } 106 }
107 DCHECK(type_trackers_.find(type) != type_trackers_.end()); 107 DCHECK(type_trackers_.find(type) != type_trackers_.end());
108 type_trackers_[type].RecordRemoteInvalidation(it->second.payload); 108 type_trackers_[type].RecordRemoteInvalidations(
109 invalidation_map.ForObject(*it));
109 } 110 }
110 } 111 }
111 112
112 void NudgeTracker::OnInvalidationsEnabled() { 113 void NudgeTracker::OnInvalidationsEnabled() {
113 invalidations_enabled_ = true; 114 invalidations_enabled_ = true;
114 } 115 }
115 116
116 void NudgeTracker::OnInvalidationsDisabled() { 117 void NudgeTracker::OnInvalidationsDisabled() {
117 invalidations_enabled_ = false; 118 invalidations_enabled_ = false;
118 invalidations_out_of_sync_ = true; 119 invalidations_out_of_sync_ = true;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 208
208 void NudgeTracker::SetHintBufferSize(size_t size) { 209 void NudgeTracker::SetHintBufferSize(size_t size) {
209 for (TypeTrackerMap::iterator it = type_trackers_.begin(); 210 for (TypeTrackerMap::iterator it = type_trackers_.begin();
210 it != type_trackers_.end(); ++it) { 211 it != type_trackers_.end(); ++it) {
211 it->second.UpdatePayloadBufferSize(size); 212 it->second.UpdatePayloadBufferSize(size);
212 } 213 }
213 } 214 }
214 215
215 } // namespace sessions 216 } // namespace sessions
216 } // namespace syncer 217 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/data_type_tracker.cc ('k') | sync/sync_internal_api.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698