OLD | NEW |
---|---|
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 #ifndef CHROME_BROWSER_SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_ | 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_ |
6 #define CHROME_BROWSER_SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_ | 6 #define CHROME_BROWSER_SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 | 122 |
123 void AddUncommittedParentsAndTheirPredecessors( | 123 void AddUncommittedParentsAndTheirPredecessors( |
124 syncable::BaseTransaction* trans, | 124 syncable::BaseTransaction* trans, |
125 syncable::Id parent_id, | 125 syncable::Id parent_id, |
126 const ModelSafeRoutingInfo& routes, | 126 const ModelSafeRoutingInfo& routes, |
127 syncable::ModelTypeSet throttled_types); | 127 syncable::ModelTypeSet throttled_types); |
128 | 128 |
129 // OrderedCommitSet helpers for adding predecessors in order. | 129 // OrderedCommitSet helpers for adding predecessors in order. |
130 // TODO(ncarter): Refactor these so that the |result| parameter goes away, | 130 // TODO(ncarter): Refactor these so that the |result| parameter goes away, |
131 // and AddItem doesn't need to consider two OrderedCommitSets. | 131 // and AddItem doesn't need to consider two OrderedCommitSets. |
132 | |
133 // Adds |item| to |result| if it's ready for committing and was not already | |
134 // present. If |item| was added, returns true. If item already existed, | |
135 // returns false. If item was not ready for commit, clears |result| and | |
akalin
2011/12/15 01:58:20
Is there a reason for the 'clear results' action o
| |
136 // returns false. | |
132 bool AddItem(syncable::Entry* item, | 137 bool AddItem(syncable::Entry* item, |
133 syncable::ModelTypeSet throttled_types, | 138 syncable::ModelTypeSet throttled_types, |
134 sessions::OrderedCommitSet* result); | 139 sessions::OrderedCommitSet* result); |
140 // Adds item and all it's unsynced predecessors to |result| if all that are | |
141 // unsynced are ready for commit. If either item or any of it's predecessors | |
142 // are unsynced but not ready for commit, clears |result|. | |
143 // Return values: | |
144 // True: if unsynced items were added to |result| and processing of this set | |
145 // should continue. | |
146 // False: if processing of the set should not continue, either because not | |
147 // all unsynced items were ready for commit or the items are already | |
148 // present in |result|. | |
135 bool AddItemThenPredecessors(syncable::BaseTransaction* trans, | 149 bool AddItemThenPredecessors(syncable::BaseTransaction* trans, |
136 syncable::ModelTypeSet throttled_types, | 150 syncable::ModelTypeSet throttled_types, |
137 syncable::Entry* item, | 151 syncable::Entry* item, |
138 syncable::IndexedBitField inclusion_filter, | |
139 sessions::OrderedCommitSet* result); | 152 sessions::OrderedCommitSet* result); |
153 // Appends all unsynced predecessors of |item|, followed by |item| iteself, | |
akalin
2011/12/14 03:39:52
iteself -> itself
| |
154 // to |ordered_commit_set_|, iff item and all its unsynced predecessors | |
155 // are ready for commit. If |item| or any of it's unsynced predecessors | |
156 // are unready for commit, does not modify |ordered_commit_set_|. | |
akalin
2011/12/14 03:39:52
unready -> not ready
| |
140 void AddPredecessorsThenItem(syncable::BaseTransaction* trans, | 157 void AddPredecessorsThenItem(syncable::BaseTransaction* trans, |
141 syncable::ModelTypeSet throttled_types, | 158 syncable::ModelTypeSet throttled_types, |
142 syncable::Entry* item, | 159 syncable::Entry* item, |
143 syncable::IndexedBitField inclusion_filter, | |
144 const ModelSafeRoutingInfo& routes); | 160 const ModelSafeRoutingInfo& routes); |
145 | 161 |
146 bool IsCommitBatchFull(); | 162 bool IsCommitBatchFull(); |
147 | 163 |
148 void AddCreatesAndMoves(const vector<int64>& unsynced_handles, | 164 void AddCreatesAndMoves(const vector<int64>& unsynced_handles, |
149 syncable::WriteTransaction* write_transaction, | 165 syncable::WriteTransaction* write_transaction, |
150 const ModelSafeRoutingInfo& routes, | 166 const ModelSafeRoutingInfo& routes, |
151 syncable::ModelTypeSet throttled_types); | 167 syncable::ModelTypeSet throttled_types); |
152 | 168 |
153 void AddDeletes(const vector<int64>& unsynced_handles, | 169 void AddDeletes(const vector<int64>& unsynced_handles, |
154 syncable::WriteTransaction* write_transaction); | 170 syncable::WriteTransaction* write_transaction); |
155 | 171 |
156 scoped_ptr<sessions::OrderedCommitSet> ordered_commit_set_; | 172 scoped_ptr<sessions::OrderedCommitSet> ordered_commit_set_; |
157 | 173 |
158 int requested_commit_batch_size_; | 174 int requested_commit_batch_size_; |
159 bool passphrase_missing_; | 175 bool passphrase_missing_; |
160 syncable::ModelTypeSet encrypted_types_; | 176 syncable::ModelTypeSet encrypted_types_; |
161 | 177 |
162 DISALLOW_COPY_AND_ASSIGN(GetCommitIdsCommand); | 178 DISALLOW_COPY_AND_ASSIGN(GetCommitIdsCommand); |
163 }; | 179 }; |
164 | 180 |
165 } // namespace browser_sync | 181 } // namespace browser_sync |
166 | 182 |
167 #endif // CHROME_BROWSER_SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_ | 183 #endif // CHROME_BROWSER_SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_ |
OLD | NEW |