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

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

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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
6 // view of the sync cycle state for the conflict resolver. Since the
7 // resolver doesn't get to see all of the SyncProcess, we can allow
8 // it to operate on a subsection of 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 int num_sync_cycles() const;
56
57 void increment_num_sync_cycles();
58
59 void zero_num_sync_cycles();
60
61 // True iff we're stuck. Something has gone wrong with the syncer.
62 bool syncer_stuck() const;
63
64 void set_syncer_stuck(const bool val);
65
66 int64 current_sync_timestamp() const;
67
68 int64 servers_latest_timestamp() const;
69
70 IdToConflictSetMap::const_iterator IdToConflictSetFind(
71 const syncable::Id& the_id) const;
72
73 IdToConflictSetMap::const_iterator IdToConflictSetBegin() const;
74
75 IdToConflictSetMap::const_iterator IdToConflictSetEnd() const;
76
77 IdToConflictSetMap::size_type IdToConflictSetSize() const;
78
79 const ConflictSet* IdToConflictSetGet(const syncable::Id& the_id);
80
81 std::set<ConflictSet*>::const_iterator ConflictSetsBegin() const;
82
83 std::set<ConflictSet*>::const_iterator ConflictSetsEnd() const;
84
85 std::set<ConflictSet*>::size_type ConflictSetsSize() const;
86
87 void MergeSets(const syncable::Id& set1, const syncable::Id& set2);
88
89 void CleanupSets();
90
91 bool HasCommitConflicts() const;
92
93 bool HasBlockedItems() const;
94
95 int CommitConflictsSize() const;
96
97 int BlockedItemsSize() const;
98
99 void AddCommitConflict(const syncable::Id& the_id);
100
101 void AddBlockedItem(const syncable::Id& the_id);
102
103 void EraseCommitConflict(std::set<syncable::Id>::iterator it);
104
105 void EraseBlockedItem(std::set<syncable::Id>::iterator it);
106
107 std::set<syncable::Id>::iterator CommitConflictsBegin() const;
108
109 std::set<syncable::Id>::iterator BlockedItemsBegin() const;
110
111 std::set<syncable::Id>::iterator CommitConflictsEnd() const;
112
113 std::set<syncable::Id>::iterator BlockedItemsEnd() const;
114
115 private:
116 SyncProcessState* process_state_;
117
118 DISALLOW_COPY_AND_ASSIGN(ConflictResolutionView);
119 };
120
121 } // namespace browser_sync
122
123 #endif // CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLUTION_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698