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

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

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 #include "sync/sessions/status_controller.h" 5 #include "sync/sessions/status_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "sync/protocol/sync_protocol_error.h" 10 #include "sync/protocol/sync_protocol_error.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 int sum = 0; 284 int sum = 0;
285 for (; it != per_model_group_.end(); ++it) { 285 for (; it != per_model_group_.end(); ++it) {
286 sum += it->second->conflict_progress.SimpleConflictingItemsSize(); 286 sum += it->second->conflict_progress.SimpleConflictingItemsSize();
287 sum += it->second->conflict_progress.EncryptionConflictingItemsSize(); 287 sum += it->second->conflict_progress.EncryptionConflictingItemsSize();
288 sum += it->second->conflict_progress.HierarchyConflictingItemsSize(); 288 sum += it->second->conflict_progress.HierarchyConflictingItemsSize();
289 sum += it->second->conflict_progress.ServerConflictingItemsSize(); 289 sum += it->second->conflict_progress.ServerConflictingItemsSize();
290 } 290 }
291 return sum; 291 return sum;
292 } 292 }
293 293
294 bool StatusController::ServerSaysNothingMoreToDownload() const {
295 if (!download_updates_succeeded())
296 return false;
297
298 if (!updates_response().get_updates().has_changes_remaining()) {
299 NOTREACHED(); // Server should always send changes remaining.
300 return false; // Avoid looping forever.
301 }
302 // Changes remaining is an estimate, but if it's estimated to be
303 // zero, that's firm and we don't have to ask again.
304 return updates_response().get_updates().changes_remaining() == 0;
305 }
306
307 void StatusController::set_debug_info_sent() { 294 void StatusController::set_debug_info_sent() {
308 shared_.control_params.debug_info_sent = true; 295 shared_.control_params.debug_info_sent = true;
309 } 296 }
310 297
311 bool StatusController::debug_info_sent() const { 298 bool StatusController::debug_info_sent() const {
312 return shared_.control_params.debug_info_sent; 299 return shared_.control_params.debug_info_sent;
313 } 300 }
314 301
315 } // namespace sessions 302 } // namespace sessions
316 } // namespace browser_sync 303 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698