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

Side by Side Diff: chrome/browser/sync/engine/conflict_resolver.cc

Issue 7822008: [Sync] Remove static initializers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/conflict_resolver.h" 5 #include "chrome/browser/sync/engine/conflict_resolver.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 return false; 281 return false;
282 } 282 }
283 // We've deleted a directory tree that's got contents on the server. We 283 // We've deleted a directory tree that's got contents on the server. We
284 // recreate the directory to solve the problem. 284 // recreate the directory to solve the problem.
285 // 285 //
286 // We do this in two parts, first we ensure the tree is unaltered since 286 // We do this in two parts, first we ensure the tree is unaltered since
287 // the conflict was detected. 287 // the conflict was detected.
288 Id id = parent_id; 288 Id id = parent_id;
289 // As we will be crawling the path of deleted entries there's a chance we'll 289 // As we will be crawling the path of deleted entries there's a chance we'll
290 // end up having to reparent an item as there will be an invalid parent. 290 // end up having to reparent an item as there will be an invalid parent.
291 Id reroot_id = syncable::kNullId; 291 Id reroot_id = syncable::GetNullId();
292 // Similarly crawling deleted items means we risk loops. 292 // Similarly crawling deleted items means we risk loops.
293 int loop_detection = conflict_set->size(); 293 int loop_detection = conflict_set->size();
294 while (!id.IsRoot() && --loop_detection >= 0) { 294 while (!id.IsRoot() && --loop_detection >= 0) {
295 Entry parent(trans, syncable::GET_BY_ID, id); 295 Entry parent(trans, syncable::GET_BY_ID, id);
296 // If we get a bad parent, or a parent that's deleted on client and server 296 // If we get a bad parent, or a parent that's deleted on client and server
297 // we recreate the hierarchy in the root. 297 // we recreate the hierarchy in the root.
298 if (!parent.good()) { 298 if (!parent.good()) {
299 reroot_id = id; 299 reroot_id = id;
300 break; 300 break;
301 } 301 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 conflict_set_count_map_.erase(i++); 513 conflict_set_count_map_.erase(i++);
514 // METRIC self resolved conflict sets ++. 514 // METRIC self resolved conflict sets ++.
515 } else { 515 } else {
516 ++i; 516 ++i;
517 } 517 }
518 } 518 }
519 return rv; 519 return rv;
520 } 520 }
521 521
522 } // namespace browser_sync 522 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/build_commit_command_unittest.cc ('k') | chrome/browser/sync/engine/syncer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698