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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 public base::NonThreadSafe { | 42 public base::NonThreadSafe { |
43 public: | 43 public: |
44 // |name| is a display string to identify the syncer thread. Takes | 44 // |name| is a display string to identify the syncer thread. Takes |
45 // |ownership of |syncer| and |delay_provider|. | 45 // |ownership of |syncer| and |delay_provider|. |
46 SyncSchedulerImpl(const std::string& name, | 46 SyncSchedulerImpl(const std::string& name, |
47 BackoffDelayProvider* delay_provider, | 47 BackoffDelayProvider* delay_provider, |
48 sessions::SyncSessionContext* context, | 48 sessions::SyncSessionContext* context, |
49 Syncer* syncer); | 49 Syncer* syncer); |
50 | 50 |
51 // Calls Stop(). | 51 // Calls Stop(). |
52 virtual ~SyncSchedulerImpl(); | 52 ~SyncSchedulerImpl() override; |
53 | 53 |
54 virtual void Start(Mode mode) override; | 54 void Start(Mode mode) override; |
55 virtual void ScheduleConfiguration( | 55 void ScheduleConfiguration(const ConfigurationParams& params) override; |
56 const ConfigurationParams& params) override; | 56 void Stop() override; |
57 virtual void Stop() override; | 57 void ScheduleLocalNudge( |
58 virtual void ScheduleLocalNudge( | |
59 ModelTypeSet types, | 58 ModelTypeSet types, |
60 const tracked_objects::Location& nudge_location) override; | 59 const tracked_objects::Location& nudge_location) override; |
61 virtual void ScheduleLocalRefreshRequest( | 60 void ScheduleLocalRefreshRequest( |
62 ModelTypeSet types, | 61 ModelTypeSet types, |
63 const tracked_objects::Location& nudge_location) override; | 62 const tracked_objects::Location& nudge_location) override; |
64 virtual void ScheduleInvalidationNudge( | 63 void ScheduleInvalidationNudge( |
65 syncer::ModelType type, | 64 syncer::ModelType type, |
66 scoped_ptr<InvalidationInterface> invalidation, | 65 scoped_ptr<InvalidationInterface> invalidation, |
67 const tracked_objects::Location& nudge_location) override; | 66 const tracked_objects::Location& nudge_location) override; |
68 virtual void ScheduleInitialSyncNudge(syncer::ModelType model_type) override; | 67 void ScheduleInitialSyncNudge(syncer::ModelType model_type) override; |
69 virtual void SetNotificationsEnabled(bool notifications_enabled) override; | 68 void SetNotificationsEnabled(bool notifications_enabled) override; |
70 | 69 |
71 virtual void OnCredentialsUpdated() override; | 70 void OnCredentialsUpdated() override; |
72 virtual void OnConnectionStatusChange() override; | 71 void OnConnectionStatusChange() override; |
73 | 72 |
74 // SyncSession::Delegate implementation. | 73 // SyncSession::Delegate implementation. |
75 virtual void OnThrottled(const base::TimeDelta& throttle_duration) override; | 74 void OnThrottled(const base::TimeDelta& throttle_duration) override; |
76 virtual void OnTypesThrottled( | 75 void OnTypesThrottled(ModelTypeSet types, |
77 ModelTypeSet types, | 76 const base::TimeDelta& throttle_duration) override; |
78 const base::TimeDelta& throttle_duration) override; | 77 bool IsCurrentlyThrottled() override; |
79 virtual bool IsCurrentlyThrottled() override; | 78 void OnReceivedShortPollIntervalUpdate( |
80 virtual void OnReceivedShortPollIntervalUpdate( | |
81 const base::TimeDelta& new_interval) override; | 79 const base::TimeDelta& new_interval) override; |
82 virtual void OnReceivedLongPollIntervalUpdate( | 80 void OnReceivedLongPollIntervalUpdate( |
83 const base::TimeDelta& new_interval) override; | 81 const base::TimeDelta& new_interval) override; |
84 virtual void OnReceivedCustomNudgeDelays( | 82 void OnReceivedCustomNudgeDelays( |
85 const std::map<ModelType, base::TimeDelta>& nudge_delays) override; | 83 const std::map<ModelType, base::TimeDelta>& nudge_delays) override; |
86 virtual void OnReceivedClientInvalidationHintBufferSize(int size) override; | 84 void OnReceivedClientInvalidationHintBufferSize(int size) override; |
87 virtual void OnSyncProtocolError( | 85 void OnSyncProtocolError( |
88 const SyncProtocolError& sync_protocol_error) override; | 86 const SyncProtocolError& sync_protocol_error) override; |
89 virtual void OnReceivedGuRetryDelay(const base::TimeDelta& delay) override; | 87 void OnReceivedGuRetryDelay(const base::TimeDelta& delay) override; |
90 virtual void OnReceivedMigrationRequest(syncer::ModelTypeSet types) override; | 88 void OnReceivedMigrationRequest(syncer::ModelTypeSet types) override; |
91 | 89 |
92 // Returns true if the client is currently in exponential backoff. | 90 // Returns true if the client is currently in exponential backoff. |
93 bool IsBackingOff() const; | 91 bool IsBackingOff() const; |
94 | 92 |
95 private: | 93 private: |
96 enum JobPriority { | 94 enum JobPriority { |
97 // Non-canary jobs respect exponential backoff. | 95 // Non-canary jobs respect exponential backoff. |
98 NORMAL_PRIORITY, | 96 NORMAL_PRIORITY, |
99 // Canary jobs bypass exponential backoff, so use with extreme caution. | 97 // Canary jobs bypass exponential backoff, so use with extreme caution. |
100 CANARY_PRIORITY | 98 CANARY_PRIORITY |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // A second factory specially for weak_handle_this_, to allow the handle | 321 // A second factory specially for weak_handle_this_, to allow the handle |
324 // to be const and alleviate threading concerns. | 322 // to be const and alleviate threading concerns. |
325 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; | 323 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; |
326 | 324 |
327 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 325 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
328 }; | 326 }; |
329 | 327 |
330 } // namespace syncer | 328 } // namespace syncer |
331 | 329 |
332 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 330 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
OLD | NEW |