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

Issue 13422003: sync: Refactor job ownership in SyncScheduler (Closed)

Created:
7 years, 8 months ago by rlarocque
Modified:
7 years, 8 months ago
CC:
chromium-reviews, Raghu Simha, haitaol1, akalin, tim (not reviewing), pavely
Visibility:
Public.

Description

sync: 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+198 lines, -478 lines) Patch
M sync/engine/sync_scheduler_impl.h View 1 2 3 4 5 11 chunks +32 lines, -70 lines 0 comments Download
M sync/engine/sync_scheduler_impl.cc View 1 2 3 4 5 36 chunks +145 lines, -290 lines 0 comments Download
M sync/engine/sync_scheduler_unittest.cc View 1 2 3 4 2 chunks +17 lines, -10 lines 0 comments Download
M sync/engine/sync_scheduler_whitebox_unittest.cc View 1 2 3 4 2 chunks +0 lines, -16 lines 0 comments Download
M sync/engine/sync_session_job.h View 5 3 chunks +0 lines, -17 lines 0 comments Download
M sync/engine/sync_session_job.cc View 1 2 3 4 5 6 7 3 chunks +4 lines, -17 lines 0 comments Download
M sync/engine/sync_session_job_unittest.cc View 5 1 chunk +0 lines, -58 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
rlarocque
Please review. https://codereview.chromium.org/13422003/diff/8001/sync/engine/sync_scheduler_impl.cc File sync/engine/sync_scheduler_impl.cc (right): https://codereview.chromium.org/13422003/diff/8001/sync/engine/sync_scheduler_impl.cc#newcode608 sync/engine/sync_scheduler_impl.cc:608: ResumeWaiting(); Here's a paragraph that I had ...
7 years, 8 months ago (2013-04-02 23:01:12 UTC) #1
rlarocque
I forgot to specify a reviewer in my first message. Let's try this again.
7 years, 8 months ago (2013-04-02 23:02:44 UTC) #2
tim (not reviewing)
https://codereview.chromium.org/13422003/diff/8001/sync/engine/sync_scheduler_impl.cc File sync/engine/sync_scheduler_impl.cc (right): https://codereview.chromium.org/13422003/diff/8001/sync/engine/sync_scheduler_impl.cc#newcode653 sync/engine/sync_scheduler_impl.cc:653: bool SyncSchedulerImpl::DoNudgeSyncSessionJob(JobPriority priority) { Digging around, it looks like ...
7 years, 8 months ago (2013-04-04 00:22:11 UTC) #3
rlarocque
PTAL. https://codereview.chromium.org/13422003/diff/8001/sync/engine/sync_scheduler_impl.cc File sync/engine/sync_scheduler_impl.cc (right): https://codereview.chromium.org/13422003/diff/8001/sync/engine/sync_scheduler_impl.cc#newcode653 sync/engine/sync_scheduler_impl.cc:653: bool SyncSchedulerImpl::DoNudgeSyncSessionJob(JobPriority priority) { On 2013/04/04 00:22:11, timsteele ...
7 years, 8 months ago (2013-04-04 00:59:48 UTC) #4
tim (not reviewing)
https://codereview.chromium.org/13422003/diff/8001/sync/engine/sync_scheduler_impl.cc File sync/engine/sync_scheduler_impl.cc (right): https://codereview.chromium.org/13422003/diff/8001/sync/engine/sync_scheduler_impl.cc#newcode349 sync/engine/sync_scheduler_impl.cc:349: else // We are here because timer ran out. ...
7 years, 8 months ago (2013-04-04 18:07:30 UTC) #5
rlarocque
PTAL. Here's the patch with the nudge in backoff removed. I decided to remove PostDelayedTask ...
7 years, 8 months ago (2013-04-05 00:48:50 UTC) #6
tim (not reviewing)
https://codereview.chromium.org/13422003/diff/17001/sync/engine/sync_scheduler_impl.cc File sync/engine/sync_scheduler_impl.cc (right): https://codereview.chromium.org/13422003/diff/17001/sync/engine/sync_scheduler_impl.cc#newcode319 sync/engine/sync_scheduler_impl.cc:319: DCHECK_EQ(MessageLoop::current(), sync_loop_); It looks like all non-DCHECK use of ...
7 years, 8 months ago (2013-04-05 16:56:44 UTC) #7
rlarocque
PTAL. The latest patch includes a rebase, addresses your comments, and fixes a few other ...
7 years, 8 months ago (2013-04-05 19:13:29 UTC) #8
tim (not reviewing)
LGTM with nit! https://codereview.chromium.org/13422003/diff/24002/sync/engine/sync_session_job.cc File sync/engine/sync_session_job.cc (left): https://codereview.chromium.org/13422003/diff/24002/sync/engine/sync_session_job.cc#oldcode40 sync/engine/sync_session_job.cc:40: // Did we run through all ...
7 years, 8 months ago (2013-04-05 19:30:36 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rlarocque@chromium.org/13422003/31001
7 years, 8 months ago (2013-04-05 20:27:15 UTC) #10
commit-bot: I haz the power
7 years, 8 months ago (2013-04-06 00:22:32 UTC) #11
Message was sent while issue was closed.
Change committed as 192666

Powered by Google App Engine
This is Rietveld 408576698