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

Issue 17052007: sync: Expose sync functionality as functions (Closed)

Created:
7 years, 6 months ago by rlarocque
Modified:
7 years, 5 months ago
CC:
chromium-reviews, Raghu Simha, haitaol1, akalin
Visibility:
Public.

Description

sync: Expose sync functionality as functions This change is a refactor to clean up ugliness introduced in previous commits and prepare for future features. The most notable change is the removal of "state machine" logic from syncer.cc. This allows us to remove the SyncerSteps enum and related code. The SyncShare function + enum parameters have been replaced with the functions NormalSyncShare(), ConfigureSyncShare() and PollSyncShare(). These changes should make it possible to address crbug.com/109422, and to re-enable commits during poll-triggered sync cycles (if desrired, see r206475). The logic for fetching and applying updates has been modified, too. Since the behaviour of GetUpdates varies depending on the type of cycle (Configure, GetUpdates, or Poll) the logic to build and execute these GetUpdate requests has been split up. This enables us to remove the NudgeTracker from the SyncSession (an ugly hack introduced in r199136). It should make it easier to implement crbug.com/147685. In the interest of keeping this change as small and simple as possible some obvious refactorings have not been intentionally excluded from this CL. For example, the logic around when to send SYNC_CYCLE_ENDED events or when to return true or false frome the SyncShare functions remains very complicated. Untangling that mess would require some non-trivial changes to the SyncScheduler, so they've been deferred until later. BUG=147685, 109422 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=209867

Patch Set 1 #

Total comments: 1

Patch Set 2 : Minor cleanups #

Total comments: 9

Patch Set 3 : Review fixes (not tested nor rebased) #

Total comments: 2

Patch Set 4 : Const-ify member #

Patch Set 5 : Rebase #

Total comments: 2

Patch Set 6 : Add another ExitRequested() check #

Patch Set 7 : Fix migrations #

Patch Set 8 : Fix more integration tests #

Total comments: 4

Patch Set 9 : Refactor SyncShare function signatures #

Total comments: 6

Patch Set 10 : Some refactorings #

Total comments: 5

Patch Set 11 : Closures and other refactorings #

Patch Set 12 : Rebase #

Patch Set 13 : Minor changes to #includes #

Total comments: 6

Patch Set 14 : More refactorings #

Patch Set 15 : Even more refactoring #

