Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 | 306 |
| 307 // Server-tweakable sessions commit delay. | 307 // Server-tweakable sessions commit delay. |
| 308 base::TimeDelta sessions_commit_delay_; | 308 base::TimeDelta sessions_commit_delay_; |
| 309 | 309 |
| 310 // Periodic timer for polling. See AdjustPolling. | 310 // Periodic timer for polling. See AdjustPolling. |
| 311 base::RepeatingTimer<SyncSchedulerImpl> poll_timer_; | 311 base::RepeatingTimer<SyncSchedulerImpl> poll_timer_; |
| 312 | 312 |
| 313 // The mode of operation. | 313 // The mode of operation. |
| 314 Mode mode_; | 314 Mode mode_; |
| 315 | 315 |
| 316 // TODO(tim): Bug 26339. This needs to track more than just time I think, | 316 // Tracks the time that the last successful nudge or poll completed. This |
| 317 // since the nudges could be for different types. Current impl doesn't care. | 317 // is an optimization to avoid performing unnecessary POLLs (if a nudge |
| 318 base::TimeTicks last_sync_session_end_time_; | 318 // completed after the poll was scheduled to start) and unnecessary NUDGEs |
| 319 // (if a POLL [which uses all data types] took place *after* the nudge was | |
|
rlarocque
2012/08/20 19:02:20
Can a POLL really replace a NUDGE? What if the NU
| |
| 320 // supposed to start. Note that this does not result in dropping a NUDGE if | |
| 321 // another more recent NUDGE took place, because those NUDGEs would have | |
| 322 // been coalesced. The job will still be scheduled in that case (since we | |
| 323 // don't cancel outstanding jobs when coalescing), but this will be detected | |
| 324 // as a cancelled NUDGE by the session-equality check in DoSyncSessionJob). | |
| 325 // This excludes CONFIGURATION because 1) CONFIGURATION jobs are not subject | |
| 326 // to the freshness condition, and 2) a successful CONFIGURATION job should | |
| 327 // not trump a new NUDGE / POLL since there is no correlation between data | |
| 328 // types. | |
| 329 // TODO(tim): If NUDGEs are made to operate only on a subset of enabled types | |
| 330 // in the future, this will be insufficient as a NUDGE can't trump a full- | |
| 331 // datatype POLL. On the flip side, if POLLs are one day eliminated, this | |
| 332 // optimization is no longer necessary. | |
| 333 base::TimeTicks last_nudge_or_poll_end_time_; | |
| 319 | 334 |
| 320 // The latest connection code we got while trying to connect. | 335 // The latest connection code we got while trying to connect. |
| 321 HttpResponse::ServerConnectionCode connection_code_; | 336 HttpResponse::ServerConnectionCode connection_code_; |
| 322 | 337 |
| 323 // Tracks in-flight nudges so we can coalesce. | 338 // Tracks in-flight nudges so we can coalesce. |
| 324 scoped_ptr<SyncSessionJob> pending_nudge_; | 339 scoped_ptr<SyncSessionJob> pending_nudge_; |
| 325 | 340 |
| 326 // Current wait state. Null if we're not in backoff and not throttled. | 341 // Current wait state. Null if we're not in backoff and not throttled. |
| 327 scoped_ptr<WaitInterval> wait_interval_; | 342 scoped_ptr<WaitInterval> wait_interval_; |
| 328 | 343 |
| 329 scoped_ptr<BackoffDelayProvider> delay_provider_; | 344 scoped_ptr<BackoffDelayProvider> delay_provider_; |
| 330 | 345 |
| 331 // Invoked to run through the sync cycle. | 346 // Invoked to run through the sync cycle. |
| 332 scoped_ptr<Syncer> syncer_; | 347 scoped_ptr<Syncer> syncer_; |
| 333 | 348 |
| 334 sessions::SyncSessionContext *session_context_; | 349 sessions::SyncSessionContext *session_context_; |
| 335 | 350 |
| 336 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 351 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
| 337 }; | 352 }; |
| 338 | 353 |
| 339 } // namespace syncer | 354 } // namespace syncer |
| 340 | 355 |
| 341 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 356 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
| OLD | NEW |