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

Unified Diff: chrome/browser/sync/engine/sync_scheduler.cc

Issue 7604019: [Sync] Add client-side plumbing for server control of sessions commit delay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error and address comments Created 9 years, 4 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 | « chrome/browser/sync/engine/sync_scheduler.h ('k') | chrome/browser/sync/engine/sync_scheduler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/sync_scheduler.cc
diff --git a/chrome/browser/sync/engine/sync_scheduler.cc b/chrome/browser/sync/engine/sync_scheduler.cc
index 82a847639a2f6d017ac842951f1abc5b7e4e08f1..04095457e3c7c83c87af25d3418c9d97bfbdf05a 100644
--- a/chrome/browser/sync/engine/sync_scheduler.cc
+++ b/chrome/browser/sync/engine/sync_scheduler.cc
@@ -135,6 +135,12 @@ SyncScheduler::WaitInterval::WaitInterval(Mode mode, TimeDelta length)
#define SVLOG_LOC(from_here, verbose_level) \
VLOG_LOC(from_here, verbose_level) << name_ << ": "
+namespace {
+
+const int kDefaultSessionsCommitDelaySeconds = 10;
+
+} // namespace
+
SyncScheduler::SyncScheduler(const std::string& name,
sessions::SyncSessionContext* context,
Syncer* syncer)
@@ -146,6 +152,8 @@ SyncScheduler::SyncScheduler(const std::string& name,
TimeDelta::FromSeconds(kDefaultShortPollIntervalSeconds)),
syncer_long_poll_interval_seconds_(
TimeDelta::FromSeconds(kDefaultLongPollIntervalSeconds)),
+ sessions_commit_delay_(
+ TimeDelta::FromSeconds(kDefaultSessionsCommitDelaySeconds)),
mode_(NORMAL_MODE),
server_connection_ok_(false),
delay_provider_(new DelayProvider()),
@@ -1063,6 +1071,12 @@ void SyncScheduler::OnReceivedLongPollIntervalUpdate(
syncer_long_poll_interval_seconds_ = new_interval;
}
+void SyncScheduler::OnReceivedSessionsCommitDelay(
+ const base::TimeDelta& new_delay) {
+ DCHECK_EQ(MessageLoop::current(), sync_loop_);
+ sessions_commit_delay_ = new_delay;
+}
+
void SyncScheduler::OnShouldStopSyncingPermanently() {
DCHECK_EQ(MessageLoop::current(), sync_loop_);
SVLOG(2) << "OnShouldStopSyncingPermanently";
@@ -1084,16 +1098,17 @@ void SyncScheduler::set_notifications_enabled(bool notifications_enabled) {
session_context_->set_notifications_enabled(notifications_enabled);
}
+base::TimeDelta SyncScheduler::sessions_commit_delay() const {
+ DCHECK_EQ(MessageLoop::current(), sync_loop_);
+ return sessions_commit_delay_;
+}
+
#undef SVLOG_LOC
#undef SVLOG
#undef SLOG
-#undef VLOG_LOC
-
-#undef VLOG_LOC_STREAM
-
#undef ENUM_CASE
} // browser_sync
« no previous file with comments | « chrome/browser/sync/engine/sync_scheduler.h ('k') | chrome/browser/sync/engine/sync_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698