OLD | NEW |
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 SYNC_ENGINE_CONFLICT_RESOLVER_H_ | 8 #ifndef SYNC_ENGINE_CONFLICT_RESOLVER_H_ |
9 #define SYNC_ENGINE_CONFLICT_RESOLVER_H_ | 9 #define SYNC_ENGINE_CONFLICT_RESOLVER_H_ |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 NIGORI_MERGE, // Resolved by merging nigori nodes. | 42 NIGORI_MERGE, // Resolved by merging nigori nodes. |
43 CHANGES_MATCH, // Resolved by ignoring both local and server | 43 CHANGES_MATCH, // Resolved by ignoring both local and server |
44 // changes because they matched. | 44 // changes because they matched. |
45 CONFLICT_RESOLUTION_SIZE, | 45 CONFLICT_RESOLUTION_SIZE, |
46 }; | 46 }; |
47 | 47 |
48 ConflictResolver(); | 48 ConflictResolver(); |
49 ~ConflictResolver(); | 49 ~ConflictResolver(); |
50 // Called by the syncer at the end of a update/commit cycle. | 50 // Called by the syncer at the end of a update/commit cycle. |
51 // Returns true if the syncer should try to apply its updates again. | 51 // Returns true if the syncer should try to apply its updates again. |
52 bool ResolveConflicts(syncable::WriteTransaction* trans, | 52 void ResolveConflicts(syncable::WriteTransaction* trans, |
53 const Cryptographer* cryptographer, | 53 const Cryptographer* cryptographer, |
54 const std::set<syncable::Id>& simple_conflict_ids, | 54 const std::set<syncable::Id>& simple_conflict_ids, |
55 sessions::StatusController* status); | 55 sessions::StatusController* status); |
56 | 56 |
57 private: | 57 private: |
58 enum ProcessSimpleConflictResult { | 58 void ProcessSimpleConflict( |
59 NO_SYNC_PROGRESS, // No changes to advance syncing made. | |
60 SYNC_PROGRESS, // Progress made. | |
61 }; | |
62 | |
63 ProcessSimpleConflictResult ProcessSimpleConflict( | |
64 syncable::WriteTransaction* trans, | 59 syncable::WriteTransaction* trans, |
65 const syncable::Id& id, | 60 const syncable::Id& id, |
66 const Cryptographer* cryptographer, | 61 const Cryptographer* cryptographer, |
67 sessions::StatusController* status); | 62 sessions::StatusController* status); |
68 | 63 |
69 DISALLOW_COPY_AND_ASSIGN(ConflictResolver); | 64 DISALLOW_COPY_AND_ASSIGN(ConflictResolver); |
70 }; | 65 }; |
71 | 66 |
72 } // namespace syncer | 67 } // namespace syncer |
73 | 68 |
74 #endif // SYNC_ENGINE_CONFLICT_RESOLVER_H_ | 69 #endif // SYNC_ENGINE_CONFLICT_RESOLVER_H_ |
OLD | NEW |