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

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

Issue 8770032: [Sync] Implement encryption-aware conflict resolution. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split out nigori conflict code and rebase Created 9 years 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 // A class that watches the syncer and attempts to resolve any conflicts that 5 // A class that watches the syncer and attempts to resolve any conflicts that
6 // occur. 6 // occur.
7 7
8 #ifndef CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_
9 #define CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ 9 #define CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_
10 #pragma once 10 #pragma once
(...skipping 21 matching lines...) Expand all
32 namespace sessions { 32 namespace sessions {
33 class ConflictProgress; 33 class ConflictProgress;
34 class StatusController; 34 class StatusController;
35 } // namespace sessions 35 } // namespace sessions
36 36
37 class ConflictResolver { 37 class ConflictResolver {
38 friend class SyncerTest; 38 friend class SyncerTest;
39 FRIEND_TEST_ALL_PREFIXES(SyncerTest, 39 FRIEND_TEST_ALL_PREFIXES(SyncerTest,
40 ConflictResolverMergeOverwritesLocalEntry); 40 ConflictResolverMergeOverwritesLocalEntry);
41 public: 41 public:
42 // Enumeration of different conflict resolutions. Used for histogramming.
43 enum SimpleConflictResolutions {
44 OVERWRITE_LOCAL, // Resolved by overwriting local changes.
45 OVERWRITE_SERVER, // Resolved by overwriting server changes.
46 UNDELETE, // Resolved by undeleting local item.
47 IGNORE_ENCRYPTION, // Resolved by ignoring an encryption-only server
48 // change.
49 NIGORI_MERGE, // Resolved by merging nigori nodes.
50 CHANGES_MATCH, // Resolved by ignoring both local and server
51 // changes because they matched.
52 CONFLICT_RESOLUTION_SIZE,
53 };
54
42 ConflictResolver(); 55 ConflictResolver();
43 ~ConflictResolver(); 56 ~ConflictResolver();
44 // Called by the syncer at the end of a update/commit cycle. 57 // Called by the syncer at the end of a update/commit cycle.
45 // Returns true if the syncer should try to apply its updates again. 58 // Returns true if the syncer should try to apply its updates again.
46 bool ResolveConflicts(const syncable::ScopedDirLookup& dir, 59 bool ResolveConflicts(const syncable::ScopedDirLookup& dir,
47 const sessions::ConflictProgress& progress, 60 const sessions::ConflictProgress& progress,
48 sessions::StatusController* status); 61 sessions::StatusController* status);
49 62
50 private: 63 private:
51 // We keep a map to record how often we've seen each conflict set. We use this 64 // We keep a map to record how often we've seen each conflict set. We use this
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 105
93 ConflictSetCountMap conflict_set_count_map_; 106 ConflictSetCountMap conflict_set_count_map_;
94 SimpleConflictCountMap simple_conflict_count_map_; 107 SimpleConflictCountMap simple_conflict_count_map_;
95 108
96 DISALLOW_COPY_AND_ASSIGN(ConflictResolver); 109 DISALLOW_COPY_AND_ASSIGN(ConflictResolver);
97 }; 110 };
98 111
99 } // namespace browser_sync 112 } // namespace browser_sync
100 113
101 #endif // CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ 114 #endif // CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698