Patch Set 16 : Finish addressing latest review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+872 lines, -885 lines) Patch
M sync/engine/commit.h View 2 chunks +2 lines, -0 lines 0 comments Download
M sync/engine/commit.cc View 5 chunks +12 lines, -4 lines 0 comments Download
A sync/engine/download.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +59 lines, -0 lines 0 comments Download
A sync/engine/download.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +289 lines, -0 lines 0 comments Download
A + sync/engine/download_unittest.cc View 5 chunks +28 lines, -25 lines 0 comments Download
D sync/engine/download_updates_command.h View 1 chunk +0 lines, -63 lines 0 comments Download
D sync/engine/download_updates_command.cc View 1 chunk +0 lines, -224 lines 0 comments Download
D sync/engine/download_updates_command_unittest.cc View 1 chunk +0 lines, -93 lines 0 comments Download
M sync/engine/get_commit_ids_command.h View 1 2 3 2 chunks +4 lines, -0 lines 0 comments Download
M sync/engine/get_commit_ids_command.cc View 6 chunks +12 lines, -12 lines 0 comments Download
M sync/engine/sync_scheduler_impl.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -0 lines 0 comments Download
M sync/engine/sync_scheduler_impl.cc View 1 2 3 4 5 6 7 8 4 chunks +20 lines, -10 lines 0 comments Download
M sync/engine/sync_scheduler_unittest.cc View 1 2 3 4 5 6 7 8 37 chunks +134 lines, -165 lines 0 comments Download
M sync/engine/syncer.h View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +16 lines, -25 lines 0 comments Download
M sync/engine/syncer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +103 lines, -142 lines 0 comments Download
M sync/engine/syncer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 10 chunks +30 lines, -38 lines 0 comments Download
M sync/engine/syncer_util.h View 1 chunk +1 line, -0 lines 0 comments Download
M sync/sessions/data_type_tracker.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +4 lines, -0 lines 0 comments Download
M sync/sessions/data_type_tracker.cc View 2 chunks +18 lines, -0 lines 0 comments Download
M sync/sessions/nudge_tracker.h View 2 chunks +10 lines, -3 lines 0 comments Download
M sync/sessions/nudge_tracker.cc View 2 chunks +9 lines, -2 lines 0 comments Download
M sync/sessions/nudge_tracker_unittest.cc View 1 1 chunk +0 lines, -1 line 0 comments Download
M sync/sessions/sync_session.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +1 line, -14 lines 0 comments Download
M sync/sessions/sync_session.cc View 1 chunk +3 lines, -13 lines 0 comments Download
M sync/sessions/test_util.h View 1 2 3 4 5 6 7 8 2 chunks +44 lines, -14 lines 0 comments Download
M sync/sessions/test_util.cc View 1 2 3 4 5 6 7 8 3 chunks +65 lines, -34 lines 0 comments Download
M sync/sync_core.gypi View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -2 lines 0 comments Download
M sync/sync_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 28 (0 generated)
rlarocque
Here's an attempt to functionize syncer.cc and download_updates_command.cc. Please review. I realize there's still some ...
7 years, 6 months ago (2013-06-18 00:25:20 UTC) #1
tim (not reviewing)
syncer.cc comments in follow up to offline discussion, overall nothing too major. Will review rest ...
7 years, 6 months ago (2013-06-21 17:24:00 UTC) #2
tim (not reviewing)
https://chromiumcodereview.appspot.com/17052007/diff/2001/sync/engine/syncer.cc File sync/engine/syncer.cc (right): https://chromiumcodereview.appspot.com/17052007/diff/2001/sync/engine/syncer.cc#newcode68 sync/engine/syncer.cc:68: while (!session->status_controller().ServerSaysNothingMoreToDownload()) { I think the general paradigm of ...
7 years, 6 months ago (2013-06-21 17:41:38 UTC) #3
rlarocque
https://chromiumcodereview.appspot.com/17052007/diff/2001/sync/engine/syncer.cc File sync/engine/syncer.cc (right): https://chromiumcodereview.appspot.com/17052007/diff/2001/sync/engine/syncer.cc#newcode68 sync/engine/syncer.cc:68: while (!session->status_controller().ServerSaysNothingMoreToDownload()) { On 2013/06/21 17:41:38, timsteele wrote: > ...
7 years, 6 months ago (2013-06-21 18:30:36 UTC) #4
rlarocque
+Nicolas Nicolas, will this change conflict with your work to put types into a state ...
7 years, 6 months ago (2013-06-21 18:33:20 UTC) #5
Nicolas Zea
On 2013/06/21 18:33:20, rlarocque wrote: > +Nicolas > > Nicolas, will this change conflict with ...
7 years, 6 months ago (2013-06-21 19:46:56 UTC) #6
rlarocque
On 2013/06/21 19:46:56, Nicolas Zea wrote: > On 2013/06/21 18:33:20, rlarocque wrote: > > +Nicolas ...
7 years, 6 months ago (2013-06-21 20:00:32 UTC) #7
tim (not reviewing)
I feel like the ExitRequested semantics change is significant enough to warrant a second set ...
7 years, 6 months ago (2013-06-21 21:24:03 UTC) #8
rlarocque
Addressed comments and rebased. I guess we're now waiting for Nicolas and/or Haitao's comments on ...
7 years, 6 months ago (2013-06-24 20:03:08 UTC) #9
Nicolas Zea
The suggestion is basically to just check ExitRequested before ApplyUpdates right? That seems like a ...
7 years, 6 months ago (2013-06-24 21:18:16 UTC) #10
rlarocque
I've re-added the check, but I reserve the right to remove it again if it ...
7 years, 6 months ago (2013-06-24 21:59:30 UTC) #11
rlarocque
I've fixed some integration test issues and re-enabled that early exit. PTAL.
7 years, 6 months ago (2013-06-25 18:45:46 UTC) #12
Nicolas Zea
style-wise I think I'd still prefer to have the DownloadUpdates/ApplyUpdates/etc. functions handle the Exit checking ...
7 years, 6 months ago (2013-06-25 23:47:34 UTC) #13
rlarocque
Patch updated. Tim, PTAL. https://codereview.chromium.org/17052007/diff/48001/sync/engine/syncer.cc File sync/engine/syncer.cc (right): https://codereview.chromium.org/17052007/diff/48001/sync/engine/syncer.cc#newcode62 sync/engine/syncer.cc:62: bool Syncer::NormalSyncShare(SyncSession* session, On 2013/06/25 ...
7 years, 6 months ago (2013-06-26 00:56:07 UTC) #14
tim (not reviewing)
https://codereview.chromium.org/17052007/diff/57001/sync/engine/download.cc File sync/engine/download.cc (right): https://codereview.chromium.org/17052007/diff/57001/sync/engine/download.cc#newcode161 sync/engine/download.cc:161: DCHECK(!request_types.Empty()); There's just too much duplicated code here. I ...
7 years, 6 months ago (2013-06-26 20:26:30 UTC) #15
rlarocque
PTAL https://codereview.chromium.org/17052007/diff/57001/sync/engine/download.cc File sync/engine/download.cc (right): https://codereview.chromium.org/17052007/diff/57001/sync/engine/download.cc#newcode161 sync/engine/download.cc:161: DCHECK(!request_types.Empty()); On 2013/06/26 20:26:30, timsteele wrote: > There's ...
7 years, 6 months ago (2013-06-26 22:00:51 UTC) #16
tim (not reviewing)
https://codereview.chromium.org/17052007/diff/68001/sync/engine/download.cc File sync/engine/download.cc (right): https://codereview.chromium.org/17052007/diff/68001/sync/engine/download.cc#newcode246 sync/engine/download.cc:246: SyncerError PollDownloadUpdates( DownloadUpdatesForPoll https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc File sync/engine/syncer.cc (right): https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc#newcode143 sync/engine/syncer.cc:143: ...
7 years, 5 months ago (2013-06-27 17:42:02 UTC) #17
rlarocque
https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc File sync/engine/syncer.cc (right): https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc#newcode143 sync/engine/syncer.cc:143: return HandleCycleEnd(session); On 2013/06/27 17:42:02, timsteele wrote: > As ...
7 years, 5 months ago (2013-06-27 18:08:44 UTC) #18
tim (not reviewing)
https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc File sync/engine/syncer.cc (right): https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc#newcode143 sync/engine/syncer.cc:143: return HandleCycleEnd(session); On 2013/06/27 18:08:45, rlarocque wrote: > On ...
7 years, 5 months ago (2013-06-27 18:22:15 UTC) #19
tim (not reviewing)
On 2013/06/27 18:22:15, timsteele wrote: > https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc > File sync/engine/syncer.cc (right): > > https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc#newcode143 > ...
7 years, 5 months ago (2013-06-27 18:24:17 UTC) #20
rlarocque
https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc File sync/engine/syncer.cc (right): https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc#newcode143 sync/engine/syncer.cc:143: return HandleCycleEnd(session); On 2013/06/27 18:22:15, timsteele wrote: > On ...
7 years, 5 months ago (2013-06-27 18:46:07 UTC) #21
tim (not reviewing)
On 2013/06/27 18:46:07, rlarocque wrote: > https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc > File sync/engine/syncer.cc (right): > > https://codereview.chromium.org/17052007/diff/68001/sync/engine/syncer.cc#newcode143 > ...
7 years, 5 months ago (2013-07-01 17:35:46 UTC) #22
rlarocque
After consulting with chromium-dev, I've decided to take your advice. I've refactored the syncer code ...
7 years, 5 months ago (2013-07-02 20:05:23 UTC) #23
tim (not reviewing)
Cool. syncer.cc looks a lot better now! A few more similarly themed code-duplication-reduction comments on ...
7 years, 5 months ago (2013-07-02 21:01:52 UTC) #24
rlarocque
Addressed comments. PTAL. https://codereview.chromium.org/17052007/diff/92001/sync/engine/download.cc File sync/engine/download.cc (right): https://codereview.chromium.org/17052007/diff/92001/sync/engine/download.cc#newcode198 sync/engine/download.cc:198: status->set_updates_request_types(request_types); On 2013/07/02 21:01:53, timsteele wrote: ...
7 years, 5 months ago (2013-07-02 22:20:24 UTC) #25
tim (not reviewing)
LGTM!
7 years, 5 months ago (2013-07-02 22:38:54 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rlarocque@chromium.org/17052007/86002
7 years, 5 months ago (2013-07-02 22:48:51 UTC) #27
commit-bot: I haz the power
7 years, 5 months ago (2013-07-03 03:44:21 UTC) #28
Message was sent while issue was closed.
Change committed as 209867

Powered by Google App Engine
This is Rietveld 408576698