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

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

Issue 10911084: Implement Invalidator::Acknowledge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adapt patch to new TickClock interface Created 7 years, 9 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/internal_api/test/fake_sync_manager.cc ('k') | sync/notifier/fake_invalidator.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ack_tracker.h" 5 #include "sync/notifier/ack_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 void AckTracker::Clear() { 91 void AckTracker::Clear() {
92 DCHECK(thread_checker_.CalledOnValidThread()); 92 DCHECK(thread_checker_.CalledOnValidThread());
93 93
94 timer_.Stop(); 94 timer_.Stop();
95 STLDeleteValues(&queue_); 95 STLDeleteValues(&queue_);
96 } 96 }
97 97
98 void AckTracker::Track(const ObjectIdSet& ids) { 98 void AckTracker::Track(const ObjectIdSet& ids) {
99 DCHECK(thread_checker_.CalledOnValidThread()); 99 DCHECK(thread_checker_.CalledOnValidThread());
100 DCHECK(!ids.empty());
100 101
101 scoped_ptr<Entry> entry(new Entry( 102 scoped_ptr<Entry> entry(new Entry(
102 create_backoff_entry_callback_.Run(&kDefaultBackoffPolicy), ids)); 103 create_backoff_entry_callback_.Run(&kDefaultBackoffPolicy), ids));
103 // This is a small hack. When net::BackoffRequest is first created, 104 // This is a small hack. When net::BackoffRequest is first created,
104 // GetReleaseTime() always returns the default base::TimeTicks value: 0. 105 // GetReleaseTime() always returns the default base::TimeTicks value: 0.
105 // In order to work around that, we mark it as failed right away. 106 // In order to work around that, we mark it as failed right away.
106 entry->backoff->InformOfRequest(false /* succeeded */); 107 entry->backoff->InformOfRequest(false /* succeeded */);
107 const base::TimeTicks release_time = entry->backoff->GetReleaseTime(); 108 const base::TimeTicks release_time = entry->backoff->GetReleaseTime();
108 queue_.insert(std::make_pair(release_time, entry.release())); 109 queue_.insert(std::make_pair(release_time, entry.release()));
109 NudgeTimer(); 110 NudgeTimer();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return queue_.empty(); 212 return queue_.empty();
212 } 213 }
213 214
214 const base::Timer& AckTracker::GetTimerForTest() const { 215 const base::Timer& AckTracker::GetTimerForTest() const {
215 DCHECK(thread_checker_.CalledOnValidThread()); 216 DCHECK(thread_checker_.CalledOnValidThread());
216 217
217 return timer_; 218 return timer_;
218 } 219 }
219 220
220 } // namespace syncer 221 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/test/fake_sync_manager.cc ('k') | sync/notifier/fake_invalidator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698