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

Side by Side Diff: components/sync/engine_impl/conflict_resolver.h

Issue 2258873003: [Sync] Move sessions/ to engine/cycle/ and rename things to match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. 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
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 // 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 COMPONENTS_SYNC_ENGINE_IMPL_CONFLICT_RESOLVER_H_ 8 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_CONFLICT_RESOLVER_H_
9 #define COMPONENTS_SYNC_ENGINE_IMPL_CONFLICT_RESOLVER_H_ 9 #define COMPONENTS_SYNC_ENGINE_IMPL_CONFLICT_RESOLVER_H_
10 10
11 #include <set> 11 #include <set>
12 12
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "components/sync/engine_impl/syncer_types.h" 15 #include "components/sync/engine_impl/syncer_types.h"
16 16
17 namespace syncer { 17 namespace syncer {
18 18
19 namespace syncable { 19 namespace syncable {
20 class Id; 20 class Id;
21 class WriteTransaction; 21 class WriteTransaction;
22 } // namespace syncable 22 } // namespace syncable
23 23
24 class Cryptographer; 24 class Cryptographer;
25 class StatusController;
25 struct UpdateCounters; 26 struct UpdateCounters;
26 27
27 namespace sessions {
28 class StatusController;
29 } // namespace sessions
30
31 class ConflictResolver { 28 class ConflictResolver {
32 public: 29 public:
33 // Enumeration of different conflict resolutions. Used for histogramming. 30 // Enumeration of different conflict resolutions. Used for histogramming.
34 enum SimpleConflictResolutions { 31 enum SimpleConflictResolutions {
35 OVERWRITE_LOCAL, // Resolved by overwriting local changes. 32 OVERWRITE_LOCAL, // Resolved by overwriting local changes.
36 OVERWRITE_SERVER, // Resolved by overwriting server changes. 33 OVERWRITE_SERVER, // Resolved by overwriting server changes.
37 UNDELETE, // Resolved by undeleting local item. 34 UNDELETE, // Resolved by undeleting local item.
38 IGNORE_ENCRYPTION, // Resolved by ignoring an encryption-only server 35 IGNORE_ENCRYPTION, // Resolved by ignoring an encryption-only server
39 // change. 36 // change.
40 NIGORI_MERGE, // Resolved by merging nigori nodes. 37 NIGORI_MERGE, // Resolved by merging nigori nodes.
41 CHANGES_MATCH, // Resolved by ignoring both local and server 38 CHANGES_MATCH, // Resolved by ignoring both local and server
42 // changes because they matched. 39 // changes because they matched.
43 CONFLICT_RESOLUTION_SIZE, 40 CONFLICT_RESOLUTION_SIZE,
44 }; 41 };
45 42
46 ConflictResolver(); 43 ConflictResolver();
47 ~ConflictResolver(); 44 ~ConflictResolver();
48 // Called by the syncer at the end of a update/commit cycle. 45 // Called by the syncer at the end of a update/commit cycle.
49 // Returns true if the syncer should try to apply its updates again. 46 // Returns true if the syncer should try to apply its updates again.
50 void ResolveConflicts(syncable::WriteTransaction* trans, 47 void ResolveConflicts(syncable::WriteTransaction* trans,
51 const Cryptographer* cryptographer, 48 const Cryptographer* cryptographer,
52 const std::set<syncable::Id>& simple_conflict_ids, 49 const std::set<syncable::Id>& simple_conflict_ids,
53 sessions::StatusController* status, 50 StatusController* status,
54 UpdateCounters* counters); 51 UpdateCounters* counters);
55 52
56 private: 53 private:
57 friend class SyncerTest; 54 friend class SyncerTest;
58 FRIEND_TEST_ALL_PREFIXES(SyncerTest, 55 FRIEND_TEST_ALL_PREFIXES(SyncerTest,
59 ConflictResolverMergeOverwritesLocalEntry); 56 ConflictResolverMergeOverwritesLocalEntry);
60 57
61 void ProcessSimpleConflict(syncable::WriteTransaction* trans, 58 void ProcessSimpleConflict(syncable::WriteTransaction* trans,
62 const syncable::Id& id, 59 const syncable::Id& id,
63 const Cryptographer* cryptographer, 60 const Cryptographer* cryptographer,
64 sessions::StatusController* status, 61 StatusController* status,
65 UpdateCounters* counters); 62 UpdateCounters* counters);
66 63
67 DISALLOW_COPY_AND_ASSIGN(ConflictResolver); 64 DISALLOW_COPY_AND_ASSIGN(ConflictResolver);
68 }; 65 };
69 66
70 } // namespace syncer 67 } // namespace syncer
71 68
72 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CONFLICT_RESOLVER_H_ 69 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CONFLICT_RESOLVER_H_
OLDNEW
« no previous file with comments | « components/sync/engine_impl/commit_util.cc ('k') | components/sync/engine_impl/conflict_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698