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

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

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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
« no previous file with comments | « sync/engine/conflict_util.h ('k') | sync/engine/directory_commit_contribution.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "sync/engine/conflict_util.h"
6
7 #include "sync/syncable/mutable_entry.h"
8
9 namespace syncer {
10
11 using syncable::MutableEntry;
12
13 namespace conflict_util {
14
15 // Allow the server's changes to take precedence.
16 // This will take effect during the next ApplyUpdates step.
17 void IgnoreLocalChanges(MutableEntry* entry) {
18 DCHECK(entry->GetIsUnsynced());
19 DCHECK(entry->GetIsUnappliedUpdate());
20 entry->PutIsUnsynced(false);
21 }
22
23 // Overwrite the server with our own value.
24 // We will commit our local data, overwriting the server, at the next
25 // opportunity.
26 void OverwriteServerChanges(MutableEntry* entry) {
27 DCHECK(entry->GetIsUnsynced());
28 DCHECK(entry->GetIsUnappliedUpdate());
29 entry->PutBaseVersion(entry->GetServerVersion());
30 entry->PutIsUnappliedUpdate(false);
31 }
32
33 // Having determined that everything matches, we ignore the non-conflict.
34 void IgnoreConflict(MutableEntry* entry) {
35 // If we didn't also unset IS_UNAPPLIED_UPDATE, then we would lose unsynced
36 // positional data from adjacent entries when the server update gets applied
37 // and the item is re-inserted into the PREV_ID/NEXT_ID linked list. This is
38 // primarily an issue because we commit after applying updates, and is most
39 // commonly seen when positional changes are made while a passphrase is
40 // required (and hence there will be many encryption conflicts).
41 DCHECK(entry->GetIsUnsynced());
42 DCHECK(entry->GetIsUnappliedUpdate());
43 entry->PutBaseVersion(entry->GetServerVersion());
44 entry->PutIsUnappliedUpdate(false);
45 entry->PutIsUnsynced(false);
46 }
47
48 } // namespace conflict_util
49 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/conflict_util.h ('k') | sync/engine/directory_commit_contribution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698