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

Side by Side Diff: sync/notifier/unacked_invalidation_set.cc

Issue 56113003: Implement new invalidations ack tracking system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More review fixes Created 7 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/notifier/unacked_invalidation_set.h" 5 #include "sync/notifier/unacked_invalidation_set.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "sync/internal_api/public/base/ack_handle.h" 8 #include "sync/internal_api/public/base/ack_handle.h"
9 #include "sync/notifier/object_id_invalidation_map.h" 9 #include "sync/notifier/object_id_invalidation_map.h"
10 #include "sync/notifier/sync_invalidation_listener.h" 10 #include "sync/notifier/sync_invalidation_listener.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 Truncate(kMaxBufferedInvalidations); 49 Truncate(kMaxBufferedInvalidations);
50 } 50 }
51 51
52 void UnackedInvalidationSet::ExportInvalidations( 52 void UnackedInvalidationSet::ExportInvalidations(
53 WeakHandle<AckHandler> ack_handler, 53 WeakHandle<AckHandler> ack_handler,
54 ObjectIdInvalidationMap* out) const { 54 ObjectIdInvalidationMap* out) const {
55 for (SingleObjectInvalidationSet::const_iterator it = invalidations_.begin(); 55 for (SingleObjectInvalidationSet::const_iterator it = invalidations_.begin();
56 it != invalidations_.end(); ++it) { 56 it != invalidations_.end(); ++it) {
57 // Copy the invalidation and set the copy's ack_handler. 57 // Copy the invalidation and set the copy's ack_handler.
58 Invalidation inv(*it); 58 Invalidation inv(*it);
59 inv.set_ack_handler(ack_handler); 59 inv.InitAckHandler(ack_handler);
60 out->Insert(inv); 60 out->Insert(inv);
61 } 61 }
62 } 62 }
63 63
64 void UnackedInvalidationSet::Clear() { 64 void UnackedInvalidationSet::Clear() {
65 invalidations_.clear(); 65 invalidations_.clear();
66 } 66 }
67 67
68 void UnackedInvalidationSet::SetHandlerIsRegistered() { 68 void UnackedInvalidationSet::SetHandlerIsRegistered() {
69 registered_ = true; 69 registered_ = true;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // an UnknownVersion invalidation. We remove the oldest remaining 195 // an UnknownVersion invalidation. We remove the oldest remaining
196 // invalidation to make room for it. 196 // invalidation to make room for it.
197 invalidation::ObjectId id = invalidations_.begin()->object_id(); 197 invalidation::ObjectId id = invalidations_.begin()->object_id();
198 invalidations_.erase(*invalidations_.begin()); 198 invalidations_.erase(*invalidations_.begin());
199 199
200 Invalidation unknown_version = Invalidation::InitUnknownVersion(id); 200 Invalidation unknown_version = Invalidation::InitUnknownVersion(id);
201 invalidations_.insert(unknown_version); 201 invalidations_.insert(unknown_version);
202 } 202 }
203 203
204 } // namespace syncer 204 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698