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 COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_IMPL_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_IMPL_H_ |
6 #define COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_IMPL_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // containing data like initial_sync_ended. Important when the client starts | 209 // containing data like initial_sync_ended. Important when the client starts |
210 // up and does not need to perform an initial sync. | 210 // up and does not need to perform an initial sync. |
211 void SendInitialSnapshot(); | 211 void SendInitialSnapshot(); |
212 | 212 |
213 // This is used for histogramming and analysis of ScheduleNudge* APIs. | 213 // This is used for histogramming and analysis of ScheduleNudge* APIs. |
214 // SyncScheduler is the ultimate choke-point for all such invocations (with | 214 // SyncScheduler is the ultimate choke-point for all such invocations (with |
215 // and without InvalidationState variants, all NudgeSources, etc) and as such | 215 // and without InvalidationState variants, all NudgeSources, etc) and as such |
216 // is the most flexible place to do this bookkeeping. | 216 // is the most flexible place to do this bookkeeping. |
217 void UpdateNudgeTimeRecords(ModelTypeSet types); | 217 void UpdateNudgeTimeRecords(ModelTypeSet types); |
218 | 218 |
| 219 bool IsEarlierThanCurrentPendingJob(const base::TimeDelta& delay); |
| 220 |
219 // Used for logging. | 221 // Used for logging. |
220 const std::string name_; | 222 const std::string name_; |
221 | 223 |
222 // Set in Start(), unset in Stop(). | 224 // Set in Start(), unset in Stop(). |
223 bool started_; | 225 bool started_; |
224 | 226 |
225 // Modifiable versions of kDefaultLongPollIntervalSeconds which can be | 227 // Modifiable versions of kDefaultLongPollIntervalSeconds which can be |
226 // updated by the server. | 228 // updated by the server. |
227 base::TimeDelta syncer_short_poll_interval_seconds_; | 229 base::TimeDelta syncer_short_poll_interval_seconds_; |
228 base::TimeDelta syncer_long_poll_interval_seconds_; | 230 base::TimeDelta syncer_long_poll_interval_seconds_; |
229 | 231 |
230 // Timer for polling. Restarted on each successful poll, and when entering | 232 // Timer for polling. Restarted on each successful poll, and when entering |
231 // normal sync mode or exiting an error state. Not active in configuration | 233 // normal sync mode or exiting an error state. Not active in configuration |
232 // mode. | 234 // mode. |
233 base::OneShotTimer poll_timer_; | 235 base::OneShotTimer poll_timer_; |
234 | 236 |
235 // The mode of operation. | 237 // The mode of operation. |
236 Mode mode_; | 238 Mode mode_; |
237 | 239 |
238 // Current wait state. Null if we're not in backoff and not throttled. | 240 // Current wait state. Null if we're not in backoff and not throttled. |
239 std::unique_ptr<WaitInterval> wait_interval_; | 241 std::unique_ptr<WaitInterval> wait_interval_; |
240 | 242 |
241 std::unique_ptr<BackoffDelayProvider> delay_provider_; | 243 std::unique_ptr<BackoffDelayProvider> delay_provider_; |
242 | 244 |
| 245 // TODO(gangwu): http://crbug.com/714868 too many timers in this class, try to |
| 246 // reduce them. |
243 // The event that will wake us up. | 247 // The event that will wake us up. |
244 // When the whole client got throttling or backoff, we will delay this timer | 248 // When the whole client got throttling or backoff, we will delay this timer |
245 // as well. | 249 // as well. |
246 base::OneShotTimer pending_wakeup_timer_; | 250 base::OneShotTimer pending_wakeup_timer_; |
247 | 251 |
248 // Storage for variables related to an in-progress configure request. Note | 252 // Storage for variables related to an in-progress configure request. Note |
249 // that (mode_ != CONFIGURATION_MODE) \implies !pending_configure_params_. | 253 // that (mode_ != CONFIGURATION_MODE) \implies !pending_configure_params_. |
250 std::unique_ptr<ConfigurationParams> pending_configure_params_; | 254 std::unique_ptr<ConfigurationParams> pending_configure_params_; |
251 | 255 |
252 std::unique_ptr<ClearParams> pending_clear_params_; | 256 std::unique_ptr<ClearParams> pending_clear_params_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 bool ignore_auth_credentials_; | 288 bool ignore_auth_credentials_; |
285 | 289 |
286 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_; | 290 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_; |
287 | 291 |
288 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 292 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
289 }; | 293 }; |
290 | 294 |
291 } // namespace syncer | 295 } // namespace syncer |
292 | 296 |
293 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_IMPL_H_ | 297 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_IMPL_H_ |
OLD | NEW |