Chromium Code Reviews| Index: chrome/browser/sync/engine/sync_scheduler.h |
| diff --git a/chrome/browser/sync/engine/sync_scheduler.h b/chrome/browser/sync/engine/sync_scheduler.h |
| index 7a025fb0478b05d9f48d6417c6334e2cbc47e39d..d71eb87d4077180061f84a0a3c2e674db2170371 100644 |
| --- a/chrome/browser/sync/engine/sync_scheduler.h |
| +++ b/chrome/browser/sync/engine/sync_scheduler.h |
| @@ -62,14 +62,12 @@ class SyncScheduler : public sessions::SyncSession::Delegate, |
| // Calls Stop(). |
| virtual ~SyncScheduler(); |
| - typedef Callback0::Type ModeChangeCallback; |
| - |
| // 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, ModeChangeCallback* callback); |
| + void Start(Mode mode, const base::Closure& callback); |
| // Request that any running syncer task stop as soon as possible. |
| // This function can be called from any thread. Stop must still be |
| @@ -82,6 +80,11 @@ class SyncScheduler : public sessions::SyncSession::Delegate, |
| // Cancel all scheduled tasks. Can be called even if already stopped. |
| void Stop(); |
| + // TODO(akalin): Add callback parameters to Schedule* functions as |
| + // needed. In particular, we'd like to know when a nudge completes |
| + // (or fails) so that we can acknowledge any invalidations that |
| + // triggered the nudge. |
|
tim (not reviewing)
2011/08/26 12:41:40
So, one of the "future todos / open questions" in
|
| + |
| // The meat and potatoes. |
| void ScheduleNudge(const base::TimeDelta& delay, NudgeSource source, |
| const syncable::ModelTypeBitSet& types, |
| @@ -93,7 +96,7 @@ class SyncScheduler : public sessions::SyncSession::Delegate, |
| void ScheduleConfig(const syncable::ModelTypeBitSet& types, |
| sync_api::ConfigureReason reason); |
| void ScheduleClearUserData(); |
| - void ScheduleCleanupDisabledTypes(); |
| + void ScheduleCleanupDisabledTypes(const base::Closure& callback); |
|
tim (not reviewing)
2011/08/26 12:41:40
Please comment the new parameter.
|
| // Change status of notifications in the SyncSessionContext. |
| void set_notifications_enabled(bool notifications_enabled); |
| @@ -156,8 +159,9 @@ class SyncScheduler : public sessions::SyncSession::Delegate, |
| }; |
| SyncSessionJob(); |
| SyncSessionJob(SyncSessionJobPurpose purpose, base::TimeTicks start, |
| - linked_ptr<sessions::SyncSession> session, bool is_canary_job, |
| - const tracked_objects::Location& nudge_location); |
| + linked_ptr<sessions::SyncSession> session, |
| + bool is_canary_job, const base::Closure& on_success, |
| + const tracked_objects::Location& nudge_location); |
| ~SyncSessionJob(); |
| static const char* GetPurposeString(SyncSessionJobPurpose purpose); |
| @@ -165,6 +169,7 @@ class SyncScheduler : public sessions::SyncSession::Delegate, |
| base::TimeTicks scheduled_start; |
| linked_ptr<sessions::SyncSession> session; |
| bool is_canary_job; |
| + base::Closure on_success; |
|
tim (not reviewing)
2011/08/26 12:41:40
I like this. I'm still wrapping my head around wh
|
| // This is the location the job came from. Used for debugging. |
| // In case of multiple nudges getting coalesced this stores the |
| @@ -251,6 +256,7 @@ class SyncScheduler : public sessions::SyncSession::Delegate, |
| const base::TimeDelta& delay, |
| SyncSessionJob::SyncSessionJobPurpose purpose, |
| sessions::SyncSession* session, |
| + const base::Closure& on_success, |
| const tracked_objects::Location& from_here); |
| // Invoke the Syncer to perform a sync. |
| @@ -296,7 +302,7 @@ class SyncScheduler : public sessions::SyncSession::Delegate, |
| // 'Impl' here refers to real implementation of public functions, running on |
| // |thread_|. |
| - void StartImpl(Mode mode, ModeChangeCallback* callback); |
| + void StartImpl(Mode mode, const base::Closure& callback); |
| void ScheduleNudgeImpl( |
| const base::TimeDelta& delay, |
| sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
| @@ -306,7 +312,7 @@ class SyncScheduler : public sessions::SyncSession::Delegate, |
| const std::vector<ModelSafeWorker*>& workers, |
| const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); |
| void ScheduleClearUserDataImpl(); |
| - void ScheduleCleanupDisabledTypesImpl(); |
| + void ScheduleCleanupDisabledTypesImpl(const base::Closure& callback); |
| // Returns true if the client is currently in exponential backoff. |
| bool IsBackingOff() const; |