| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // Calls Stop(). | 38 // Calls Stop(). |
| 39 virtual ~SyncSchedulerImpl(); | 39 virtual ~SyncSchedulerImpl(); |
| 40 | 40 |
| 41 virtual void Start(Mode mode) OVERRIDE; | 41 virtual void Start(Mode mode) OVERRIDE; |
| 42 virtual bool ScheduleConfiguration( | 42 virtual bool ScheduleConfiguration( |
| 43 const ConfigurationParams& params) OVERRIDE; | 43 const ConfigurationParams& params) OVERRIDE; |
| 44 virtual void RequestStop(const base::Closure& callback) OVERRIDE; | 44 virtual void RequestStop(const base::Closure& callback) OVERRIDE; |
| 45 virtual void ScheduleNudgeAsync( | 45 virtual void ScheduleNudgeAsync( |
| 46 const base::TimeDelta& delay, | 46 const base::TimeDelta& delay, |
| 47 NudgeSource source, | 47 NudgeSource source, |
| 48 syncer::ModelTypeSet types, | 48 ModelTypeSet types, |
| 49 const tracked_objects::Location& nudge_location) OVERRIDE; | 49 const tracked_objects::Location& nudge_location) OVERRIDE; |
| 50 virtual void ScheduleNudgeWithPayloadsAsync( | 50 virtual void ScheduleNudgeWithPayloadsAsync( |
| 51 const base::TimeDelta& delay, NudgeSource source, | 51 const base::TimeDelta& delay, NudgeSource source, |
| 52 const syncer::ModelTypePayloadMap& types_with_payloads, | 52 const ModelTypePayloadMap& types_with_payloads, |
| 53 const tracked_objects::Location& nudge_location) OVERRIDE; | 53 const tracked_objects::Location& nudge_location) OVERRIDE; |
| 54 virtual void SetNotificationsEnabled(bool notifications_enabled) OVERRIDE; | 54 virtual void SetNotificationsEnabled(bool notifications_enabled) OVERRIDE; |
| 55 | 55 |
| 56 virtual base::TimeDelta GetSessionsCommitDelay() const OVERRIDE; | 56 virtual base::TimeDelta GetSessionsCommitDelay() const OVERRIDE; |
| 57 | 57 |
| 58 virtual void OnCredentialsUpdated() OVERRIDE; | 58 virtual void OnCredentialsUpdated() OVERRIDE; |
| 59 virtual void OnConnectionStatusChange() OVERRIDE; | 59 virtual void OnConnectionStatusChange() OVERRIDE; |
| 60 | 60 |
| 61 // SyncSession::Delegate implementation. | 61 // SyncSession::Delegate implementation. |
| 62 virtual void OnSilencedUntil( | 62 virtual void OnSilencedUntil( |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 // Coalesces the current job with the pending nudge. | 254 // Coalesces the current job with the pending nudge. |
| 255 void InitOrCoalescePendingJob(const SyncSessionJob& job); | 255 void InitOrCoalescePendingJob(const SyncSessionJob& job); |
| 256 | 256 |
| 257 // 'Impl' here refers to real implementation of public functions, running on | 257 // 'Impl' here refers to real implementation of public functions, running on |
| 258 // |thread_|. | 258 // |thread_|. |
| 259 void StopImpl(const base::Closure& callback); | 259 void StopImpl(const base::Closure& callback); |
| 260 void ScheduleNudgeImpl( | 260 void ScheduleNudgeImpl( |
| 261 const base::TimeDelta& delay, | 261 const base::TimeDelta& delay, |
| 262 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, | 262 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
| 263 const syncer::ModelTypePayloadMap& types_with_payloads, | 263 const ModelTypePayloadMap& types_with_payloads, |
| 264 bool is_canary_job, const tracked_objects::Location& nudge_location); | 264 bool is_canary_job, const tracked_objects::Location& nudge_location); |
| 265 | 265 |
| 266 // Returns true if the client is currently in exponential backoff. | 266 // Returns true if the client is currently in exponential backoff. |
| 267 bool IsBackingOff() const; | 267 bool IsBackingOff() const; |
| 268 | 268 |
| 269 // Helper to signal all listeners registered with |session_context_|. | 269 // Helper to signal all listeners registered with |session_context_|. |
| 270 void Notify(SyncEngineEvent::EventCause cause); | 270 void Notify(SyncEngineEvent::EventCause cause); |
| 271 | 271 |
| 272 // Callback to change backoff state. | 272 // Callback to change backoff state. |
| 273 void DoCanaryJob(); | 273 void DoCanaryJob(); |
| 274 void Unthrottle(); | 274 void Unthrottle(); |
| 275 | 275 |
| 276 // Executes the pending job. Called whenever an event occurs that may | 276 // Executes the pending job. Called whenever an event occurs that may |
| 277 // change conditions permitting a job to run. Like when network connection is | 277 // change conditions permitting a job to run. Like when network connection is |
| 278 // re-established, mode changes etc. | 278 // re-established, mode changes etc. |
| 279 void DoPendingJobIfPossible(bool is_canary_job); | 279 void DoPendingJobIfPossible(bool is_canary_job); |
| 280 | 280 |
| 281 // Called when the root cause of the current connection error is fixed. | 281 // Called when the root cause of the current connection error is fixed. |
| 282 void OnServerConnectionErrorFixed(); | 282 void OnServerConnectionErrorFixed(); |
| 283 | 283 |
| 284 // The pointer is owned by the caller. | 284 // The pointer is owned by the caller. |
| 285 syncer::sessions::SyncSession* CreateSyncSession( | 285 sessions::SyncSession* CreateSyncSession( |
| 286 const syncer::sessions::SyncSourceInfo& info); | 286 const sessions::SyncSourceInfo& info); |
| 287 | 287 |
| 288 // Creates a session for a poll and performs the sync. | 288 // Creates a session for a poll and performs the sync. |
| 289 void PollTimerCallback(); | 289 void PollTimerCallback(); |
| 290 | 290 |
| 291 // Used to update |connection_code_|, see below. | 291 // Used to update |connection_code_|, see below. |
| 292 void UpdateServerConnectionManagerStatus( | 292 void UpdateServerConnectionManagerStatus( |
| 293 HttpResponse::ServerConnectionCode code); | 293 HttpResponse::ServerConnectionCode code); |
| 294 | 294 |
| 295 // Called once the first time thread_ is started to broadcast an initial | 295 // Called once the first time thread_ is started to broadcast an initial |
| 296 // session snapshot containing data like initial_sync_ended. Important when | 296 // session snapshot containing data like initial_sync_ended. Important when |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 scoped_ptr<Syncer> syncer_; | 351 scoped_ptr<Syncer> syncer_; |
| 352 | 352 |
| 353 sessions::SyncSessionContext *session_context_; | 353 sessions::SyncSessionContext *session_context_; |
| 354 | 354 |
| 355 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 355 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
| 356 }; | 356 }; |
| 357 | 357 |
| 358 } // namespace syncer | 358 } // namespace syncer |
| 359 | 359 |
| 360 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 360 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
| OLD | NEW |