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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 SaveConfigurationWhileThrottled); | 123 SaveConfigurationWhileThrottled); |
124 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, | 124 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, |
125 SaveNudgeWhileThrottled); | 125 SaveNudgeWhileThrottled); |
126 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, | 126 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, |
127 ContinueCanaryJobConfig); | 127 ContinueCanaryJobConfig); |
128 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, TransientPollFailure); | 128 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, TransientPollFailure); |
129 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, | 129 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, |
130 ServerConnectionChangeDuringBackoff); | 130 ServerConnectionChangeDuringBackoff); |
131 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, | 131 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, |
132 ConnectionChangeCanaryPreemptedByNudge); | 132 ConnectionChangeCanaryPreemptedByNudge); |
| 133 FRIEND_TEST_ALL_PREFIXES(BackoffTriggersSyncSchedulerTest, |
| 134 FailGetEncryptionKey); |
133 | 135 |
134 struct SYNC_EXPORT_PRIVATE WaitInterval { | 136 struct SYNC_EXPORT_PRIVATE WaitInterval { |
135 enum Mode { | 137 enum Mode { |
136 // Uninitialized state, should not be set in practice. | 138 // Uninitialized state, should not be set in practice. |
137 UNKNOWN = -1, | 139 UNKNOWN = -1, |
138 // We enter a series of increasingly longer WaitIntervals if we experience | 140 // We enter a series of increasingly longer WaitIntervals if we experience |
139 // repeated transient failures. We retry at the end of each interval. | 141 // repeated transient failures. We retry at the end of each interval. |
140 EXPONENTIAL_BACKOFF, | 142 EXPONENTIAL_BACKOFF, |
141 // A server-initiated throttled interval. We do not allow any syncing | 143 // A server-initiated throttled interval. We do not allow any syncing |
142 // during such an interval. | 144 // during such an interval. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 220 |
219 // Attempts to exit EXPONENTIAL_BACKOFF by calling TryCanaryJob(). | 221 // Attempts to exit EXPONENTIAL_BACKOFF by calling TryCanaryJob(). |
220 void ExponentialBackoffRetry(); | 222 void ExponentialBackoffRetry(); |
221 | 223 |
222 // Called when the root cause of the current connection error is fixed. | 224 // Called when the root cause of the current connection error is fixed. |
223 void OnServerConnectionErrorFixed(); | 225 void OnServerConnectionErrorFixed(); |
224 | 226 |
225 // Creates a session for a poll and performs the sync. | 227 // Creates a session for a poll and performs the sync. |
226 void PollTimerCallback(); | 228 void PollTimerCallback(); |
227 | 229 |
| 230 // Returns the set of types that are enabled and not currently throttled. |
| 231 ModelTypeSet GetEnabledAndUnthrottledTypes(); |
| 232 |
228 // Called as we are started to broadcast an initial session snapshot | 233 // Called as we are started to broadcast an initial session snapshot |
229 // containing data like initial_sync_ended. Important when the client starts | 234 // containing data like initial_sync_ended. Important when the client starts |
230 // up and does not need to perform an initial sync. | 235 // up and does not need to perform an initial sync. |
231 void SendInitialSnapshot(); | 236 void SendInitialSnapshot(); |
232 | 237 |
233 // This is used for histogramming and analysis of ScheduleNudge* APIs. | 238 // This is used for histogramming and analysis of ScheduleNudge* APIs. |
234 // SyncScheduler is the ultimate choke-point for all such invocations (with | 239 // SyncScheduler is the ultimate choke-point for all such invocations (with |
235 // and without InvalidationState variants, all NudgeSources, etc) and as such | 240 // and without InvalidationState variants, all NudgeSources, etc) and as such |
236 // is the most flexible place to do this bookkeeping. | 241 // is the most flexible place to do this bookkeeping. |
237 void UpdateNudgeTimeRecords(ModelTypeSet types); | 242 void UpdateNudgeTimeRecords(ModelTypeSet types); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 // take place during a sync cycle. We call this out because such violations | 310 // take place during a sync cycle. We call this out because such violations |
306 // could result in tight sync loops hitting sync servers. | 311 // could result in tight sync loops hitting sync servers. |
307 bool no_scheduling_allowed_; | 312 bool no_scheduling_allowed_; |
308 | 313 |
309 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 314 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
310 }; | 315 }; |
311 | 316 |
312 } // namespace syncer | 317 } // namespace syncer |
313 | 318 |
314 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 319 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
OLD | NEW |