| 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 // A class to schedule syncer tasks intelligently. | 5 // A class to schedule syncer tasks intelligently. |
| 6 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_H_ | 6 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| 7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_ | 7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 struct ServerConnectionEvent; | 26 struct ServerConnectionEvent; |
| 27 | 27 |
| 28 struct ConfigurationParams { | 28 struct ConfigurationParams { |
| 29 enum KeystoreKeyStatus { | 29 enum KeystoreKeyStatus { |
| 30 KEYSTORE_KEY_UNNECESSARY, | 30 KEYSTORE_KEY_UNNECESSARY, |
| 31 KEYSTORE_KEY_NEEDED | 31 KEYSTORE_KEY_NEEDED |
| 32 }; | 32 }; |
| 33 ConfigurationParams(); | 33 ConfigurationParams(); |
| 34 ConfigurationParams( | 34 ConfigurationParams( |
| 35 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, | 35 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, |
| 36 const syncer::ModelTypeSet& types_to_download, | 36 const ModelTypeSet& types_to_download, |
| 37 const syncer::ModelSafeRoutingInfo& routing_info, | 37 const ModelSafeRoutingInfo& routing_info, |
| 38 KeystoreKeyStatus keystore_key_status, | 38 KeystoreKeyStatus keystore_key_status, |
| 39 const base::Closure& ready_task); | 39 const base::Closure& ready_task); |
| 40 ~ConfigurationParams(); | 40 ~ConfigurationParams(); |
| 41 | 41 |
| 42 // Source for the configuration. | 42 // Source for the configuration. |
| 43 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source; | 43 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source; |
| 44 // The types that should be downloaded. | 44 // The types that should be downloaded. |
| 45 syncer::ModelTypeSet types_to_download; | 45 ModelTypeSet types_to_download; |
| 46 // The new routing info (superset of types to be downloaded). | 46 // The new routing info (superset of types to be downloaded). |
| 47 ModelSafeRoutingInfo routing_info; | 47 ModelSafeRoutingInfo routing_info; |
| 48 // Whether we need to perform a GetKey command. | 48 // Whether we need to perform a GetKey command. |
| 49 KeystoreKeyStatus keystore_key_status; | 49 KeystoreKeyStatus keystore_key_status; |
| 50 // Callback to invoke on configuration completion. | 50 // Callback to invoke on configuration completion. |
| 51 base::Closure ready_task; | 51 base::Closure ready_task; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class SyncScheduler : public sessions::SyncSession::Delegate { | 54 class SyncScheduler : public sessions::SyncSession::Delegate { |
| 55 public: | 55 public: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // allow preempting ongoing sync cycles. | 88 // allow preempting ongoing sync cycles. |
| 89 // Invokes |callback| from the sync loop once syncer is idle and all tasks | 89 // Invokes |callback| from the sync loop once syncer is idle and all tasks |
| 90 // are cancelled. | 90 // are cancelled. |
| 91 virtual void RequestStop(const base::Closure& callback) = 0; | 91 virtual void RequestStop(const base::Closure& callback) = 0; |
| 92 | 92 |
| 93 // The meat and potatoes. Both of these methods will post a delayed task | 93 // The meat and potatoes. Both of these methods will post a delayed task |
| 94 // to attempt the actual nudge (see ScheduleNudgeImpl). | 94 // to attempt the actual nudge (see ScheduleNudgeImpl). |
| 95 virtual void ScheduleNudgeAsync( | 95 virtual void ScheduleNudgeAsync( |
| 96 const base::TimeDelta& delay, | 96 const base::TimeDelta& delay, |
| 97 NudgeSource source, | 97 NudgeSource source, |
| 98 syncer::ModelTypeSet types, | 98 ModelTypeSet types, |
| 99 const tracked_objects::Location& nudge_location) = 0; | 99 const tracked_objects::Location& nudge_location) = 0; |
| 100 virtual void ScheduleNudgeWithPayloadsAsync( | 100 virtual void ScheduleNudgeWithPayloadsAsync( |
| 101 const base::TimeDelta& delay, NudgeSource source, | 101 const base::TimeDelta& delay, NudgeSource source, |
| 102 const syncer::ModelTypePayloadMap& types_with_payloads, | 102 const ModelTypePayloadMap& types_with_payloads, |
| 103 const tracked_objects::Location& nudge_location) = 0; | 103 const tracked_objects::Location& nudge_location) = 0; |
| 104 | 104 |
| 105 // Change status of notifications in the SyncSessionContext. | 105 // Change status of notifications in the SyncSessionContext. |
| 106 virtual void SetNotificationsEnabled(bool notifications_enabled) = 0; | 106 virtual void SetNotificationsEnabled(bool notifications_enabled) = 0; |
| 107 | 107 |
| 108 virtual base::TimeDelta GetSessionsCommitDelay() const = 0; | 108 virtual base::TimeDelta GetSessionsCommitDelay() const = 0; |
| 109 | 109 |
| 110 // Called when credentials are updated by the user. | 110 // Called when credentials are updated by the user. |
| 111 virtual void OnCredentialsUpdated() = 0; | 111 virtual void OnCredentialsUpdated() = 0; |
| 112 | 112 |
| 113 // Called when the network layer detects a connection status change. | 113 // Called when the network layer detects a connection status change. |
| 114 virtual void OnConnectionStatusChange() = 0; | 114 virtual void OnConnectionStatusChange() = 0; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 } // namespace syncer | 117 } // namespace syncer |
| 118 | 118 |
| 119 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ | 119 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| OLD | NEW |