Descriptionsync: Refactor job ownership in SyncScheduler
This change separates the tracking of what work needs to be done from
the decision of when to do it. Prior to this change, SyncSessionJobs
were owned either by Closures posted to the sync thread's message loop,
or held temporarily in unscheduled_nudge_storage_, a member of the
SyncScheduler. Following this change, there can be only two jobs in
existence, and they will be referenced only by the scoped_ptr members of
SyncScheduler named pending_nudge_job_ and pending_configure_job_.
This change, along with some previous changes to the way we schedule
tasks, makes it possible to simplify the job "saving" logic. Jobs with
purpose == NUDGE are saved by assigning them to pending_nudge_job_ or
coalescing them with the existing pending_nudge_job_. Jobs with purpose
== CONFIGURE are never coalesced, and can be saved in the
pending_configure_job_ member. These changes allow us to make
SyncSessionJob::Clone() obsolete.
The logic in ScheduleNudgeImpl() has been updated to take advantage of
the fact that the pending job is much easier to find now. It should now
be much better at coalescing its sources. In other words, there will be
less scenarios where it can drop notification hints. However, there are
still some cases in DecideOnJob() that may induce it to drop hints
unnecessarily.
The scheduling logic has been modified, too. We've removed support for
the nudge while in an exponential backoff interval. This makes it
possible to track the next wakeup time using a single timer, since the
wakeup event will be one of:
- The end of a throttled interval
- An end-of-backoff-interval retry
- A scheduled nudge
and these scenarios are now mutually exclusive.
BUG=175024
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=192666
Patch Set 1 #Patch Set 2 : Minor fixes #Patch Set 3 : Attempt to fix subtle problem with nudge-in-backoff handling #
Total comments: 12
Patch Set 4 : s/pending_wakeup_/pending_wakeup_event_/ #Patch Set 5 : Remove nudge while in backoff #
Total comments: 8
Patch Set 6 : Cleanup stale comments and unused variables #Patch Set 7 : Fixed upload #
Total comments: 1
Patch Set 8 : Update comment #
Messages
Total messages: 11 (0 generated)
|