Index: sync/engine/sync_scheduler.h |
diff --git a/sync/engine/sync_scheduler.h b/sync/engine/sync_scheduler.h |
index dfd63e4a0b4306f79cf10154156e689f73c8a9b8..3019e0fc8eb45f46bfe2fb43b840890bd610411c 100644 |
--- a/sync/engine/sync_scheduler.h |
+++ b/sync/engine/sync_scheduler.h |
@@ -50,6 +50,31 @@ class SyncScheduler : public sessions::SyncSession::Delegate { |
NORMAL_MODE, |
}; |
+ struct ConfigureParams { |
+ ConfigureParams(); |
+ ConfigureParams( |
+ const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, |
+ const syncable::ModelTypeSet& types_to_config, |
+ const browser_sync::ModelSafeRoutingInfo& routing_info, |
+ bool need_cleanup, |
+ bool need_encryption_key, |
+ const base::Closure& ready_task); |
+ ~ConfigureParams(); |
+ |
+ // Source for the configuration. |
+ sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source; |
+ // The types that should be downloaded. |
+ syncable::ModelTypeSet types_to_config; |
+ // The new routing info (superset of types to be downloaded). |
+ ModelSafeRoutingInfo routing_info; |
+ // Whether we need to perform a CleanupDisabledTypes command. |
+ bool need_cleanup; |
+ // Whether we need to perform a GetKey command. |
+ bool need_encryption_key; |
+ // Callback to invoke on configuration completion. |
+ base::Closure ready_task; |
+ }; |
+ |
// All methods of SyncScheduler must be called on the same thread |
// (except for RequestEarlyExit()). |
@@ -63,10 +88,12 @@ class SyncScheduler : public sessions::SyncSession::Delegate { |
// Start the scheduler with the given mode. If the scheduler is |
// already started, switch to the given mode, although some |
- // scheduled tasks from the old mode may still run. If non-NULL, |
- // |callback| will be invoked when the mode has been changed to |
- // |mode|. Takes ownership of |callback|. |
- void Start(Mode mode, const base::Closure& callback); |
+ // scheduled tasks from the old mode may still run. |
+ void Start(Mode mode); |
+ |
+ // Performs the configuration tasks specified by |params|. |
+ // Note: must already be in CONFIGURATION mode. |
+ bool Configure(const ConfigureParams& params); |
// Request that any running syncer task stop as soon as possible and |
// cancel all scheduled tasks. This function can be called from any thread, |
@@ -85,18 +112,8 @@ class SyncScheduler : public sessions::SyncSession::Delegate { |
const syncable::ModelTypePayloadMap& types_with_payloads, |
const tracked_objects::Location& nudge_location); |
- // Note: The source argument of this function must come from the subset of |
- // GetUpdatesCallerInfo values related to configurations. |
- void ScheduleConfig( |
- syncable::ModelTypeSet types, |
- sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); |
void ScheduleClearUserData(); |
- // If this is called before Start(), the cleanup is guaranteed to |
- // happen before the Start finishes. |
- // |
- // TODO(akalin): Figure out how to test this. |
- void ScheduleCleanupDisabledTypes(); |
// Change status of notifications in the SyncSessionContext. |
void set_notifications_enabled(bool notifications_enabled); |
@@ -171,6 +188,7 @@ class SyncScheduler : public sessions::SyncSession::Delegate { |
base::TimeTicks scheduled_start; |
linked_ptr<sessions::SyncSession> session; |
bool is_canary_job; |
+ ConfigureParams config_params; |
// This is the location the job came from. Used for debugging. |
// In case of multiple nudges getting coalesced this stores the |
@@ -310,7 +328,7 @@ class SyncScheduler : public sessions::SyncSession::Delegate { |
// 'Impl' here refers to real implementation of public functions, running on |
// |thread_|. |
- void StartImpl(Mode mode, const base::Closure& callback); |
+ void StartImpl(Mode mode); |
void StopImpl(const base::Closure& callback); |
void ScheduleNudgeImpl( |
const base::TimeDelta& delay, |