| Index: sync/engine/sync_scheduler_impl.h
|
| diff --git a/sync/engine/sync_scheduler_impl.h b/sync/engine/sync_scheduler_impl.h
|
| index 586ccdc363822f6d121e4334e945760c0b9df326..e5f3acf61d27aef8463e987beab557e914f059fc 100644
|
| --- a/sync/engine/sync_scheduler_impl.h
|
| +++ b/sync/engine/sync_scheduler_impl.h
|
| @@ -28,12 +28,16 @@
|
|
|
| namespace syncer {
|
|
|
| +class BackoffDelayProvider;
|
| +
|
| class SyncSchedulerImpl : public SyncScheduler {
|
| public:
|
| // |name| is a display string to identify the syncer thread. Takes
|
| - // |ownership of |syncer|.
|
| + // |ownership of |syncer| and |delay_provider|.
|
| SyncSchedulerImpl(const std::string& name,
|
| - sessions::SyncSessionContext* context, Syncer* syncer);
|
| + BackoffDelayProvider* delay_provider,
|
| + sessions::SyncSessionContext* context,
|
| + Syncer* syncer);
|
|
|
| // Calls Stop().
|
| virtual ~SyncSchedulerImpl();
|
| @@ -72,16 +76,6 @@ class SyncSchedulerImpl : public SyncScheduler {
|
| virtual void OnSyncProtocolError(
|
| const sessions::SyncSessionSnapshot& snapshot) OVERRIDE;
|
|
|
| - // DDOS avoidance function. Calculates how long we should wait before trying
|
| - // again after a failed sync attempt, where the last delay was |base_delay|.
|
| - // TODO(tim): Look at URLRequestThrottlerEntryInterface.
|
| - static base::TimeDelta GetRecommendedDelay(const base::TimeDelta& base_delay);
|
| -
|
| - // For integration tests only. Override initial backoff value.
|
| - // TODO(tim): Remove this, use command line flag and plumb through. Done
|
| - // this way to reduce diffs in hotfix.
|
| - static void ForceShortInitialBackoffRetry();
|
| -
|
| private:
|
| enum JobProcessDecision {
|
| // Indicates we should continue with the current job.
|
| @@ -150,17 +144,6 @@ class SyncSchedulerImpl : public SyncScheduler {
|
| FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, TransientPollFailure);
|
| FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, GetInitialBackoffDelay);
|
|
|
| - // A component used to get time delays associated with exponential backoff.
|
| - // Encapsulated into a class to facilitate testing.
|
| - class DelayProvider {
|
| - public:
|
| - DelayProvider();
|
| - virtual base::TimeDelta GetDelay(const base::TimeDelta& last_delay);
|
| - virtual ~DelayProvider();
|
| - private:
|
| - DISALLOW_COPY_AND_ASSIGN(DelayProvider);
|
| - };
|
| -
|
| struct WaitInterval {
|
| enum Mode {
|
| // Uninitialized state, should not be set in practice.
|
| @@ -234,11 +217,6 @@ class SyncSchedulerImpl : public SyncScheduler {
|
| // Helper to ScheduleNextSync in case of consecutive sync errors.
|
| void HandleContinuationError(const SyncSessionJob& old_job);
|
|
|
| - // Helper to calculate the initial value for exponential backoff.
|
| - // See possible values and comments in polling_constants.h.
|
| - base::TimeDelta GetInitialBackoffDelay(
|
| - const sessions::ModelNeutralState& state) const;
|
| -
|
| // Determines if it is legal to run |job| by checking current
|
| // operational mode, backoff or throttling, freshness
|
| // (so we don't make redundant syncs), and connection.
|
| @@ -348,7 +326,7 @@ class SyncSchedulerImpl : public SyncScheduler {
|
| // Current wait state. Null if we're not in backoff and not throttled.
|
| scoped_ptr<WaitInterval> wait_interval_;
|
|
|
| - scoped_ptr<DelayProvider> delay_provider_;
|
| + scoped_ptr<BackoffDelayProvider> delay_provider_;
|
|
|
| // Invoked to run through the sync cycle.
|
| scoped_ptr<Syncer> syncer_;
|
|
|