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 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/observer_list.h" | 18 #include "base/threading/non_thread_safe.h" |
19 #include "base/time.h" | 19 #include "base/time.h" |
20 #include "base/timer.h" | 20 #include "base/timer.h" |
21 #include "sync/base/sync_export.h" | 21 #include "sync/base/sync_export.h" |
22 #include "sync/engine/net/server_connection_manager.h" | 22 #include "sync/engine/net/server_connection_manager.h" |
23 #include "sync/engine/nudge_source.h" | 23 #include "sync/engine/nudge_source.h" |
24 #include "sync/engine/sync_scheduler.h" | 24 #include "sync/engine/sync_scheduler.h" |
25 #include "sync/engine/sync_session_job.h" | 25 #include "sync/engine/sync_session_job.h" |
26 #include "sync/engine/syncer.h" | 26 #include "sync/engine/syncer.h" |
27 #include "sync/internal_api/public/base/model_type_invalidation_map.h" | 27 #include "sync/internal_api/public/base/model_type_invalidation_map.h" |
28 #include "sync/internal_api/public/engine/polling_constants.h" | 28 #include "sync/internal_api/public/engine/polling_constants.h" |
29 #include "sync/internal_api/public/util/weak_handle.h" | 29 #include "sync/internal_api/public/util/weak_handle.h" |
30 #include "sync/sessions/sync_session.h" | 30 #include "sync/sessions/sync_session.h" |
31 #include "sync/sessions/sync_session_context.h" | 31 #include "sync/sessions/sync_session_context.h" |
32 | 32 |
33 namespace syncer { | 33 namespace syncer { |
34 | 34 |
35 class BackoffDelayProvider; | 35 class BackoffDelayProvider; |
36 | 36 |
37 class SYNC_EXPORT_PRIVATE SyncSchedulerImpl : public SyncScheduler { | 37 class SYNC_EXPORT_PRIVATE SyncSchedulerImpl |
| 38 : public SyncScheduler, |
| 39 public base::NonThreadSafe { |
38 public: | 40 public: |
39 // |name| is a display string to identify the syncer thread. Takes | 41 // |name| is a display string to identify the syncer thread. Takes |
40 // |ownership of |syncer| and |delay_provider|. | 42 // |ownership of |syncer| and |delay_provider|. |
41 SyncSchedulerImpl(const std::string& name, | 43 SyncSchedulerImpl(const std::string& name, |
42 BackoffDelayProvider* delay_provider, | 44 BackoffDelayProvider* delay_provider, |
43 sessions::SyncSessionContext* context, | 45 sessions::SyncSessionContext* context, |
44 Syncer* syncer); | 46 Syncer* syncer); |
45 | 47 |
46 // Calls Stop(). | 48 // Calls Stop(). |
47 virtual ~SyncSchedulerImpl(); | 49 virtual ~SyncSchedulerImpl(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 friend class SyncSchedulerTest; | 102 friend class SyncSchedulerTest; |
101 friend class SyncSchedulerWhiteboxTest; | 103 friend class SyncSchedulerWhiteboxTest; |
102 friend class SyncerTest; | 104 friend class SyncerTest; |
103 | 105 |
104 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, | 106 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, |
105 DropNudgeWhileExponentialBackOff); | 107 DropNudgeWhileExponentialBackOff); |
106 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, SaveNudge); | 108 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, SaveNudge); |
107 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, | 109 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, |
108 SaveNudgeWhileTypeThrottled); | 110 SaveNudgeWhileTypeThrottled); |
109 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, ContinueNudge); | 111 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, ContinueNudge); |
110 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, DropPoll); | |
111 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, ContinuePoll); | |
112 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, ContinueConfiguration); | 112 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, ContinueConfiguration); |
113 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, | 113 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, |
114 SaveConfigurationWhileThrottled); | 114 SaveConfigurationWhileThrottled); |
115 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, | 115 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, |
116 SaveNudgeWhileThrottled); | 116 SaveNudgeWhileThrottled); |
117 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, | 117 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, |
118 ContinueCanaryJobConfig); | 118 ContinueCanaryJobConfig); |
119 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerWhiteboxTest, | |
120 ContinueNudgeWhileExponentialBackOff); | |
121 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, TransientPollFailure); | 119 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, TransientPollFailure); |
122 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, GetInitialBackoffDelay); | |
123 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, | 120 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, |
124 ServerConnectionChangeDuringBackoff); | 121 ServerConnectionChangeDuringBackoff); |
125 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, | 122 FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, |
126 ConnectionChangeCanaryPreemptedByNudge); | 123 ConnectionChangeCanaryPreemptedByNudge); |
127 | 124 |
128 struct SYNC_EXPORT_PRIVATE WaitInterval { | 125 struct SYNC_EXPORT_PRIVATE WaitInterval { |
129 enum Mode { | 126 enum Mode { |
130 // Uninitialized state, should not be set in practice. | 127 // Uninitialized state, should not be set in practice. |
131 UNKNOWN = -1, | 128 UNKNOWN = -1, |
132 // A wait interval whose duration has been affected by exponential | 129 // We enter a series of increasingly longer WaitIntervals if we experience |
133 // backoff. | 130 // repeated transient failures. We retry at the end of each interval. |
134 // EXPONENTIAL_BACKOFF intervals are nudge-rate limited to 1 per interval. | |
135 EXPONENTIAL_BACKOFF, | 131 EXPONENTIAL_BACKOFF, |
136 // A server-initiated throttled interval. We do not allow any syncing | 132 // A server-initiated throttled interval. We do not allow any syncing |
137 // during such an interval. | 133 // during such an interval. |
138 THROTTLED, | 134 THROTTLED, |
139 }; | 135 }; |
140 WaitInterval(); | 136 WaitInterval(); |
141 ~WaitInterval(); | 137 ~WaitInterval(); |
142 WaitInterval(Mode mode, base::TimeDelta length); | 138 WaitInterval(Mode mode, base::TimeDelta length); |
143 | 139 |
144 static const char* GetModeString(Mode mode); | 140 static const char* GetModeString(Mode mode); |
145 | 141 |
146 Mode mode; | 142 Mode mode; |
147 | |
148 // This bool is set to true if we have observed a nudge during this | |
149 // interval and mode == EXPONENTIAL_BACKOFF. | |
150 bool had_nudge; | |
151 base::TimeDelta length; | 143 base::TimeDelta length; |
152 base::OneShotTimer<SyncSchedulerImpl> timer; | |
153 | |
154 // Configure jobs are saved only when backing off or throttling. So we | |
155 // expose the pointer here (does not own, similar to pending_nudge). | |
156 SyncSessionJob* pending_configure_job; | |
157 }; | 144 }; |
158 | 145 |
159 static const char* GetModeString(Mode mode); | 146 static const char* GetModeString(Mode mode); |
160 | 147 |
161 static const char* GetDecisionString(JobProcessDecision decision); | 148 static const char* GetDecisionString(JobProcessDecision decision); |
162 | 149 |
163 // Helper to cancel any existing delayed task and replace it with a new one. | 150 // Invoke the syncer to perform a non-POLL job. |
164 // It will not post any tasks if the scheduler is in a "stopped" state. | 151 bool DoSyncSessionJobImpl(scoped_ptr<SyncSessionJob> job, |
165 void PostDelayedTask(const tracked_objects::Location& from_here, | 152 JobPriority priority); |
166 const char* name, | |
167 const base::Closure& task, | |
168 base::TimeDelta delay); | |
169 | 153 |
170 // Invoke the Syncer to perform a non-poll job. | 154 // Invoke the syncer to perform a nudge job. |
171 bool DoSyncSessionJob(scoped_ptr<SyncSessionJob> job, | 155 void DoNudgeSyncSessionJob(JobPriority priority); |
172 JobPriority priority); | 156 |
| 157 // Invoke the syncer to perform a configuration job. |
| 158 bool DoConfigurationSyncSessionJob(JobPriority priority); |
173 | 159 |
174 // Returns whether or not it's safe to run a poll job at this time. | 160 // Returns whether or not it's safe to run a poll job at this time. |
175 bool ShouldPoll(); | 161 bool ShouldPoll(); |
176 | 162 |
177 // Invoke the Syncer to perform a poll job. | 163 // Invoke the Syncer to perform a poll job. |
178 void DoPollSyncSessionJob(scoped_ptr<SyncSessionJob> job); | 164 void DoPollSyncSessionJob(); |
179 | 165 |
180 // Called after the Syncer has performed the sync represented by |job|, to | 166 // Called after the Syncer has performed the sync represented by |job|, to |
181 // reset our state. |exited_prematurely| is true if the Syncer did not | 167 // reset our state. |exited_prematurely| is true if the Syncer did not |
182 // cycle from job.start_step() to job.end_step(), likely because the | 168 // cycle from job.start_step() to job.end_step(), likely because the |
183 // scheduler was forced to quit the job mid-way through. | 169 // scheduler was forced to quit the job mid-way through. |
184 bool FinishSyncSessionJob(SyncSessionJob* job, | 170 bool FinishSyncSessionJob(SyncSessionJob* job, |
185 bool exited_prematurely, | 171 bool exited_prematurely, |
186 sessions::SyncSession* session); | 172 sessions::SyncSession* session); |
187 | 173 |
188 // Helper to schedule retries of a failed configure or nudge job. | 174 // Helper to schedule retries of a failed configure or nudge job. |
189 void ScheduleNextSync(scoped_ptr<SyncSessionJob> finished_job, | 175 void ScheduleNextSync(scoped_ptr<SyncSessionJob> finished_job, |
190 sessions::SyncSession* session); | 176 sessions::SyncSession* session); |
191 | 177 |
192 // Helper to configure polling intervals. Used by Start and ScheduleNextSync. | 178 // Helper to configure polling intervals. Used by Start and ScheduleNextSync. |
193 void AdjustPolling(const SyncSessionJob* old_job); | 179 void AdjustPolling(const SyncSessionJob* old_job); |
194 | 180 |
195 // Helper to restart waiting with |wait_interval_|'s timer. | 181 // Helper to restart waiting with |wait_interval_|'s timer. |
196 void RestartWaiting(scoped_ptr<SyncSessionJob> job); | 182 void RestartWaiting(); |
197 | 183 |
198 // Helper to ScheduleNextSync in case of consecutive sync errors. | 184 // Helper to ScheduleNextSync in case of consecutive sync errors. |
199 void HandleContinuationError(scoped_ptr<SyncSessionJob> old_job, | 185 void HandleContinuationError(scoped_ptr<SyncSessionJob> old_job, |
200 sessions::SyncSession* session); | 186 sessions::SyncSession* session); |
201 | 187 |
202 // Decide whether we should CONTINUE, SAVE or DROP the job. | 188 // Decide whether we should CONTINUE, SAVE or DROP the job. |
203 JobProcessDecision DecideOnJob(const SyncSessionJob& job, | 189 JobProcessDecision DecideOnJob(const SyncSessionJob& job, |
204 JobPriority priority); | 190 JobPriority priority); |
205 | 191 |
206 // If DecideOnJob decides that |job| should be SAVEd, this function will | |
207 // carry out the task of actually "saving" (or coalescing) the job. | |
208 void HandleSaveJobDecision(scoped_ptr<SyncSessionJob> job); | |
209 | |
210 // Decide on whether to CONTINUE, SAVE or DROP the job when we are in | 192 // Decide on whether to CONTINUE, SAVE or DROP the job when we are in |
211 // backoff mode. | 193 // backoff mode. |
212 JobProcessDecision DecideWhileInWaitInterval(const SyncSessionJob& job, | 194 JobProcessDecision DecideWhileInWaitInterval(const SyncSessionJob& job, |
213 JobPriority priority); | 195 JobPriority priority); |
214 | 196 |
215 // 'Impl' here refers to real implementation of public functions, running on | 197 // 'Impl' here refers to real implementation of public functions, running on |
216 // |thread_|. | 198 // |thread_|. |
217 void StopImpl(const base::Closure& callback); | 199 void StopImpl(const base::Closure& callback); |
218 | 200 |
219 // If the scheduler's current state supports it, this will create a job based | 201 // If the scheduler's current state supports it, this will create a job based |
220 // on the passed in parameters and coalesce it with any other pending jobs, | 202 // on the passed in parameters and coalesce it with any other pending jobs, |
221 // then post a delayed task to run it. It may also choose to drop the job or | 203 // then post a delayed task to run it. It may also choose to drop the job or |
222 // save it for later, depending on the scheduler's current state. | 204 // save it for later, depending on the scheduler's current state. |
223 void ScheduleNudgeImpl( | 205 void ScheduleNudgeImpl( |
224 const base::TimeDelta& delay, | 206 const base::TimeDelta& delay, |
225 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, | 207 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
226 const ModelTypeInvalidationMap& invalidation_map, | 208 const ModelTypeInvalidationMap& invalidation_map, |
227 const tracked_objects::Location& nudge_location); | 209 const tracked_objects::Location& nudge_location); |
228 | 210 |
229 // Returns true if the client is currently in exponential backoff. | 211 // Returns true if the client is currently in exponential backoff. |
230 bool IsBackingOff() const; | 212 bool IsBackingOff() const; |
231 | 213 |
232 // Helper to signal all listeners registered with |session_context_|. | 214 // Helper to signal all listeners registered with |session_context_|. |
233 void Notify(SyncEngineEvent::EventCause cause); | 215 void Notify(SyncEngineEvent::EventCause cause); |
234 | 216 |
235 // Helper to signal listeners about changed retry time | 217 // Helper to signal listeners about changed retry time |
236 void NotifyRetryTime(base::Time retry_time); | 218 void NotifyRetryTime(base::Time retry_time); |
237 | 219 |
238 // Callback to change backoff state. |to_be_canary| in both cases is the job | 220 // Looks for pending work and, if it finds any, run this work at "canary" |
239 // that should be granted canary privileges. Note: it is possible that the | 221 // priority. |
240 // job that gets scheduled when this callback is scheduled is different from | 222 void TryCanaryJob(); |
241 // the job that will actually get executed, because other jobs may have been | |
242 // scheduled while we were waiting for the callback. | |
243 void DoCanaryJob(scoped_ptr<SyncSessionJob> to_be_canary); | |
244 void Unthrottle(scoped_ptr<SyncSessionJob> to_be_canary); | |
245 | 223 |
246 // Returns a pending job that has potential to run given the state of the | 224 // Transitions out of the THROTTLED WaitInterval then calls TryCanaryJob(). |
247 // scheduler, if it exists. Useful whenever an event occurs that may | 225 void Unthrottle(); |
248 // change conditions that permit a job to run, such as re-establishing | |
249 // network connection, auth refresh, mode changes etc. Note that the returned | |
250 // job may have been scheduled to run at a later time, or may have been | |
251 // unscheduled. In the former case, this will result in abandoning the old | |
252 // job and effectively cancelling it. | |
253 scoped_ptr<SyncSessionJob> TakePendingJobForCurrentMode(); | |
254 | 226 |
255 // Called when the root cause of the current connection error is fixed. | 227 // Called when the root cause of the current connection error is fixed. |
256 void OnServerConnectionErrorFixed(); | 228 void OnServerConnectionErrorFixed(); |
257 | 229 |
258 // Creates a session for a poll and performs the sync. | 230 // Creates a session for a poll and performs the sync. |
259 void PollTimerCallback(); | 231 void PollTimerCallback(); |
260 | 232 |
261 // Called once the first time thread_ is started to broadcast an initial | 233 // Called once the first time thread_ is started to broadcast an initial |
262 // session snapshot containing data like initial_sync_ended. Important when | 234 // session snapshot containing data like initial_sync_ended. Important when |
263 // the client starts up and does not need to perform an initial sync. | 235 // the client starts up and does not need to perform an initial sync. |
(...skipping 12 matching lines...) Expand all Loading... |
276 // A second factory specially for weak_handle_this_, to allow the handle | 248 // A second factory specially for weak_handle_this_, to allow the handle |
277 // to be const and alleviate threading concerns. | 249 // to be const and alleviate threading concerns. |
278 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; | 250 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; |
279 | 251 |
280 // For certain methods that need to worry about X-thread posting. | 252 // For certain methods that need to worry about X-thread posting. |
281 const WeakHandle<SyncSchedulerImpl> weak_handle_this_; | 253 const WeakHandle<SyncSchedulerImpl> weak_handle_this_; |
282 | 254 |
283 // Used for logging. | 255 // Used for logging. |
284 const std::string name_; | 256 const std::string name_; |
285 | 257 |
286 // The message loop this object is on. Almost all methods have to | |
287 // be called on this thread. | |
288 base::MessageLoop* const sync_loop_; | |
289 | |
290 // Set in Start(), unset in Stop(). | 258 // Set in Start(), unset in Stop(). |
291 bool started_; | 259 bool started_; |
292 | 260 |
293 // Modifiable versions of kDefaultLongPollIntervalSeconds which can be | 261 // Modifiable versions of kDefaultLongPollIntervalSeconds which can be |
294 // updated by the server. | 262 // updated by the server. |
295 base::TimeDelta syncer_short_poll_interval_seconds_; | 263 base::TimeDelta syncer_short_poll_interval_seconds_; |
296 base::TimeDelta syncer_long_poll_interval_seconds_; | 264 base::TimeDelta syncer_long_poll_interval_seconds_; |
297 | 265 |
298 // Server-tweakable sessions commit delay. | 266 // Server-tweakable sessions commit delay. |
299 base::TimeDelta sessions_commit_delay_; | 267 base::TimeDelta sessions_commit_delay_; |
300 | 268 |
301 // Periodic timer for polling. See AdjustPolling. | 269 // Periodic timer for polling. See AdjustPolling. |
302 base::RepeatingTimer<SyncSchedulerImpl> poll_timer_; | 270 base::RepeatingTimer<SyncSchedulerImpl> poll_timer_; |
303 | 271 |
304 // The mode of operation. | 272 // The mode of operation. |
305 Mode mode_; | 273 Mode mode_; |
306 | 274 |
307 // Tracks (does not own) in-flight nudges (scheduled or unscheduled), | |
308 // so we can coalesce. NULL if there is no pending nudge. | |
309 SyncSessionJob* pending_nudge_; | |
310 | |
311 // There are certain situations where we want to remember a nudge, but | |
312 // there is no well defined moment in time in the future when that nudge | |
313 // should run, e.g. if it requires a mode switch or updated auth credentials. | |
314 // This member will own NUDGE jobs in those cases, until an external event | |
315 // (mode switch or fixed auth) occurs to trigger a retry. Should be treated | |
316 // as opaque / not interacted with (i.e. we could build a wrapper to | |
317 // hide the type, but that's probably overkill). | |
318 scoped_ptr<SyncSessionJob> unscheduled_nudge_storage_; | |
319 | |
320 // Current wait state. Null if we're not in backoff and not throttled. | 275 // Current wait state. Null if we're not in backoff and not throttled. |
321 scoped_ptr<WaitInterval> wait_interval_; | 276 scoped_ptr<WaitInterval> wait_interval_; |
322 | 277 |
323 scoped_ptr<BackoffDelayProvider> delay_provider_; | 278 scoped_ptr<BackoffDelayProvider> delay_provider_; |
324 | 279 |
325 // We allow at most one PostedTask to be pending at one time. This is it. | 280 // The event that will wake us up. |
326 // We will cancel this task before starting a new one. | 281 base::OneShotTimer<SyncSchedulerImpl> pending_wakeup_timer_; |
327 base::CancelableClosure pending_wakeup_; | 282 |
| 283 // Pending configure job storage. Note that |
| 284 // (mode_ != CONFIGURATION_MODE) \implies !pending_configure_job_. |
| 285 scoped_ptr<SyncSessionJob> pending_configure_job_; |
| 286 |
| 287 // Pending nudge job storage. These jobs can exist in CONFIGURATION_MODE, but |
| 288 // they will be run only in NORMAL_MODE. |
| 289 scoped_ptr<SyncSessionJob> pending_nudge_job_; |
328 | 290 |
329 // Invoked to run through the sync cycle. | 291 // Invoked to run through the sync cycle. |
330 scoped_ptr<Syncer> syncer_; | 292 scoped_ptr<Syncer> syncer_; |
331 | 293 |
332 sessions::SyncSessionContext* session_context_; | 294 sessions::SyncSessionContext* session_context_; |
333 | 295 |
334 // A map tracking LOCAL NudgeSource invocations of ScheduleNudge* APIs, | 296 // A map tracking LOCAL NudgeSource invocations of ScheduleNudge* APIs, |
335 // organized by datatype. Each datatype that was part of the types requested | 297 // organized by datatype. Each datatype that was part of the types requested |
336 // in the call will have its TimeTicks value updated. | 298 // in the call will have its TimeTicks value updated. |
337 typedef std::map<ModelType, base::TimeTicks> ModelTypeTimeMap; | 299 typedef std::map<ModelType, base::TimeTicks> ModelTypeTimeMap; |
338 ModelTypeTimeMap last_local_nudges_by_model_type_; | 300 ModelTypeTimeMap last_local_nudges_by_model_type_; |
339 | 301 |
340 // Used as an "anti-reentrancy defensive assertion". | 302 // Used as an "anti-reentrancy defensive assertion". |
341 // While true, it is illegal for any new scheduling activity to take place. | 303 // While true, it is illegal for any new scheduling activity to take place. |
342 // Ensures that higher layers don't break this law in response to events that | 304 // Ensures that higher layers don't break this law in response to events that |
343 // take place during a sync cycle. We call this out because such violations | 305 // take place during a sync cycle. We call this out because such violations |
344 // could result in tight sync loops hitting sync servers. | 306 // could result in tight sync loops hitting sync servers. |
345 bool no_scheduling_allowed_; | 307 bool no_scheduling_allowed_; |
346 | 308 |
347 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 309 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
348 }; | 310 }; |
349 | 311 |
350 } // namespace syncer | 312 } // namespace syncer |
351 | 313 |
352 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 314 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
OLD | NEW |