| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 5 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
| 6 #define SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 6 #define SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 const base::Closure& task); | 166 const base::Closure& task); |
| 167 void PostDelayedTask(const tracked_objects::Location& from_here, | 167 void PostDelayedTask(const tracked_objects::Location& from_here, |
| 168 const char* name, | 168 const char* name, |
| 169 const base::Closure& task, | 169 const base::Closure& task, |
| 170 base::TimeDelta delay); | 170 base::TimeDelta delay); |
| 171 | 171 |
| 172 // Helper to assemble a job and post a delayed task to sync. | 172 // Helper to assemble a job and post a delayed task to sync. |
| 173 void ScheduleSyncSessionJob(const tracked_objects::Location& loc, | 173 void ScheduleSyncSessionJob(const tracked_objects::Location& loc, |
| 174 scoped_ptr<SyncSessionJob> job); | 174 scoped_ptr<SyncSessionJob> job); |
| 175 | 175 |
| 176 // Invoke the Syncer to perform a sync. | 176 // Invoke the Syncer to perform a non-poll job. |
| 177 bool DoSyncSessionJob(scoped_ptr<SyncSessionJob> job, | 177 bool DoSyncSessionJob(scoped_ptr<SyncSessionJob> job, |
| 178 JobPriority priority); | 178 JobPriority priority); |
| 179 | 179 |
| 180 // Invoke the Syncer to perform a poll job. |
| 181 void DoPollSyncSessionJob(scoped_ptr<SyncSessionJob> job); |
| 182 |
| 180 // Called after the Syncer has performed the sync represented by |job|, to | 183 // Called after the Syncer has performed the sync represented by |job|, to |
| 181 // reset our state. |exited_prematurely| is true if the Syncer did not | 184 // reset our state. |exited_prematurely| is true if the Syncer did not |
| 182 // cycle from job.start_step() to job.end_step(), likely because the | 185 // cycle from job.start_step() to job.end_step(), likely because the |
| 183 // scheduler was forced to quit the job mid-way through. | 186 // scheduler was forced to quit the job mid-way through. |
| 184 bool FinishSyncSessionJob(scoped_ptr<SyncSessionJob> job, | 187 bool FinishSyncSessionJob(SyncSessionJob* job, |
| 185 bool exited_prematurely); | 188 bool exited_prematurely); |
| 186 | 189 |
| 187 // Helper to FinishSyncSessionJob to schedule the next sync operation. | 190 // Helper to schedule retries of a failed configure or nudge job. |
| 188 // |succeeded| carries the return value of |old_job|->Finish. | 191 void ScheduleNextSync(scoped_ptr<SyncSessionJob> finished_job); |
| 189 void ScheduleNextSync(scoped_ptr<SyncSessionJob> finished_job, | |
| 190 bool succeeded); | |
| 191 | 192 |
| 192 // Helper to configure polling intervals. Used by Start and ScheduleNextSync. | 193 // Helper to configure polling intervals. Used by Start and ScheduleNextSync. |
| 193 void AdjustPolling(const SyncSessionJob* old_job); | 194 void AdjustPolling(const SyncSessionJob* old_job); |
| 194 | 195 |
| 195 // Helper to restart waiting with |wait_interval_|'s timer. | 196 // Helper to restart waiting with |wait_interval_|'s timer. |
| 196 void RestartWaiting(scoped_ptr<SyncSessionJob> job); | 197 void RestartWaiting(scoped_ptr<SyncSessionJob> job); |
| 197 | 198 |
| 198 // Helper to ScheduleNextSync in case of consecutive sync errors. | 199 // Helper to ScheduleNextSync in case of consecutive sync errors. |
| 199 void HandleContinuationError(scoped_ptr<SyncSessionJob> old_job); | 200 void HandleContinuationError(scoped_ptr<SyncSessionJob> old_job); |
| 200 | 201 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // take place during a sync cycle. We call this out because such violations | 337 // take place during a sync cycle. We call this out because such violations |
| 337 // could result in tight sync loops hitting sync servers. | 338 // could result in tight sync loops hitting sync servers. |
| 338 bool no_scheduling_allowed_; | 339 bool no_scheduling_allowed_; |
| 339 | 340 |
| 340 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 341 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
| 341 }; | 342 }; |
| 342 | 343 |
| 343 } // namespace syncer | 344 } // namespace syncer |
| 344 | 345 |
| 345 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 346 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
| OLD | NEW |