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

Unified Diff: sync/internal_api/public/attachments/task_queue.h

Issue 569463002: Make AttachmentServiceImpl clear backoff when reconnected to network. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with master. Created 6 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
« no previous file with comments | « sync/internal_api/public/attachments/attachment_service_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/public/attachments/task_queue.h
diff --git a/sync/internal_api/public/attachments/task_queue.h b/sync/internal_api/public/attachments/task_queue.h
index 2466f3a3e3b34142ca2db6d6f8ec705940ff70e6..76d67bff697fc30298a5a5ab5fa5124b39c46b25 100644
--- a/sync/internal_api/public/attachments/task_queue.h
+++ b/sync/internal_api/public/attachments/task_queue.h
@@ -122,13 +122,19 @@ class TaskQueue : base::NonThreadSafe {
// |task|.
void Cancel(const T& task);
- private:
- FRIEND_TEST_ALL_PREFIXES(TaskQueueTest, Retry);
+ // Reset any backoff delay and resume dispatching of tasks.
+ //
+ // Useful for when you know the cause of previous failures has been resolved
+ // and you want don't want to wait for the accumulated backoff delay to
+ // elapse.
+ void ResetBackoff();
// Use |timer| for scheduled events.
//
// Used in tests. See also MockTimer.
void SetTimerForTest(scoped_ptr<base::Timer> timer);
+
+ private:
void FinishTask(const T& task);
void ScheduleDispatch();
void Dispatch();
@@ -218,6 +224,13 @@ void TaskQueue<T>::Cancel(const T& task) {
}
template <typename T>
+void TaskQueue<T>::ResetBackoff() {
+ backoff_timer_->Stop();
+ backoff_entry_->Reset();
+ ScheduleDispatch();
+}
+
+template <typename T>
void TaskQueue<T>::SetTimerForTest(scoped_ptr<base::Timer> timer) {
DCHECK(CalledOnValidThread());
DCHECK(timer.get());
« no previous file with comments | « sync/internal_api/public/attachments/attachment_service_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698