summaryrefslogtreecommitdiffstats
path: root/sync/engine
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 09:12:07 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 09:12:07 +0000
commit543489a61275e87a9de13d67689aac6c6cd6df96 (patch)
tree9369cae4b5db5710c89a09870b94a0a2e5f3602e /sync/engine
parent030b5d9bb7d6c9f673cd8f0c86d8f1e921de7076 (diff)
downloadchromium_src-543489a61275e87a9de13d67689aac6c6cd6df96.zip
chromium_src-543489a61275e87a9de13d67689aac6c6cd6df96.tar.gz
chromium_src-543489a61275e87a9de13d67689aac6c6cd6df96.tar.bz2
sync: Set next unthrottle timer relative to 'now'
The unthrottle timer callback uses a subtle trick to make the effects of the timeout the same regardless of when it fires. This was intended to eliminate the small chance of a harmless race condition. The trick went wrong when I used the 'scheduled timeout' time rather than 'now' to calculate when the next timeout should fire. The unthrottle timeouts are supposed to be absolute times, so the distance from it should be calculated relative to 'now'. BUG=332241 Review URL: https://codereview.chromium.org/147493002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249303 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/engine')
-rw-r--r--sync/engine/sync_scheduler_impl.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sync/engine/sync_scheduler_impl.cc b/sync/engine/sync_scheduler_impl.cc
index c67ab5f..315ec95 100644
--- a/sync/engine/sync_scheduler_impl.cc
+++ b/sync/engine/sync_scheduler_impl.cc
@@ -777,14 +777,15 @@ void SyncSchedulerImpl::TypeUnthrottle(base::TimeTicks unthrottle_time) {
NotifyThrottledTypesChanged(nudge_tracker_.GetThrottledTypes());
if (nudge_tracker_.IsAnyTypeThrottled()) {
+ const base::TimeTicks now = base::TimeTicks::Now();
base::TimeDelta time_until_next_unthrottle =
- nudge_tracker_.GetTimeUntilNextUnthrottle(unthrottle_time);
+ nudge_tracker_.GetTimeUntilNextUnthrottle(now);
type_unthrottle_timer_.Start(
FROM_HERE,
time_until_next_unthrottle,
base::Bind(&SyncSchedulerImpl::TypeUnthrottle,
weak_ptr_factory_.GetWeakPtr(),
- unthrottle_time + time_until_next_unthrottle));
+ now + time_until_next_unthrottle));
}
// Maybe this is a good time to run a nudge job. Let's try it.