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

Issue 386030: Relieve SyncerSession,SyncCycleState, SyncProcessState, SyncerSession, Syncer... (Closed)

Created:
11 years, 1 month ago by tim (not reviewing)
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com, ben+cc_chromium.org, Paul Godavari, idana, Paweł Hajdan Jr.
Visibility:
Public.

Description

Add browser_sync 'sessions' to relieve SyncCycleState, SyncProcessState, SyncerSession, SyncerStatus, and ConflictResolutionView of duty. Main impact is factors all status munging to 'StatusController', adds SyncSessionContext to wrap various engine parts needed by different components, removes duplicated methods by a factor of ~3 making it easier to reason about, and adds a 'Controller' to the session object to give a way to delegate session-global (i.e affecting any session) occurrences such as throttling. Also adds testing for 'HasMoreToSync' and other session related code. BUG=25266 TEST=SyncSessionTest(added), StatusControllerTest(added) various sync_unit_tests in this CL Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=32732

Patch Set 1 #

Total comments: 3

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 220

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 6

Patch Set 7 : '' #

Patch Set 8 : Hadn't saved some files in last snap. #

Patch Set 9 : '' #

Patch Set 10 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2481 lines, -2890 lines) Patch
M chrome/browser/sync/engine/all_status.h View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/sync/engine/all_status.cc View 1 2 3 4 5 6 7 8 9 3 chunks +18 lines, -16 lines 0 comments Download
M chrome/browser/sync/engine/apply_updates_command.h View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/apply_updates_command.cc View 1 2 3 4 5 6 7 8 9 2 chunks +10 lines, -5 lines 0 comments Download
M chrome/browser/sync/engine/apply_updates_command_unittest.cc View 1 2 3 4 5 6 7 8 9 7 chunks +47 lines, -37 lines 0 comments Download
M chrome/browser/sync/engine/build_and_process_conflict_sets_command.h View 1 2 3 4 5 6 7 8 9 1 chunk +21 lines, -14 lines 0 comments Download
M chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc View 1 2 3 4 5 6 7 8 9 14 chunks +51 lines, -42 lines 0 comments Download
M chrome/browser/sync/engine/build_commit_command.h View 1 2 3 4 5 6 7 8 9 2 chunks +4 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/build_commit_command.cc View 1 2 3 4 5 6 7 8 9 5 chunks +8 lines, -7 lines 0 comments Download
D chrome/browser/sync/engine/client_command_channel.h View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -31 lines 0 comments Download
D chrome/browser/sync/engine/conflict_resolution_view.h View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -105 lines 0 comments Download
D chrome/browser/sync/engine/conflict_resolution_view.cc View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -128 lines 0 comments Download
M chrome/browser/sync/engine/conflict_resolver.h View 1 2 3 4 5 6 7 8 9 4 chunks +9 lines, -14 lines 0 comments Download
M chrome/browser/sync/engine/conflict_resolver.cc View 1 2 3 4 5 6 7 8 9 9 chunks +24 lines, -22 lines 0 comments Download
M chrome/browser/sync/engine/download_updates_command.h View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/download_updates_command.cc View 1 2 3 4 5 6 7 8 9 2 chunks +12 lines, -9 lines 0 comments Download
M chrome/browser/sync/engine/get_commit_ids_command.h View 1 2 3 4 5 6 7 8 9 8 chunks +22 lines, -16 lines 0 comments Download
M chrome/browser/sync/engine/get_commit_ids_command.cc View 1 2 3 4 5 6 7 8 9 8 chunks +35 lines, -29 lines 0 comments Download
M chrome/browser/sync/engine/model_changing_syncer_command.h View 1 2 3 4 5 6 7 8 9 3 chunks +6 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/model_changing_syncer_command.cc View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/post_commit_message_command.h View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/sync/engine/post_commit_message_command.cc View 1 2 3 4 5 6 7 8 9 2 chunks +13 lines, -12 lines 0 comments Download
M chrome/browser/sync/engine/process_commit_response_command.h View 1 2 3 4 5 6 7 8 9 2 chunks +7 lines, -12 lines 0 comments Download
M chrome/browser/sync/engine/process_commit_response_command.cc View 1 2 3 4 5 6 7 8 9 9 chunks +39 lines, -33 lines 0 comments Download
M chrome/browser/sync/engine/process_updates_command.h View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/process_updates_command.cc View 1 2 3 4 5 6 7 8 9 5 chunks +22 lines, -16 lines 0 comments Download
M chrome/browser/sync/engine/resolve_conflicts_command.h View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/resolve_conflicts_command.cc View 1 2 3 4 5 6 7 8 9 2 chunks +10 lines, -7 lines 0 comments Download
D chrome/browser/sync/engine/sync_cycle_state.h View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -247 lines 0 comments Download
D chrome/browser/sync/engine/sync_process_state.h View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -317 lines 0 comments Download
D chrome/browser/sync/engine/sync_process_state.cc View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -287 lines 0 comments Download
M chrome/browser/sync/engine/syncapi.cc View 1 2 3 4 5 6 7 8 9 10 chunks +17 lines, -24 lines 0 comments Download
M chrome/browser/sync/engine/syncer.h View 1 2 3 4 5 6 7 8 9 6 chunks +25 lines, -56 lines 0 comments Download
M chrome/browser/sync/engine/syncer.cc View 1 2 3 4 5 6 7 8 9 10 chunks +59 lines, -79 lines 0 comments Download
M chrome/browser/sync/engine/syncer_command.h View 1 2 3 4 5 6 7 8 9 3 chunks +7 lines, -5 lines 0 comments Download
M chrome/browser/sync/engine/syncer_command.cc View 1 2 3 4 5 6 7 8 9 1 chunk +19 lines, -19 lines 0 comments Download
M chrome/browser/sync/engine/syncer_end_command.h View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/syncer_end_command.cc View 1 2 3 4 5 6 7 8 9 3 chunks +11 lines, -11 lines 0 comments Download
M chrome/browser/sync/engine/syncer_proto_util.h View 1 2 3 4 5 6 7 8 9 3 chunks +6 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/syncer_proto_util.cc View 1 2 3 4 5 6 7 8 9 6 chunks +10 lines, -7 lines 0 comments Download
D chrome/browser/sync/engine/syncer_session.h View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -354 lines 0 comments Download
D chrome/browser/sync/engine/syncer_status.h View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -213 lines 0 comments Download
D chrome/browser/sync/engine/syncer_status.cc View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -15 lines 0 comments Download
M chrome/browser/sync/engine/syncer_thread.h View 1 2 3 4 5 6 7 8 9 7 chunks +27 lines, -44 lines 0 comments Download
M chrome/browser/sync/engine/syncer_thread.cc View 1 2 3 4 5 6 7 8 9 10 chunks +44 lines, -95 lines 0 comments Download
D chrome/browser/sync/engine/syncer_thread_timed_stop.h View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -53 lines 0 comments Download
D chrome/browser/sync/engine/syncer_thread_timed_stop.cc View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -121 lines 0 comments Download
M chrome/browser/sync/engine/syncer_thread_unittest.cc View 1 2 3 4 5 6 7 8 9 7 chunks +39 lines, -17 lines 0 comments Download
M chrome/browser/sync/engine/syncer_types.h View 1 2 3 4 5 6 7 8 9 3 chunks +9 lines, -4 lines 0 comments Download
M chrome/browser/sync/engine/syncer_unittest.cc View 1 2 3 4 5 6 7 8 9 136 chunks +272 lines, -309 lines 0 comments Download
M chrome/browser/sync/engine/update_applicator.h View 1 2 3 4 5 6 7 8 9 2 chunks +9 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/update_applicator.cc View 1 2 3 4 5 6 7 8 9 2 chunks +8 lines, -5 lines 0 comments Download
M chrome/browser/sync/engine/verify_updates_command.h View 1 2 3 4 5 6 7 8 9 2 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/sync/engine/verify_updates_command.cc View 1 2 3 4 5 6 7 8 9 3 chunks +6 lines, -5 lines 0 comments Download
A chrome/browser/sync/sessions/session_state.h View 3 4 1 chunk +214 lines, -0 lines 0 comments Download
A chrome/browser/sync/sessions/session_state.cc View 3 4 1 chunk +186 lines, -0 lines 0 comments Download
A chrome/browser/sync/sessions/status_controller.h View 3 4 1 chunk +159 lines, -0 lines 0 comments Download
A chrome/browser/sync/sessions/status_controller.cc View 3 4 5 6 1 chunk +179 lines, -0 lines 0 comments Download
A chrome/browser/sync/sessions/status_controller_unittest.cc View 3 4 1 chunk +236 lines, -0 lines 0 comments Download
A chrome/browser/sync/sessions/sync_session.h View 3 4 5 6 1 chunk +153 lines, -0 lines 0 comments Download
A chrome/browser/sync/sessions/sync_session.cc View 3 4 5 6 7 1 chunk +58 lines, -0 lines 0 comments Download
A chrome/browser/sync/sessions/sync_session_context.h View 3 4 1 chunk +170 lines, -0 lines 0 comments Download
A chrome/browser/sync/sessions/sync_session_unittest.cc View 3 4 5 6 1 chunk +167 lines, -0 lines 0 comments Download
M chrome/browser/sync/syncable/blob.h View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome.gyp View 1 2 3 4 5 6 7 8 5 chunks +9 lines, -11 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
tim (not reviewing)
11 years, 1 month ago (2009-11-13 23:45:48 UTC) #1
ncarter (slow)
http://codereview.chromium.org/386030/diff/1/29 File chrome/browser/sync/engine/all_status.cc (right): http://codereview.chromium.org/386030/diff/1/29#newcode96 Line 96: sessions::SyncSessionSnapshot* snapshot(event.snapshot); Use = for initialization of a ...
11 years, 1 month ago (2009-11-14 00:13:17 UTC) #2
tesigoadondequieras_gmail.com
Remover ----- Original Message ----- From: <nick@chromium.org> To: <tim@chromium.org>; <chron@chromium.org> Cc: <chromium-reviews@googlegroups.com>; <ben+cc@chromium.org>; <paul@chromium.org>; <idana@chromium.org>; ...
11 years, 1 month ago (2009-11-14 00:15:37 UTC) #3
tim (not reviewing)
Please see the description. I mention that this CL requires the other. I wanted to ...
11 years, 1 month ago (2009-11-14 00:47:01 UTC) #4
tim (not reviewing)
http://codereview.chromium.org/386030/diff/1/29 File chrome/browser/sync/engine/all_status.cc (right): http://codereview.chromium.org/386030/diff/1/29#newcode96 Line 96: sessions::SyncSessionSnapshot* snapshot(event.snapshot); On 2009/11/14 00:13:17, nick wrote: > ...
11 years, 1 month ago (2009-11-16 16:41:17 UTC) #5
ncarter (slow)
I see my confusion; you said 'This requires http://codereview.chromium.org/385103 ' but I think you meant ...
11 years, 1 month ago (2009-11-16 16:47:57 UTC) #6
tim (not reviewing)
As you wish.
11 years, 1 month ago (2009-11-16 17:05:47 UTC) #7
chron_chromium.org
http://codereview.chromium.org/386030/diff/4002/9028 File chrome/browser/sync/engine/all_status.cc (right): http://codereview.chromium.org/386030/diff/4002/9028#newcode104 Line 104: // Show a syncer as syncing if it's ...
11 years, 1 month ago (2009-11-17 23:09:17 UTC) #8
ncarter (slow)
It only took me 12 hours to review this change. http://codereview.chromium.org/386030/diff/4002/9016 File chrome/browser/sync/engine/apply_updates_command_unittest.cc (right): http://codereview.chromium.org/386030/diff/4002/9016#newcode29 ...
11 years, 1 month ago (2009-11-18 00:21:40 UTC) #9
tim (not reviewing)
On Tue, Nov 17, 2009 at 4:21 PM, <nick@chromium.org> wrote: > It only took me ...
11 years, 1 month ago (2009-11-18 05:51:36 UTC) #10
tim (not reviewing)
Brace for impact. http://codereview.chromium.org/386030/diff/4002/9028 File chrome/browser/sync/engine/all_status.cc (right): http://codereview.chromium.org/386030/diff/4002/9028#newcode104 Line 104: // Show a syncer as ...
11 years, 1 month ago (2009-11-19 04:08:20 UTC) #11
ncarter (slow)
LGTM after you respond to the following (particularly the question about the snapshot) http://codereview.chromium.org/386030/diff/4002/9032 File ...
11 years, 1 month ago (2009-11-20 01:29:54 UTC) #12
ncarter (slow)
Also: You must fix the trybots.
11 years, 1 month ago (2009-11-20 01:30:40 UTC) #13
tim (not reviewing)
On 2009/11/20 01:30:40, nick wrote: > Also: You must fix the trybots. All done, also ...
11 years, 1 month ago (2009-11-20 02:13:54 UTC) #14
tim (not reviewing)
Gah, here are my comments. http://codereview.chromium.org/386030/diff/4002/9032 File chrome/browser/sync/engine/syncer_proto_util.cc (right): http://codereview.chromium.org/386030/diff/4002/9032#newcode157 Line 157: session->controller()->OnSilencedUntil(base::TimeTicks::Now() + On ...
11 years, 1 month ago (2009-11-20 02:14:18 UTC) #15
Fred
11 years, 1 month ago (2009-11-22 20:48:51 UTC) #16
Drive-by.

