| 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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "base/timer.h" | 18 #include "base/timer.h" |
| 19 #include "sync/engine/net/server_connection_manager.h" | 19 #include "sync/engine/net/server_connection_manager.h" |
| 20 #include "sync/engine/nudge_source.h" | 20 #include "sync/engine/nudge_source.h" |
| 21 #include "sync/engine/sync_scheduler.h" | 21 #include "sync/engine/sync_scheduler.h" |
| 22 #include "sync/engine/syncer.h" | 22 #include "sync/engine/syncer.h" |
| 23 #include "sync/internal_api/public/base/model_type_payload_map.h" | 23 #include "sync/internal_api/public/base/model_type_state_map.h" |
| 24 #include "sync/internal_api/public/engine/polling_constants.h" | 24 #include "sync/internal_api/public/engine/polling_constants.h" |
| 25 #include "sync/internal_api/public/util/weak_handle.h" | 25 #include "sync/internal_api/public/util/weak_handle.h" |
| 26 #include "sync/sessions/sync_session.h" | 26 #include "sync/sessions/sync_session.h" |
| 27 #include "sync/sessions/sync_session_context.h" | 27 #include "sync/sessions/sync_session_context.h" |
| 28 | 28 |
| 29 namespace syncer { | 29 namespace syncer { |
| 30 | 30 |
| 31 class BackoffDelayProvider; | 31 class BackoffDelayProvider; |
| 32 | 32 |
| 33 class SyncSchedulerImpl : public SyncScheduler { | 33 class SyncSchedulerImpl : public SyncScheduler { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 | 44 |
| 45 virtual void Start(Mode mode) OVERRIDE; | 45 virtual void Start(Mode mode) OVERRIDE; |
| 46 virtual bool ScheduleConfiguration( | 46 virtual bool ScheduleConfiguration( |
| 47 const ConfigurationParams& params) OVERRIDE; | 47 const ConfigurationParams& params) OVERRIDE; |
| 48 virtual void RequestStop(const base::Closure& callback) OVERRIDE; | 48 virtual void RequestStop(const base::Closure& callback) OVERRIDE; |
| 49 virtual void ScheduleNudgeAsync( | 49 virtual void ScheduleNudgeAsync( |
| 50 const base::TimeDelta& delay, | 50 const base::TimeDelta& delay, |
| 51 NudgeSource source, | 51 NudgeSource source, |
| 52 ModelTypeSet types, | 52 ModelTypeSet types, |
| 53 const tracked_objects::Location& nudge_location) OVERRIDE; | 53 const tracked_objects::Location& nudge_location) OVERRIDE; |
| 54 virtual void ScheduleNudgeWithPayloadsAsync( | 54 virtual void ScheduleNudgeWithStatesAsync( |
| 55 const base::TimeDelta& delay, NudgeSource source, | 55 const base::TimeDelta& delay, NudgeSource source, |
| 56 const ModelTypePayloadMap& types_with_payloads, | 56 const ModelTypeStateMap& type_state_map, |
| 57 const tracked_objects::Location& nudge_location) OVERRIDE; | 57 const tracked_objects::Location& nudge_location) OVERRIDE; |
| 58 virtual void SetNotificationsEnabled(bool notifications_enabled) OVERRIDE; | 58 virtual void SetNotificationsEnabled(bool notifications_enabled) OVERRIDE; |
| 59 | 59 |
| 60 virtual base::TimeDelta GetSessionsCommitDelay() const OVERRIDE; | 60 virtual base::TimeDelta GetSessionsCommitDelay() const OVERRIDE; |
| 61 | 61 |
| 62 virtual void OnCredentialsUpdated() OVERRIDE; | 62 virtual void OnCredentialsUpdated() OVERRIDE; |
| 63 virtual void OnConnectionStatusChange() OVERRIDE; | 63 virtual void OnConnectionStatusChange() OVERRIDE; |
| 64 | 64 |
| 65 // SyncSession::Delegate implementation. | 65 // SyncSession::Delegate implementation. |
| 66 virtual void OnSilencedUntil( | 66 virtual void OnSilencedUntil( |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 // Coalesces the current job with the pending nudge. | 235 // Coalesces the current job with the pending nudge. |
| 236 void InitOrCoalescePendingJob(const SyncSessionJob& job); | 236 void InitOrCoalescePendingJob(const SyncSessionJob& job); |
| 237 | 237 |
| 238 // 'Impl' here refers to real implementation of public functions, running on | 238 // 'Impl' here refers to real implementation of public functions, running on |
| 239 // |thread_|. | 239 // |thread_|. |
| 240 void StopImpl(const base::Closure& callback); | 240 void StopImpl(const base::Closure& callback); |
| 241 void ScheduleNudgeImpl( | 241 void ScheduleNudgeImpl( |
| 242 const base::TimeDelta& delay, | 242 const base::TimeDelta& delay, |
| 243 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, | 243 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
| 244 const ModelTypePayloadMap& types_with_payloads, | 244 const ModelTypeStateMap& type_state_map, |
| 245 bool is_canary_job, const tracked_objects::Location& nudge_location); | 245 bool is_canary_job, const tracked_objects::Location& nudge_location); |
| 246 | 246 |
| 247 // Returns true if the client is currently in exponential backoff. | 247 // Returns true if the client is currently in exponential backoff. |
| 248 bool IsBackingOff() const; | 248 bool IsBackingOff() const; |
| 249 | 249 |
| 250 // Helper to signal all listeners registered with |session_context_|. | 250 // Helper to signal all listeners registered with |session_context_|. |
| 251 void Notify(SyncEngineEvent::EventCause cause); | 251 void Notify(SyncEngineEvent::EventCause cause); |
| 252 | 252 |
| 253 // Callback to change backoff state. | 253 // Callback to change backoff state. |
| 254 void DoCanaryJob(); | 254 void DoCanaryJob(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 scoped_ptr<Syncer> syncer_; | 332 scoped_ptr<Syncer> syncer_; |
| 333 | 333 |
| 334 sessions::SyncSessionContext *session_context_; | 334 sessions::SyncSessionContext *session_context_; |
| 335 | 335 |
| 336 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 336 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
| 337 }; | 337 }; |
| 338 | 338 |
| 339 } // namespace syncer | 339 } // namespace syncer |
| 340 | 340 |
| 341 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 341 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
| OLD | NEW |