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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 SyncSchedulerImpl(const std::string& name, | 46 SyncSchedulerImpl(const std::string& name, |
47 BackoffDelayProvider* delay_provider, | 47 BackoffDelayProvider* delay_provider, |
48 sessions::SyncSessionContext* context, | 48 sessions::SyncSessionContext* context, |
49 Syncer* syncer); | 49 Syncer* syncer); |
50 | 50 |
51 // Calls Stop(). | 51 // Calls Stop(). |
52 ~SyncSchedulerImpl() override; | 52 ~SyncSchedulerImpl() override; |
53 | 53 |
54 void Start(Mode mode, base::Time last_poll_time) override; | 54 void Start(Mode mode, base::Time last_poll_time) override; |
55 void ScheduleConfiguration(const ConfigurationParams& params) override; | 55 void ScheduleConfiguration(const ConfigurationParams& params) override; |
| 56 void ScheduleClearServerData(const ClearParams& params) override; |
56 void Stop() override; | 57 void Stop() override; |
57 void ScheduleLocalNudge( | 58 void ScheduleLocalNudge( |
58 ModelTypeSet types, | 59 ModelTypeSet types, |
59 const tracked_objects::Location& nudge_location) override; | 60 const tracked_objects::Location& nudge_location) override; |
60 void ScheduleLocalRefreshRequest( | 61 void ScheduleLocalRefreshRequest( |
61 ModelTypeSet types, | 62 ModelTypeSet types, |
62 const tracked_objects::Location& nudge_location) override; | 63 const tracked_objects::Location& nudge_location) override; |
63 void ScheduleInvalidationNudge( | 64 void ScheduleInvalidationNudge( |
64 syncer::ModelType type, | 65 syncer::ModelType type, |
65 scoped_ptr<InvalidationInterface> invalidation, | 66 scoped_ptr<InvalidationInterface> invalidation, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 static const char* GetModeString(Mode mode); | 145 static const char* GetModeString(Mode mode); |
145 | 146 |
146 void SetDefaultNudgeDelay(base::TimeDelta delay_ms); | 147 void SetDefaultNudgeDelay(base::TimeDelta delay_ms); |
147 | 148 |
148 // Invoke the syncer to perform a nudge job. | 149 // Invoke the syncer to perform a nudge job. |
149 void DoNudgeSyncSessionJob(JobPriority priority); | 150 void DoNudgeSyncSessionJob(JobPriority priority); |
150 | 151 |
151 // Invoke the syncer to perform a configuration job. | 152 // Invoke the syncer to perform a configuration job. |
152 void DoConfigurationSyncSessionJob(JobPriority priority); | 153 void DoConfigurationSyncSessionJob(JobPriority priority); |
153 | 154 |
| 155 void DoClearServerDataSyncSessionJob(JobPriority priority); |
| 156 |
154 // Helper function for Do{Nudge,Configuration,Poll}SyncSessionJob. | 157 // Helper function for Do{Nudge,Configuration,Poll}SyncSessionJob. |
155 void HandleSuccess(); | 158 void HandleSuccess(); |
156 | 159 |
157 // Helper function for Do{Nudge,Configuration,Poll}SyncSessionJob. | 160 // Helper function for Do{Nudge,Configuration,Poll}SyncSessionJob. |
158 void HandleFailure( | 161 void HandleFailure( |
159 const sessions::ModelNeutralState& model_neutral_state); | 162 const sessions::ModelNeutralState& model_neutral_state); |
160 | 163 |
161 // Invoke the Syncer to perform a poll job. | 164 // Invoke the Syncer to perform a poll job. |
162 void DoPollSyncSessionJob(); | 165 void DoPollSyncSessionJob(); |
163 | 166 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // The event that will wake us up. | 268 // The event that will wake us up. |
266 base::OneShotTimer<SyncSchedulerImpl> pending_wakeup_timer_; | 269 base::OneShotTimer<SyncSchedulerImpl> pending_wakeup_timer_; |
267 | 270 |
268 // An event that fires when data type throttling expires. | 271 // An event that fires when data type throttling expires. |
269 base::OneShotTimer<SyncSchedulerImpl> type_unthrottle_timer_; | 272 base::OneShotTimer<SyncSchedulerImpl> type_unthrottle_timer_; |
270 | 273 |
271 // Storage for variables related to an in-progress configure request. Note | 274 // Storage for variables related to an in-progress configure request. Note |
272 // that (mode_ != CONFIGURATION_MODE) \implies !pending_configure_params_. | 275 // that (mode_ != CONFIGURATION_MODE) \implies !pending_configure_params_. |
273 scoped_ptr<ConfigurationParams> pending_configure_params_; | 276 scoped_ptr<ConfigurationParams> pending_configure_params_; |
274 | 277 |
| 278 scoped_ptr<ClearParams> pending_clear_params_; |
| 279 |
275 // If we have a nudge pending to run soon, it will be listed here. | 280 // If we have a nudge pending to run soon, it will be listed here. |
276 base::TimeTicks scheduled_nudge_time_; | 281 base::TimeTicks scheduled_nudge_time_; |
277 | 282 |
278 // Keeps track of work that the syncer needs to handle. | 283 // Keeps track of work that the syncer needs to handle. |
279 sessions::NudgeTracker nudge_tracker_; | 284 sessions::NudgeTracker nudge_tracker_; |
280 | 285 |
281 // Invoked to run through the sync cycle. | 286 // Invoked to run through the sync cycle. |
282 scoped_ptr<Syncer> syncer_; | 287 scoped_ptr<Syncer> syncer_; |
283 | 288 |
284 sessions::SyncSessionContext* session_context_; | 289 sessions::SyncSessionContext* session_context_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // A second factory specially for weak_handle_this_, to allow the handle | 322 // A second factory specially for weak_handle_this_, to allow the handle |
318 // to be const and alleviate threading concerns. | 323 // to be const and alleviate threading concerns. |
319 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; | 324 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; |
320 | 325 |
321 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 326 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
322 }; | 327 }; |
323 | 328 |
324 } // namespace syncer | 329 } // namespace syncer |
325 | 330 |
326 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 331 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
OLD | NEW |