| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 const std::map<ModelType, base::TimeDelta>& nudge_delays) override; | 79 const std::map<ModelType, base::TimeDelta>& nudge_delays) override; |
| 80 void OnReceivedClientInvalidationHintBufferSize(int size) override; | 80 void OnReceivedClientInvalidationHintBufferSize(int size) override; |
| 81 void OnSyncProtocolError( | 81 void OnSyncProtocolError( |
| 82 const SyncProtocolError& sync_protocol_error) override; | 82 const SyncProtocolError& sync_protocol_error) override; |
| 83 void OnReceivedGuRetryDelay(const base::TimeDelta& delay) override; | 83 void OnReceivedGuRetryDelay(const base::TimeDelta& delay) override; |
| 84 void OnReceivedMigrationRequest(ModelTypeSet types) override; | 84 void OnReceivedMigrationRequest(ModelTypeSet types) override; |
| 85 | 85 |
| 86 // Returns true if the client is currently in exponential backoff. | 86 // Returns true if the client is currently in exponential backoff. |
| 87 bool IsBackingOff() const; | 87 bool IsBackingOff() const; |
| 88 | 88 |
| 89 // Changes the default delay between nudge cycles. Model-type specific |
| 90 // overrides will still apply. This is made public so that nudge cycles can be |
| 91 // shortened in integration tests. |
| 92 void SetDefaultNudgeDelay(base::TimeDelta delay_ms); |
| 93 |
| 89 private: | 94 private: |
| 90 enum JobPriority { | 95 enum JobPriority { |
| 91 // Non-canary jobs respect exponential backoff. | 96 // Non-canary jobs respect exponential backoff. |
| 92 NORMAL_PRIORITY, | 97 NORMAL_PRIORITY, |
| 93 // Canary jobs bypass exponential backoff, so use with extreme caution. | 98 // Canary jobs bypass exponential backoff, so use with extreme caution. |
| 94 CANARY_PRIORITY | 99 CANARY_PRIORITY |
| 95 }; | 100 }; |
| 96 | 101 |
| 97 enum PollAdjustType { | 102 enum PollAdjustType { |
| 98 // Restart the poll interval. | 103 // Restart the poll interval. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 WaitInterval(Mode mode, base::TimeDelta length); | 137 WaitInterval(Mode mode, base::TimeDelta length); |
| 133 | 138 |
| 134 static const char* GetModeString(Mode mode); | 139 static const char* GetModeString(Mode mode); |
| 135 | 140 |
| 136 Mode mode; | 141 Mode mode; |
| 137 base::TimeDelta length; | 142 base::TimeDelta length; |
| 138 }; | 143 }; |
| 139 | 144 |
| 140 static const char* GetModeString(Mode mode); | 145 static const char* GetModeString(Mode mode); |
| 141 | 146 |
| 142 void SetDefaultNudgeDelay(base::TimeDelta delay_ms); | |
| 143 | |
| 144 // Invoke the syncer to perform a nudge job. | 147 // Invoke the syncer to perform a nudge job. |
| 145 void DoNudgeSyncCycleJob(JobPriority priority); | 148 void DoNudgeSyncCycleJob(JobPriority priority); |
| 146 | 149 |
| 147 // Invoke the syncer to perform a configuration job. | 150 // Invoke the syncer to perform a configuration job. |
| 148 void DoConfigurationSyncCycleJob(JobPriority priority); | 151 void DoConfigurationSyncCycleJob(JobPriority priority); |
| 149 | 152 |
| 150 void DoClearServerDataSyncCycleJob(JobPriority priority); | 153 void DoClearServerDataSyncCycleJob(JobPriority priority); |
| 151 | 154 |
| 152 // Helper function for Do{Nudge,Configuration,Poll}SyncCycleJob. | 155 // Helper function for Do{Nudge,Configuration,Poll}SyncCycleJob. |
| 153 void HandleSuccess(); | 156 void HandleSuccess(); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // A second factory specially for weak_handle_this_, to allow the handle | 318 // A second factory specially for weak_handle_this_, to allow the handle |
| 316 // to be const and alleviate threading concerns. | 319 // to be const and alleviate threading concerns. |
| 317 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; | 320 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; |
| 318 | 321 |
| 319 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 322 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
| 320 }; | 323 }; |
| 321 | 324 |
| 322 } // namespace syncer | 325 } // namespace syncer |
| 323 | 326 |
| 324 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_IMPL_H_ | 327 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_IMPL_H_ |
| OLD | NEW |