diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-21 03:29:52 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-21 03:29:52 +0000 |
commit | 9ec27852a63c2d8fbcf4942629532af171f0a312 (patch) | |
tree | 5f22093d68d1699073439b40043383df8434da4f /chrome/browser/sync/engine/syncer_end_command.cc | |
parent | fb6be8f376c29a67ca134c71f3a4e3c414dd4c47 (diff) | |
download | chromium_src-9ec27852a63c2d8fbcf4942629532af171f0a312.zip chromium_src-9ec27852a63c2d8fbcf4942629532af171f0a312.tar.gz chromium_src-9ec27852a63c2d8fbcf4942629532af171f0a312.tar.bz2 |
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
Review URL: http://codereview.chromium.org/386030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/engine/syncer_end_command.cc')
-rw-r--r-- | chrome/browser/sync/engine/syncer_end_command.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/chrome/browser/sync/engine/syncer_end_command.cc b/chrome/browser/sync/engine/syncer_end_command.cc index 3ae002d..48bdc13 100644 --- a/chrome/browser/sync/engine/syncer_end_command.cc +++ b/chrome/browser/sync/engine/syncer_end_command.cc @@ -4,10 +4,8 @@ #include "chrome/browser/sync/engine/syncer_end_command.h" -#include "chrome/browser/sync/engine/conflict_resolution_view.h" -#include "chrome/browser/sync/engine/syncer_session.h" -#include "chrome/browser/sync/engine/syncer_status.h" #include "chrome/browser/sync/engine/syncer_types.h" +#include "chrome/browser/sync/sessions/sync_session.h" #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/util/event_sys-inl.h" @@ -16,15 +14,16 @@ namespace browser_sync { SyncerEndCommand::SyncerEndCommand() {} SyncerEndCommand::~SyncerEndCommand() {} -void SyncerEndCommand::ExecuteImpl(SyncerSession* session) { - SyncerStatus status(session); - status.set_syncing(false); +void SyncerEndCommand::ExecuteImpl(sessions::SyncSession* session) { + sessions::StatusController* status(session->status_controller()); + status->set_syncing(false); if (!session->HasMoreToSync()) { // This might be the first time we've fully completed a sync cycle. - DCHECK(session->got_zero_updates()); + DCHECK(status->got_zero_updates()); - syncable::ScopedDirLookup dir(session->dirman(), session->account_name()); + syncable::ScopedDirLookup dir(session->context()->directory_manager(), + session->context()->account_name()); if (!dir.good()) { LOG(ERROR) << "Scoped dir lookup failed!"; return; @@ -34,9 +33,10 @@ void SyncerEndCommand::ExecuteImpl(SyncerSession* session) { dir->set_initial_sync_ended(true); } - SyncerEvent event = { SyncerEvent::SYNC_CYCLE_ENDED }; - event.last_session = session; - session->syncer_event_channel()->NotifyListeners(event); + SyncerEvent event(SyncerEvent::SYNC_CYCLE_ENDED); + sessions::SyncSessionSnapshot snapshot(session->TakeSnapshot()); + event.snapshot = &snapshot; + session->context()->syncer_event_channel()->NotifyListeners(event); } } // namespace browser_sync |