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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 // Request that any running syncer task stop as soon as possible and | 78 // Request that any running syncer task stop as soon as possible and |
79 // cancel all scheduled tasks. This function can be called from any thread, | 79 // cancel all scheduled tasks. This function can be called from any thread, |
80 // and should in fact be called from a thread that isn't the sync loop to | 80 // and should in fact be called from a thread that isn't the sync loop to |
81 // allow preempting ongoing sync cycles. | 81 // allow preempting ongoing sync cycles. |
82 // Invokes |callback| from the sync loop once syncer is idle and all tasks | 82 // Invokes |callback| from the sync loop once syncer is idle and all tasks |
83 // are cancelled. | 83 // are cancelled. |
84 virtual void RequestStop(const base::Closure& callback) = 0; | 84 virtual void RequestStop(const base::Closure& callback) = 0; |
85 | 85 |
86 // The meat and potatoes. Both of these methods will post a delayed task | 86 // The meat and potatoes. Both of these methods will post a delayed task |
87 // to attempt the actual nudge (see ScheduleNudgeImpl). | 87 // to attempt the actual nudge (see ScheduleNudgeImpl). |
88 // NOTE: |delay| is best-effort. If a nudge is already scheduled to depart | |
rlarocque
2012/09/24 21:15:14
Rename to max_delay? I think that would make the
akalin
2012/09/25 22:37:24
but it's not a max delay, right? the nudge can ha
tim (not reviewing)
2012/10/08 00:20:03
I renamed to desired_delay (following the base/tim
| |
89 // earlier than Now() + delay, the scheduler can and will prefer to batch | |
90 // the two so that only one nudge is sent (at the earlier time). | |
88 virtual void ScheduleNudgeAsync( | 91 virtual void ScheduleNudgeAsync( |
89 const base::TimeDelta& delay, | 92 const base::TimeDelta& delay, |
90 NudgeSource source, | 93 NudgeSource source, |
91 ModelTypeSet types, | 94 ModelTypeSet types, |
92 const tracked_objects::Location& nudge_location) = 0; | 95 const tracked_objects::Location& nudge_location) = 0; |
93 virtual void ScheduleNudgeWithStatesAsync( | 96 virtual void ScheduleNudgeWithStatesAsync( |
94 const base::TimeDelta& delay, NudgeSource source, | 97 const base::TimeDelta& delay, NudgeSource source, |
95 const ModelTypeStateMap& type_state_map, | 98 const ModelTypeStateMap& type_state_map, |
96 const tracked_objects::Location& nudge_location) = 0; | 99 const tracked_objects::Location& nudge_location) = 0; |
97 | 100 |
98 // Change status of notifications in the SyncSessionContext. | 101 // Change status of notifications in the SyncSessionContext. |
99 virtual void SetNotificationsEnabled(bool notifications_enabled) = 0; | 102 virtual void SetNotificationsEnabled(bool notifications_enabled) = 0; |
100 | 103 |
101 virtual base::TimeDelta GetSessionsCommitDelay() const = 0; | 104 virtual base::TimeDelta GetSessionsCommitDelay() const = 0; |
102 | 105 |
103 // Called when credentials are updated by the user. | 106 // Called when credentials are updated by the user. |
104 virtual void OnCredentialsUpdated() = 0; | 107 virtual void OnCredentialsUpdated() = 0; |
105 | 108 |
106 // Called when the network layer detects a connection status change. | 109 // Called when the network layer detects a connection status change. |
107 virtual void OnConnectionStatusChange() = 0; | 110 virtual void OnConnectionStatusChange() = 0; |
108 }; | 111 }; |
109 | 112 |
110 } // namespace syncer | 113 } // namespace syncer |
111 | 114 |
112 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ | 115 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ |
OLD | NEW |