| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2009 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 // Conflict resolution view is intended to provide a restricted view of the | |
| 6 // sync cycle state for the conflict resolver. Since the resolver doesn't get | |
| 7 // to see all of the SyncProcess, we can allow it to operate on a subsection of | |
| 8 // the data. | |
| 9 | |
| 10 #ifndef CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLUTION_VIEW_H_ | |
| 11 #define CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLUTION_VIEW_H_ | |
| 12 | |
| 13 #include <map> | |
| 14 #include <set> | |
| 15 #include <vector> | |
| 16 | |
| 17 #include "base/basictypes.h" | |
| 18 #include "chrome/browser/sync/engine/syncer_types.h" | |
| 19 | |
| 20 namespace syncable { | |
| 21 class Id; | |
| 22 } | |
| 23 | |
| 24 namespace browser_sync { | |
| 25 | |
| 26 class SyncCycleState; | |
| 27 class SyncProcessState; | |
| 28 class SyncerSession; | |
| 29 | |
| 30 class ConflictResolutionView { | |
| 31 // THIS CLASS PROVIDES NO SYNCHRONIZATION GUARANTEES. | |
| 32 public: | |
| 33 | |
| 34 explicit ConflictResolutionView(SyncProcessState* state) | |
| 35 : process_state_(state) { | |
| 36 } | |
| 37 | |
| 38 explicit ConflictResolutionView(SyncerSession* session); | |
| 39 | |
| 40 ~ConflictResolutionView() {} | |
| 41 | |
| 42 int conflicting_updates() const; | |
| 43 | |
| 44 // TODO(sync) can successful commit go in session? | |
| 45 int successful_commits() const; | |
| 46 | |
| 47 void increment_successful_commits(); | |
| 48 | |
| 49 void zero_successful_commits(); | |
| 50 | |
| 51 int conflicting_commits() const; | |
| 52 | |
| 53 void set_conflicting_commits(const int val); | |
| 54 | |
| 55 // True iff we're stuck. Something has gone wrong with the syncer. | |
| 56 bool syncer_stuck() const; | |
| 57 | |
| 58 void set_syncer_stuck(const bool val); | |
| 59 | |
| 60 int64 current_sync_timestamp() const; | |
| 61 | |
| 62 int64 num_server_changes_remaining() const; | |
| 63 | |
| 64 IdToConflictSetMap::const_iterator IdToConflictSetFind( | |
| 65 const syncable::Id& the_id) const; | |
| 66 | |
| 67 IdToConflictSetMap::const_iterator IdToConflictSetBegin() const; | |
| 68 | |
| 69 IdToConflictSetMap::const_iterator IdToConflictSetEnd() const; | |
| 70 | |
| 71 IdToConflictSetMap::size_type IdToConflictSetSize() const; | |
| 72 | |
| 73 const ConflictSet* IdToConflictSetGet(const syncable::Id& the_id); | |
| 74 | |
| 75 std::set<ConflictSet*>::const_iterator ConflictSetsBegin() const; | |
| 76 | |
| 77 std::set<ConflictSet*>::const_iterator ConflictSetsEnd() const; | |
| 78 | |
| 79 std::set<ConflictSet*>::size_type ConflictSetsSize() const; | |
| 80 | |
| 81 void MergeSets(const syncable::Id& set1, const syncable::Id& set2); | |
| 82 | |
| 83 void CleanupSets(); | |
| 84 | |
| 85 bool HasCommitConflicts() const; | |
| 86 | |
| 87 int CommitConflictsSize() const; | |
| 88 | |
| 89 void AddCommitConflict(const syncable::Id& the_id); | |
| 90 | |
| 91 void EraseCommitConflict(std::set<syncable::Id>::iterator it); | |
| 92 | |
| 93 std::set<syncable::Id>::iterator CommitConflictsBegin() const; | |
| 94 | |
| 95 std::set<syncable::Id>::iterator CommitConflictsEnd() const; | |
| 96 | |
| 97 private: | |
| 98 SyncProcessState* process_state_; | |
| 99 | |
| 100 DISALLOW_COPY_AND_ASSIGN(ConflictResolutionView); | |
| 101 }; | |
| 102 | |
| 103 } // namespace browser_sync | |
| 104 | |
| 105 #endif // CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLUTION_VIEW_H_ | |
| OLD | NEW |