Chromium Code Reviews| Index: chrome/browser/sync/engine/syncer_thread2.h |
| diff --git a/chrome/browser/sync/engine/syncer_thread2.h b/chrome/browser/sync/engine/syncer_thread2.h |
| index 3fbdd7f26d437f92a98009ef33933bf9ef1050a4..c5256d69cf0f41dce42b2b046a4849d36eebf229 100644 |
| --- a/chrome/browser/sync/engine/syncer_thread2.h |
| +++ b/chrome/browser/sync/engine/syncer_thread2.h |
| @@ -43,6 +43,15 @@ class SyncerThread : public sessions::SyncSession::Delegate, |
| NORMAL_MODE, |
| }; |
| + enum JobProcessDecision { |
| + // Indicates we should continue with the current job. |
| + CONTINUE, |
| + // Indicates that we should save it to be processed later. |
| + SAVE, |
| + // Indicates we should drop this job. |
| + DROP, |
| + }; |
| + |
| // Takes ownership of both |context| and |syncer|. |
| SyncerThread(sessions::SyncSessionContext* context, Syncer* syncer); |
| virtual ~SyncerThread(); |
| @@ -161,22 +170,35 @@ class SyncerThread : public sessions::SyncSession::Delegate, |
| // Helper to ScheduleNextSync in case of consecutive sync errors. |
| void HandleConsecutiveContinuationError(const SyncSessionJob& old_job); |
| - // Determines if it is legal to run a sync job for |purpose| at |
| - // |scheduled_start|. This checks current operational mode, backoff or |
| + // Determines if it is legal to run a sync |job|. |
| + // This checks current operational mode, backoff or |
| // throttling, freshness (so we don't make redundant syncs), and connection. |
| - bool ShouldRunJob(SyncSessionJobPurpose purpose, |
| - const base::TimeTicks& scheduled_start); |
| + bool ShouldRunJob(const SyncSessionJob& job); |
| + |
| + // Saves the job for future executio. |
| + void SaveJob(const SyncSessionJob& job); |
| + |
| + // Decide on whether to run, save or discard the job when we are in |
| + // back off mode. |
| + JobProcessDecision DecideOnJobWhileBackingOff(const SyncSessionJob& job); |
| + |
| + // Decide whether we should run, save or discard the job. |
| + JobProcessDecision ProcessJob(const SyncSessionJob& job); |
| + |
| + // Coalesces the current job with the pending nudge. |
| + void CoalescePendingNudge(const SyncSessionJob& job); |
| // 'Impl' here refers to real implementation of public functions, running on |
| // |thread_|. |
| void StartImpl(Mode mode, linked_ptr<ModeChangeCallback> callback); |
| void ScheduleNudgeImpl( |
| const base::TimeDelta& delay, |
| - NudgeSource source, |
| + sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
| const syncable::ModelTypePayloadMap& types_with_payloads, |
| - const tracked_objects::Location& nudge_location); |
| + bool is_canary_job, const tracked_objects::Location& nudge_location); |
| void ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info, |
| - const std::vector<ModelSafeWorker*>& workers); |
| + const std::vector<ModelSafeWorker*>& workers, |
| + const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); |
| void ScheduleClearUserDataImpl(); |
| // Returns true if the client is currently in exponential backoff. |
| @@ -189,6 +211,8 @@ class SyncerThread : public sessions::SyncSession::Delegate, |
| void DoCanaryJob(); |
| void Unthrottle(); |
| + void ScheduleCanaryJob(SyncSessionJob* job); |
| + |
| // Creates a session for a poll and performs the sync. |
| void PollTimerCallback(); |
| @@ -243,6 +267,9 @@ class SyncerThread : public sessions::SyncSession::Delegate, |
| scoped_ptr<sessions::SyncSessionContext> session_context_; |
| + bool saved_nudge_; |
|
tim (not reviewing)
2011/04/08 18:08:04
think you meant to remove these two fields.
lipalani1
2011/04/08 18:40:23
Done.
|
| + sync_pb::GetUpdatesCallerInfo::GetUpdatesSource saved_source_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(SyncerThread); |
| }; |