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

Side by Side Diff: sync/sessions/status_controller.h

Issue 10103017: Abort sync cycles when download step fails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test and remove ServerSaysNothingMoreToDownload() Created 8 years, 8 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
OLDNEW
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 // StatusController handles all counter and status related number crunching and 5 // StatusController handles all counter and status related number crunching and
6 // state tracking on behalf of a SyncSession. It 'controls' the model data 6 // state tracking on behalf of a SyncSession. It 'controls' the model data
7 // defined in session_state.h. The most important feature of StatusController 7 // defined in session_state.h. The most important feature of StatusController
8 // is the ScopedModelSafetyRestriction. When one of these is active, the 8 // is the ScopedModelSafetyRestriction. When one of these is active, the
9 // underlying data set exposed via accessors is swapped out to the appropriate 9 // underlying data set exposed via accessors is swapped out to the appropriate
10 // set for the restricted ModelSafeGroup behind the scenes. For example, if 10 // set for the restricted ModelSafeGroup behind the scenes. For example, if
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // Returns the number of updates received from the sync server. 165 // Returns the number of updates received from the sync server.
166 int64 CountUpdates() const; 166 int64 CountUpdates() const;
167 167
168 // Returns true iff any of the commit ids added during this session are 168 // Returns true iff any of the commit ids added during this session are
169 // bookmark related, and the bookmark group restriction is in effect. 169 // bookmark related, and the bookmark group restriction is in effect.
170 bool HasBookmarkCommitActivity() const { 170 bool HasBookmarkCommitActivity() const {
171 return ActiveGroupRestrictionIncludesModel(syncable::BOOKMARKS) && 171 return ActiveGroupRestrictionIncludesModel(syncable::BOOKMARKS) &&
172 shared_.commit_set.HasBookmarkCommitId(); 172 shared_.commit_set.HasBookmarkCommitId();
173 } 173 }
174 174
175 // Returns true if the last download_updates_command received a valid 175 // Returns the status returned from last download updates command.
176 // server response. 176 SyncerError last_download_updates_result() const {
177 bool download_updates_succeeded() const { 177 return shared_.error.value().last_download_updates_result;
178 return updates_response().has_get_updates();
179 } 178 }
180 179
181 // Returns true if the last updates response indicated that we were fully
182 // up to date. This is subtle: if it's false, it could either mean that
183 // the server said there WAS more to download, or it could mean that we
184 // were unable to reach the server. If we didn't request every enabled
185 // datatype, then we can't say for sure that there's nothing left to
186 // download: in that case, this also returns false.
187 bool ServerSaysNothingMoreToDownload() const;
188
189 ModelSafeGroup group_restriction() const { 180 ModelSafeGroup group_restriction() const {
190 return group_restriction_; 181 return group_restriction_;
191 } 182 }
192 183
193 base::Time sync_start_time() const { 184 base::Time sync_start_time() const {
194 // The time at which we sent the first GetUpdates command for this sync. 185 // The time at which we sent the first GetUpdates command for this sync.
195 return sync_start_time_; 186 return sync_start_time_;
196 } 187 }
197 188
198 // Check whether a particular model is included by the active group 189 // Check whether a particular model is included by the active group
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 280 }
290 private: 281 private:
291 StatusController* status_; 282 StatusController* status_;
292 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); 283 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction);
293 }; 284 };
294 285
295 } 286 }
296 } 287 }
297 288
298 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_ 289 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698