Chromium Code Reviews| 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 void SetDefaultNudgeDelay(base::TimeDelta delay_ms); | |
|
Nicolas Zea
2016/11/09 00:35:13
nit: Add comment explaining what this is for.
Patrick Noland
2016/11/10 22:13:00
Done.
| |
| 90 | |
| 89 private: | 91 private: |
| 90 enum JobPriority { | 92 enum JobPriority { |
| 91 // Non-canary jobs respect exponential backoff. | 93 // Non-canary jobs respect exponential backoff. |
| 92 NORMAL_PRIORITY, | 94 NORMAL_PRIORITY, |
| 93 // Canary jobs bypass exponential backoff, so use with extreme caution. | 95 // Canary jobs bypass exponential backoff, so use with extreme caution. |
| 94 CANARY_PRIORITY | 96 CANARY_PRIORITY |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 enum PollAdjustType { | 99 enum PollAdjustType { |
| 98 // Restart the poll interval. | 100 // Restart the poll interval. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 WaitInterval(Mode mode, base::TimeDelta length); | 134 WaitInterval(Mode mode, base::TimeDelta length); |
| 133 | 135 |
| 134 static const char* GetModeString(Mode mode); | 136 static const char* GetModeString(Mode mode); |
| 135 | 137 |
| 136 Mode mode; | 138 Mode mode; |
| 137 base::TimeDelta length; | 139 base::TimeDelta length; |
| 138 }; | 140 }; |
| 139 | 141 |
| 140 static const char* GetModeString(Mode mode); | 142 static const char* GetModeString(Mode mode); |
| 141 | 143 |
| 142 void SetDefaultNudgeDelay(base::TimeDelta delay_ms); | |
| 143 | |
| 144 // Invoke the syncer to perform a nudge job. | 144 // Invoke the syncer to perform a nudge job. |
| 145 void DoNudgeSyncCycleJob(JobPriority priority); | 145 void DoNudgeSyncCycleJob(JobPriority priority); |
| 146 | 146 |
| 147 // Invoke the syncer to perform a configuration job. | 147 // Invoke the syncer to perform a configuration job. |
| 148 void DoConfigurationSyncCycleJob(JobPriority priority); | 148 void DoConfigurationSyncCycleJob(JobPriority priority); |
| 149 | 149 |
| 150 void DoClearServerDataSyncCycleJob(JobPriority priority); | 150 void DoClearServerDataSyncCycleJob(JobPriority priority); |
| 151 | 151 |
| 152 // Helper function for Do{Nudge,Configuration,Poll}SyncCycleJob. | 152 // Helper function for Do{Nudge,Configuration,Poll}SyncCycleJob. |
| 153 void HandleSuccess(); | 153 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 | 315 // A second factory specially for weak_handle_this_, to allow the handle |
| 316 // to be const and alleviate threading concerns. | 316 // to be const and alleviate threading concerns. |
| 317 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; | 317 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; |
| 318 | 318 |
| 319 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 319 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
| 320 }; | 320 }; |
| 321 | 321 |
| 322 } // namespace syncer | 322 } // namespace syncer |
| 323 | 323 |
| 324 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_IMPL_H_ | 324 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_IMPL_H_ |
| OLD | NEW |