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

Side by Side Diff: sync/engine/syncer.cc

Issue 10006046: Abort sync cycles when download step fails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rearrange SetSyncerStepsForPurpose 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/engine/syncer.h" 5 #include "sync/engine/syncer.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 case PROCESS_UPDATES: { 160 case PROCESS_UPDATES: {
161 ProcessUpdatesCommand process_updates; 161 ProcessUpdatesCommand process_updates;
162 process_updates.Execute(session); 162 process_updates.Execute(session);
163 next_step = STORE_TIMESTAMPS; 163 next_step = STORE_TIMESTAMPS;
164 break; 164 break;
165 } 165 }
166 case STORE_TIMESTAMPS: { 166 case STORE_TIMESTAMPS: {
167 StoreTimestampsCommand store_timestamps; 167 StoreTimestampsCommand store_timestamps;
168 store_timestamps.Execute(session); 168 store_timestamps.Execute(session);
169 // We should download all of the updates before attempting to process 169 // We download all of the updates before attempting to apply them.
170 // them. 170 if (!session->status_controller().download_updates_succeeded()) {
171 if (session->status_controller().ServerSaysNothingMoreToDownload() || 171 // We may have downloaded some updates, but if the latest download
172 !session->status_controller().download_updates_succeeded()) { 172 // attempt failed then we don't have all the updates. We'll leave
173 // it to a retry job to pick up where we left off.
174 last_step = SYNCER_END; // Necessary for CONFIGURATION mode.
tim (not reviewing) 2012/04/06 20:38:57 If we're going straight to END, why not call Reque
tim (not reviewing) 2012/04/06 20:48:21 Oh, I guess you *want* to run END. I think the c
175 next_step = SYNCER_END;
176 DVLOG(1) << "Aborting sync cycle due to download updates failure";
177 } else if (!session->status_controller()
178 .ServerSaysNothingMoreToDownload()) {
Nicolas Zea 2012/04/09 19:09:14 nit: indent by four more spaces
179 next_step = DOWNLOAD_UPDATES;
180 } else {
173 next_step = APPLY_UPDATES; 181 next_step = APPLY_UPDATES;
174 } else {
175 next_step = DOWNLOAD_UPDATES;
176 } 182 }
177 break; 183 break;
178 } 184 }
179 case APPLY_UPDATES: { 185 case APPLY_UPDATES: {
180 ApplyUpdatesCommand apply_updates; 186 ApplyUpdatesCommand apply_updates;
181 apply_updates.Execute(session); 187 apply_updates.Execute(session);
182 if (last_step == APPLY_UPDATES) { 188 if (last_step == APPLY_UPDATES) {
183 // We're in configuration mode, but we still need to run the 189 // We're in configuration mode, but we still need to run the
184 // SYNCER_END step. 190 // SYNCER_END step.
185 last_step = SYNCER_END; 191 last_step = SYNCER_END;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 entry->Put(SERVER_CTIME, Time()); 342 entry->Put(SERVER_CTIME, Time());
337 entry->Put(SERVER_VERSION, 0); 343 entry->Put(SERVER_VERSION, 0);
338 entry->Put(SERVER_IS_DIR, false); 344 entry->Put(SERVER_IS_DIR, false);
339 entry->Put(SERVER_IS_DEL, false); 345 entry->Put(SERVER_IS_DEL, false);
340 entry->Put(IS_UNAPPLIED_UPDATE, false); 346 entry->Put(IS_UNAPPLIED_UPDATE, false);
341 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); 347 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance());
342 entry->Put(SERVER_POSITION_IN_PARENT, 0); 348 entry->Put(SERVER_POSITION_IN_PARENT, 0);
343 } 349 }
344 350
345 } // namespace browser_sync 351 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698