Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(893)

Side by Side Diff: sync/engine/sync_scheduler.h

Issue 488843002: [Sync] Add support for server controlled nudge delays (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sync/engine/sync_scheduler_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // 89 //
90 // NOTE: |desired_delay| is best-effort. If a nudge is already scheduled to 90 // NOTE: |desired_delay| is best-effort. If a nudge is already scheduled to
91 // depart earlier than Now() + delay, the scheduler can and will prefer to 91 // depart earlier than Now() + delay, the scheduler can and will prefer to
92 // batch the two so that only one nudge is sent (at the earlier time). Also, 92 // batch the two so that only one nudge is sent (at the earlier time). Also,
93 // as always with delayed tasks and timers, it's possible the task gets run 93 // as always with delayed tasks and timers, it's possible the task gets run
94 // any time after |desired_delay|. 94 // any time after |desired_delay|.
95 95
96 // The LocalNudge indicates that we've made a local change, and that the 96 // The LocalNudge indicates that we've made a local change, and that the
97 // syncer should plan to commit this to the server some time soon. 97 // syncer should plan to commit this to the server some time soon.
98 virtual void ScheduleLocalNudge( 98 virtual void ScheduleLocalNudge(
99 const base::TimeDelta& desired_delay,
100 ModelTypeSet types, 99 ModelTypeSet types,
101 const tracked_objects::Location& nudge_location) = 0; 100 const tracked_objects::Location& nudge_location) = 0;
102 101
103 // The LocalRefreshRequest occurs when we decide for some reason to manually 102 // The LocalRefreshRequest occurs when we decide for some reason to manually
104 // request updates. This should be used sparingly. For example, one of its 103 // request updates. This should be used sparingly. For example, one of its
105 // uses is to fetch the latest tab sync data when it's relevant to the UI on 104 // uses is to fetch the latest tab sync data when it's relevant to the UI on
106 // platforms where tab sync is not registered for invalidations. 105 // platforms where tab sync is not registered for invalidations.
107 virtual void ScheduleLocalRefreshRequest( 106 virtual void ScheduleLocalRefreshRequest(
108 const base::TimeDelta& desired_delay,
109 ModelTypeSet types, 107 ModelTypeSet types,
110 const tracked_objects::Location& nudge_location) = 0; 108 const tracked_objects::Location& nudge_location) = 0;
111 109
112 // Invalidations are notifications the server sends to let us know when other 110 // Invalidations are notifications the server sends to let us know when other
113 // clients have committed data. We need to contact the sync server (being 111 // clients have committed data. We need to contact the sync server (being
114 // careful to pass along the "hints" delivered with those invalidations) in 112 // careful to pass along the "hints" delivered with those invalidations) in
115 // order to fetch the update. 113 // order to fetch the update.
116 virtual void ScheduleInvalidationNudge( 114 virtual void ScheduleInvalidationNudge(
117 const base::TimeDelta& desired_delay,
118 syncer::ModelType type, 115 syncer::ModelType type,
119 scoped_ptr<InvalidationInterface> invalidation, 116 scoped_ptr<InvalidationInterface> invalidation,
120 const tracked_objects::Location& nudge_location) = 0; 117 const tracked_objects::Location& nudge_location) = 0;
121 118
122 // Requests a non-blocking initial sync request for the specified type. 119 // Requests a non-blocking initial sync request for the specified type.
123 // 120 //
124 // Many types can only complete initial sync while the scheduler is in 121 // Many types can only complete initial sync while the scheduler is in
125 // configure mode, but a few of them are able to perform their initial sync 122 // configure mode, but a few of them are able to perform their initial sync
126 // while the scheduler is in normal mode. This non-blocking initial sync 123 // while the scheduler is in normal mode. This non-blocking initial sync
127 // can be requested through this function. 124 // can be requested through this function.
128 virtual void ScheduleInitialSyncNudge(syncer::ModelType model_type) = 0; 125 virtual void ScheduleInitialSyncNudge(syncer::ModelType model_type) = 0;
129 126
130 // Change status of notifications in the SyncSessionContext. 127 // Change status of notifications in the SyncSessionContext.
131 virtual void SetNotificationsEnabled(bool notifications_enabled) = 0; 128 virtual void SetNotificationsEnabled(bool notifications_enabled) = 0;
132 129
133 virtual base::TimeDelta GetSessionsCommitDelay() const = 0;
134
135 // Called when credentials are updated by the user. 130 // Called when credentials are updated by the user.
136 virtual void OnCredentialsUpdated() = 0; 131 virtual void OnCredentialsUpdated() = 0;
137 132
138 // Called when the network layer detects a connection status change. 133 // Called when the network layer detects a connection status change.
139 virtual void OnConnectionStatusChange() = 0; 134 virtual void OnConnectionStatusChange() = 0;
140 }; 135 };
141 136
142 } // namespace syncer 137 } // namespace syncer
143 138
144 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ 139 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_
OLDNEW
« no previous file with comments | « no previous file | sync/engine/sync_scheduler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698