| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 bool started_; | 248 bool started_; |
| 249 | 249 |
| 250 // Modifiable versions of kDefaultLongPollIntervalSeconds which can be | 250 // Modifiable versions of kDefaultLongPollIntervalSeconds which can be |
| 251 // updated by the server. | 251 // updated by the server. |
| 252 base::TimeDelta syncer_short_poll_interval_seconds_; | 252 base::TimeDelta syncer_short_poll_interval_seconds_; |
| 253 base::TimeDelta syncer_long_poll_interval_seconds_; | 253 base::TimeDelta syncer_long_poll_interval_seconds_; |
| 254 | 254 |
| 255 // Timer for polling. Restarted on each successful poll, and when entering | 255 // Timer for polling. Restarted on each successful poll, and when entering |
| 256 // normal sync mode or exiting an error state. Not active in configuration | 256 // normal sync mode or exiting an error state. Not active in configuration |
| 257 // mode. | 257 // mode. |
| 258 base::OneShotTimer<SyncSchedulerImpl> poll_timer_; | 258 base::OneShotTimer poll_timer_; |
| 259 | 259 |
| 260 // The mode of operation. | 260 // The mode of operation. |
| 261 Mode mode_; | 261 Mode mode_; |
| 262 | 262 |
| 263 // Current wait state. Null if we're not in backoff and not throttled. | 263 // Current wait state. Null if we're not in backoff and not throttled. |
| 264 scoped_ptr<WaitInterval> wait_interval_; | 264 scoped_ptr<WaitInterval> wait_interval_; |
| 265 | 265 |
| 266 scoped_ptr<BackoffDelayProvider> delay_provider_; | 266 scoped_ptr<BackoffDelayProvider> delay_provider_; |
| 267 | 267 |
| 268 // The event that will wake us up. | 268 // The event that will wake us up. |
| 269 base::OneShotTimer<SyncSchedulerImpl> pending_wakeup_timer_; | 269 base::OneShotTimer pending_wakeup_timer_; |
| 270 | 270 |
| 271 // An event that fires when data type throttling expires. | 271 // An event that fires when data type throttling expires. |
| 272 base::OneShotTimer<SyncSchedulerImpl> type_unthrottle_timer_; | 272 base::OneShotTimer type_unthrottle_timer_; |
| 273 | 273 |
| 274 // Storage for variables related to an in-progress configure request. Note | 274 // Storage for variables related to an in-progress configure request. Note |
| 275 // that (mode_ != CONFIGURATION_MODE) \implies !pending_configure_params_. | 275 // that (mode_ != CONFIGURATION_MODE) \implies !pending_configure_params_. |
| 276 scoped_ptr<ConfigurationParams> pending_configure_params_; | 276 scoped_ptr<ConfigurationParams> pending_configure_params_; |
| 277 | 277 |
| 278 scoped_ptr<ClearParams> pending_clear_params_; | 278 scoped_ptr<ClearParams> pending_clear_params_; |
| 279 | 279 |
| 280 // 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. |
| 281 base::TimeTicks scheduled_nudge_time_; | 281 base::TimeTicks scheduled_nudge_time_; |
| 282 | 282 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 308 | 308 |
| 309 // next_sync_session_job_priority_ defines which priority will be used next | 309 // next_sync_session_job_priority_ defines which priority will be used next |
| 310 // time TrySyncSessionJobImpl is called. CANARY_PRIORITY allows syncer to run | 310 // time TrySyncSessionJobImpl is called. CANARY_PRIORITY allows syncer to run |
| 311 // even if scheduler is in exponential backoff. This is needed for events that | 311 // even if scheduler is in exponential backoff. This is needed for events that |
| 312 // have chance of resolving previous error (e.g. network connection change | 312 // have chance of resolving previous error (e.g. network connection change |
| 313 // after NETWORK_UNAVAILABLE error). | 313 // after NETWORK_UNAVAILABLE error). |
| 314 // It is reset back to NORMAL_PRIORITY on every call to TrySyncSessionJobImpl. | 314 // It is reset back to NORMAL_PRIORITY on every call to TrySyncSessionJobImpl. |
| 315 JobPriority next_sync_session_job_priority_; | 315 JobPriority next_sync_session_job_priority_; |
| 316 | 316 |
| 317 // One-shot timer for scheduling GU retry according to delay set by server. | 317 // One-shot timer for scheduling GU retry according to delay set by server. |
| 318 base::OneShotTimer<SyncSchedulerImpl> retry_timer_; | 318 base::OneShotTimer retry_timer_; |
| 319 | 319 |
| 320 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_; | 320 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_; |
| 321 | 321 |
| 322 // 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 |
| 323 // to be const and alleviate threading concerns. | 323 // to be const and alleviate threading concerns. |
| 324 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; | 324 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; |
| 325 | 325 |
| 326 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 326 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
| 327 }; | 327 }; |
| 328 | 328 |
| 329 } // namespace syncer | 329 } // namespace syncer |
| 330 | 330 |
| 331 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 331 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
| OLD | NEW |