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

Unified Diff: sync/internal_api/attachments/attachment_service_impl.cc

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 | « no previous file | sync/internal_api/attachments/attachment_service_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/attachments/attachment_service_impl.cc
diff --git a/sync/internal_api/attachments/attachment_service_impl.cc b/sync/internal_api/attachments/attachment_service_impl.cc
index 5ba540b188d684c66f9bcf4d1bab407f11aab820..227fd8be25a03ff4f3ecff3c0e087a1ff586f7d4 100644
--- a/sync/internal_api/attachments/attachment_service_impl.cc
+++ b/sync/internal_api/attachments/attachment_service_impl.cc
@@ -134,10 +134,13 @@ AttachmentServiceImpl::AttachmentServiceImpl(
weak_ptr_factory_.GetWeakPtr()),
initial_backoff_delay,
max_backoff_delay));
+
+ net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
}
AttachmentServiceImpl::~AttachmentServiceImpl() {
DCHECK(CalledOnValidThread());
+ net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
}
// Static.
@@ -288,6 +291,13 @@ void AttachmentServiceImpl::UploadAttachments(
}
}
+void AttachmentServiceImpl::OnNetworkChanged(
+ net::NetworkChangeNotifier::ConnectionType type) {
+ if (type != net::NetworkChangeNotifier::CONNECTION_NONE) {
+ upload_task_queue_->ResetBackoff();
+ }
+}
+
void AttachmentServiceImpl::ReadDoneNowUpload(
const AttachmentStore::Result& result,
scoped_ptr<AttachmentMap> attachments,
@@ -313,4 +323,8 @@ void AttachmentServiceImpl::ReadDoneNowUpload(
}
}
+void AttachmentServiceImpl::SetTimerForTest(scoped_ptr<base::Timer> timer) {
+ upload_task_queue_->SetTimerForTest(timer.Pass());
+}
+
} // namespace syncer
« no previous file with comments | « no previous file | sync/internal_api/attachments/attachment_service_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698