Update AttachmentServiceImpl to retry attachment uploads.
commitc51cb78e34848822057a669f3ed1b69b7b2bd266
authormaniscalco <maniscalco@chromium.org>
Wed, 10 Sep 2014 18:30:23 +0000 (10 11:30 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 10 Sep 2014 18:36:37 +0000 (10 18:36 +0000)
tree8e26b3ff1d8909214f08e49c016b1c66f9dcba92
parent6b339cc6b4c812c198db0311f70ac3fa133b5dcf
Update AttachmentServiceImpl to retry attachment uploads.

Add TaskQueue, a class that provides retry and backoff semantics for
tasks.  Used by AttachmentServiceImpl.

AttachmentUploaderImpl and AttachmentDownloaderImpl now differentiate
between transient and non-transient errors.  Almost all errors are
assumed to be transient.  "403 Forbidden" is the exception and is
returned by the sync server if attachment are disabled for the user.

Transient errors encountered during attachment upload will be retried
with exponential backoff (using TaskQueue and BackoffEntry).  The idea
is to consolidate retry logic at the AttachmentServiceImpl level.

In a future CL, changes in network connectivity will affect retry and
backoff.

BUG=372622, 380437

Review URL: https://codereview.chromium.org/554743004

Cr-Commit-Position: refs/heads/master@{#294195}
16 files changed:
chrome/browser/sync/profile_sync_components_factory_impl.cc
components/sync_driver/generic_change_processor_unittest.cc
sync/internal_api/attachments/attachment_downloader_impl.cc
sync/internal_api/attachments/attachment_downloader_impl_unittest.cc
sync/internal_api/attachments/attachment_service_impl.cc
sync/internal_api/attachments/attachment_service_impl_unittest.cc
sync/internal_api/attachments/attachment_uploader_impl.cc
sync/internal_api/attachments/attachment_uploader_impl_unittest.cc
sync/internal_api/attachments/task_queue.cc [new file with mode: 0644]
sync/internal_api/attachments/task_queue_unittest.cc [new file with mode: 0644]
sync/internal_api/public/attachments/attachment_downloader.h
sync/internal_api/public/attachments/attachment_service_impl.h
sync/internal_api/public/attachments/attachment_uploader.h
sync/internal_api/public/attachments/task_queue.h [new file with mode: 0644]
sync/sync.gyp
sync/sync_tests.gypi