Now that this is checked in, you should make a follow-up changelist to clean up
all the lint errors.

Watch out for gcc's signed/unsigned warnings when changing EXPECT_TRUE to
EXPECT_EQ!

On 2009/11/20 02:14:18, timsteele wrote:
> Gah, here are my comments.
> 
> http://codereview.chromium.org/386030/diff/4002/9032
> File chrome/browser/sync/engine/syncer_proto_util.cc (right):
> 
> http://codereview.chromium.org/386030/diff/4002/9032#newcode157
> Line 157: session->controller()->OnSilencedUntil(base::TimeTicks::Now() +
> On 2009/11/20 01:29:55, nick wrote:
> > On 2009/11/19 04:08:21, timsteele wrote:
> > > On 2009/11/17 23:09:17, http://chron_chromium.org wrote:
> > > > What's the difference between controller and status controller?
> > > 
> > > The former is SyncSession::Controller; an external entity that controls
the
> > > session and session initiation, that the session can delegate to when a
> > > session-global action must absolutely be taken (see comment in
> > sync_session.h).
> > > I had named it 'Delegate' before, akin to URLRequest::Delegate and perhaps
> > more
> > > common lingo in Chrome. Maybe I should name it back.
> > > 
> > > OTOH, SyncSession Is Composed Of (in the UML sense) a StatusController (or
> > > 'SessionStateController') which is more of an MVC type controller for the
> > model
> > > data in session_state.
> > > 
> > 
> > I suggest not obsessing over the names, but I think having two Controllers
> with
> > very different responsibilities is a potential source of confusion.
> 
> Made SyncSession::Controller SyncSession::Delegate instead and updated
comments.
> 
> http://codereview.chromium.org/386030/diff/4002/9021
> File chrome/browser/sync/engine/syncer_thread_unittest.cc (right):
> 
> http://codereview.chromium.org/386030/diff/4002/9021#newcode192
> Line 192: SyncSessionContext* context = new SyncSessionContext(NULL, NULL,
> NULL);
> On 2009/11/20 01:29:55, nick wrote:
> > On 2009/11/19 04:08:21, timsteele wrote:
> > > On 2009/11/17 23:09:17, http://chron_chromium.org wrote:
> > > > Would it make sense to have a default constructor?
> > > 
> > > The class would then have multiple constructors, and style guide says not
to
> > > overload to simulate default parameters.
> > >
> >
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Functi...
> > 
> > You can, however, use the named constructor idiom.
> 
> Frankly, I like the explicitness in this case and since this ctor would only
be
> useful for unittests I don't want to add it.
> 
> http://codereview.chromium.org/386030/diff/4002/9007
> File chrome/browser/sync/engine/syncer_unittest.cc (right):
> 
> http://codereview.chromium.org/386030/diff/4002/9007#newcode346
> Line 346: void FailTest(const std::string& msg){
> On 2009/11/20 01:29:55, nick wrote:
> > On 2009/11/19 04:08:21, timsteele wrote:
> > > On 2009/11/17 23:09:17, http://chron_chromium.org wrote:
> > > > Is this better than the FAIL() << MSG?
> > > 
> > > No, but it's needed because you can't call ASSERT_* or FAIL from non-void
> > > methods. (The macros are designed to be called from TEST_Fs which are void
> and
> > > do 'return;', so you get a compile error if your method returns bool for
> > > example, which IsSyncingCurrentlySilenced does).
> > 
> > What you're looking for is ADD_FAILURE().  It logs a failure like FAIL(),
> > without returning.
> 
> Awesome! used that instead.
> 
> http://codereview.chromium.org/386030/diff/4002/9063
> File chrome/browser/sync/sessions/status_controller.cc (right):
> 
> http://codereview.chromium.org/386030/diff/4002/9063#newcode22
> Line 22: template <class FieldType, class DirtyableContainer>
> On 2009/11/20 01:29:55, nick wrote:
> > On 2009/11/19 04:08:21, timsteele wrote:
> > > On 2009/11/18 00:21:40, nick wrote:
> > > > nit: i'd use 'typename FieldType' since it's often bool/int.
> > > 
> > > Done.
> > 
> > Not done.
> 
> Done.
> 
> http://codereview.chromium.org/386030/diff/13001/13003
> File chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc
> (right):
> 
> http://codereview.chromium.org/386030/diff/13001/13003#newcode50
> Line 50: session->context()->resolver(), session->status_controller());
> On 2009/11/20 01:29:55, nick wrote:
> > Reduce indentation.
> 
> Done.
> 
> http://codereview.chromium.org/386030/diff/13001/13007
> File chrome/browser/sync/engine/syncer_command.cc (right):
> 
> http://codereview.chromium.org/386030/diff/13001/13007#newcode34
> Line 34: const sessions::SyncSessionSnapshot&
snapshot(session->TakeSnapshot());
> On 2009/11/20 01:29:55, nick wrote:
> > On 2009/11/19 04:08:21, timsteele wrote:
> > > On 2009/11/18 00:21:40, nick wrote:
> > > > Why make a copy to take a snapshot, if it's going to be consumed
> > synchronously
> > > > by the listeners?
> > > 
> > > Done.
> > 
> > You didn't answer the question.
> 
> I removed the copy, though.  Unless you're referring to the internal copy of
the
> fields in SyncerStatus and the counters in ErrorCounters done inside
> TakeSnapshot.  I had a const& originally, but decided the true immutability of
> the snapshot was a nice property; for example, event though this is consumed
> synchronously, it's totally possible to cause some event to happen (or
directly
> modify the SyncSession object) that would cause the values referred to by the
> const& references in the snapshot to change from under you.  This way, const
> does not lie; it is strictly immutable.  As a side note it's also more
flexible
> in that we could, if we wanted in the future, kick a Snapshot to the UI thread
> for something like aboot:sync or other UI purposes, instead of going through
all
> the intermediaries we do now, and this way it would "just work".
> 
> http://codereview.chromium.org/386030/diff/13001/13025
> File chrome/browser/sync/engine/syncer_command.h (right):
> 
> http://codereview.chromium.org/386030/diff/13001/13025#newcode38
> Line 38: private:
> On 2009/11/20 01:29:55, nick wrote:
> > On 2009/11/19 04:08:21, timsteele wrote:
> > > On 2009/11/18 00:21:40, nick wrote:
> > > > I wonder if it would improve things, if Execute stashed the session away
> as
> > a
> > > > member, and ExecuteImpl took no args.  This would get rid of a lot of
the
> > > > passing-around we do.
> > > 
> > > This might be nice, I agree. Does anything call Execute repatedly and
change
> > > state in between? I seem to think the unittests do this? Or at least I
feel
> > like
> > > it would be a big change syntactically, could I try it in an isolated CL?
> > > 
> > 
> > Fine to defer.  AFAIK the only unittest that actually cares or knows about
> > SyncerCommands is the apply updates test.  All the tests in
syncer_unittest.cc
> > go through SyncShare.
> 
> Done.

Powered by Google App Engine
This is Rietveld 408576698