Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: sync/engine/sync_scheduler_impl.h

Issue 68013007: Channel all low lever scheduling calls through single function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FreshToken2.Step1.Cleanup
Patch Set: Feedback Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sync/engine/sync_scheduler_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // Invoke the syncer to perform a configuration job. 160 // Invoke the syncer to perform a configuration job.
161 void DoConfigurationSyncSessionJob(JobPriority priority); 161 void DoConfigurationSyncSessionJob(JobPriority priority);
162 162
163 // Helper function for Do{Nudge,Configuration}SyncSessionJob. 163 // Helper function for Do{Nudge,Configuration}SyncSessionJob.
164 void HandleFailure( 164 void HandleFailure(
165 const sessions::ModelNeutralState& model_neutral_state); 165 const sessions::ModelNeutralState& model_neutral_state);
166 166
167 // Invoke the Syncer to perform a poll job. 167 // Invoke the Syncer to perform a poll job.
168 void DoPollSyncSessionJob(); 168 void DoPollSyncSessionJob();
169 169
170 // Helper function to calculate poll interval.
171 base::TimeDelta GetPollInterval();
172
170 // Adjusts the poll timer to account for new poll interval, and possibly 173 // Adjusts the poll timer to account for new poll interval, and possibly
171 // resets the poll interval, depedning on the flag's value. 174 // resets the poll interval, depedning on the flag's value.
172 void AdjustPolling(PollAdjustType type); 175 void AdjustPolling(PollAdjustType type);
173 176
174 // Helper to restart waiting with |wait_interval_|'s timer. 177 // Helper to restart waiting with |wait_interval_|'s timer.
175 void RestartWaiting(); 178 void RestartWaiting();
176 179
177 // Determines if we're allowed to contact the server right now. 180 // Determines if we're allowed to contact the server right now.
178 bool CanRunJobNow(JobPriority priority); 181 bool CanRunJobNow(JobPriority priority);
179 182
(...skipping 17 matching lines...) Expand all
197 // Helper to signal listeners about changed retry time. 200 // Helper to signal listeners about changed retry time.
198 void NotifyRetryTime(base::Time retry_time); 201 void NotifyRetryTime(base::Time retry_time);
199 202
200 // Helper to signal listeners about changed throttled types. 203 // Helper to signal listeners about changed throttled types.
201 void NotifyThrottledTypesChanged(ModelTypeSet types); 204 void NotifyThrottledTypesChanged(ModelTypeSet types);
202 205
203 // Looks for pending work and, if it finds any, run this work at "canary" 206 // Looks for pending work and, if it finds any, run this work at "canary"
204 // priority. 207 // priority.
205 void TryCanaryJob(); 208 void TryCanaryJob();
206 209
210 void TrySyncSessionJob(JobPriority priority);
211
207 // Transitions out of the THROTTLED WaitInterval then calls TryCanaryJob(). 212 // Transitions out of the THROTTLED WaitInterval then calls TryCanaryJob().
208 void Unthrottle(); 213 void Unthrottle();
209 214
210 // Called when a per-type throttling interval expires. 215 // Called when a per-type throttling interval expires.
211 void TypeUnthrottle(base::TimeTicks unthrottle_time); 216 void TypeUnthrottle(base::TimeTicks unthrottle_time);
212 217
213 // Runs a normal nudge job when the scheduled timer expires. 218 // Runs a normal nudge job when the scheduled timer expires.
214 void PerformDelayedNudge(); 219 void PerformDelayedNudge();
215 220
216 // Attempts to exit EXPONENTIAL_BACKOFF by calling TryCanaryJob(). 221 // Attempts to exit EXPONENTIAL_BACKOFF by calling TryCanaryJob().
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 307
303 // crbug/251307. This is a workaround for M29. crbug/259913 tracks proper fix 308 // crbug/251307. This is a workaround for M29. crbug/259913 tracks proper fix
304 // for M30. 309 // for M30.
305 // The issue is that poll job runs after few hours of inactivity and therefore 310 // The issue is that poll job runs after few hours of inactivity and therefore
306 // will always fail with auth error because of expired access token. Once 311 // will always fail with auth error because of expired access token. Once
307 // fresh access token is requested poll job is not retried. 312 // fresh access token is requested poll job is not retried.
308 // The change is to remember that poll timer just fired and retry poll job 313 // The change is to remember that poll timer just fired and retry poll job
309 // after credentials are updated. 314 // after credentials are updated.
310 bool do_poll_after_credentials_updated_; 315 bool do_poll_after_credentials_updated_;
311 316
317 // TryJob might get called for multiple reasons. It should only call
318 // DoPollSyncSessionJob after some time since the last attempt.
319 // last_poll_reset_ keeps track of when was last attempt.
320 base::TimeTicks last_poll_reset_;
321
312 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_; 322 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_;
313 323
314 // A second factory specially for weak_handle_this_, to allow the handle 324 // A second factory specially for weak_handle_this_, to allow the handle
315 // to be const and alleviate threading concerns. 325 // to be const and alleviate threading concerns.
316 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; 326 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_;
317 327
318 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); 328 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl);
319 }; 329 };
320 330
321 } // namespace syncer 331 } // namespace syncer
322 332
323 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ 333 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | sync/engine/sync_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698