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 16 matching lines...) Expand all Loading... |
27 explicit GetCommitIdsCommand(int commit_batch_size); | 27 explicit GetCommitIdsCommand(int commit_batch_size); |
28 virtual ~GetCommitIdsCommand(); | 28 virtual ~GetCommitIdsCommand(); |
29 | 29 |
30 // SyncerCommand implementation. | 30 // SyncerCommand implementation. |
31 virtual void ExecuteImpl(sessions::SyncSession* session) OVERRIDE; | 31 virtual void ExecuteImpl(sessions::SyncSession* session) OVERRIDE; |
32 | 32 |
33 // Builds a vector of IDs that should be committed. | 33 // Builds a vector of IDs that should be committed. |
34 void BuildCommitIds(const vector<int64>& unsynced_handles, | 34 void BuildCommitIds(const vector<int64>& unsynced_handles, |
35 syncable::WriteTransaction* write_transaction, | 35 syncable::WriteTransaction* write_transaction, |
36 const ModelSafeRoutingInfo& routes, | 36 const ModelSafeRoutingInfo& routes, |
37 syncable::ModelEnumSet throttled_types); | 37 syncable::ModelTypeSet throttled_types); |
38 | 38 |
39 // TODO(chron): Remove writes from this iterator. As a warning, this | 39 // TODO(chron): Remove writes from this iterator. As a warning, this |
40 // iterator causes writes to entries and so isn't a pure iterator. | 40 // iterator causes writes to entries and so isn't a pure iterator. |
41 // It will do Put(IS_UNSYNCED). Refactor this out later. | 41 // It will do Put(IS_UNSYNCED). Refactor this out later. |
42 class CommitMetahandleIterator { | 42 class CommitMetahandleIterator { |
43 public: | 43 public: |
44 // TODO(chron): Cache ValidateCommitEntry responses across iterators to save | 44 // TODO(chron): Cache ValidateCommitEntry responses across iterators to save |
45 // UTF8 conversion and filename checking | 45 // UTF8 conversion and filename checking |
46 CommitMetahandleIterator(const vector<int64>& unsynced_handles, | 46 CommitMetahandleIterator(const vector<int64>& unsynced_handles, |
47 syncable::WriteTransaction* write_transaction, | 47 syncable::WriteTransaction* write_transaction, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 private: | 111 private: |
112 // Removes all entries not ready for commit from |unsynced_handles|. | 112 // Removes all entries not ready for commit from |unsynced_handles|. |
113 // An entry is considered unready for commit if: | 113 // An entry is considered unready for commit if: |
114 // 1. It's in conflict or requires (re)encryption. Any datatype requiring | 114 // 1. It's in conflict or requires (re)encryption. Any datatype requiring |
115 // encryption while the cryptographer is missing a passphrase is | 115 // encryption while the cryptographer is missing a passphrase is |
116 // considered unready for commit. | 116 // considered unready for commit. |
117 // 2. Its type is currently throttled. | 117 // 2. Its type is currently throttled. |
118 void FilterUnreadyEntries( | 118 void FilterUnreadyEntries( |
119 syncable::BaseTransaction* trans, | 119 syncable::BaseTransaction* trans, |
120 syncable::ModelEnumSet throttled_types, | 120 syncable::ModelTypeSet throttled_types, |
121 syncable::Directory::UnsyncedMetaHandles* unsynced_handles); | 121 syncable::Directory::UnsyncedMetaHandles* unsynced_handles); |
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::ModelEnumSet 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 bool AddItem(syncable::Entry* item, | 132 bool AddItem(syncable::Entry* item, |
133 syncable::ModelEnumSet throttled_types, | 133 syncable::ModelTypeSet throttled_types, |
134 sessions::OrderedCommitSet* result); | 134 sessions::OrderedCommitSet* result); |
135 bool AddItemThenPredecessors(syncable::BaseTransaction* trans, | 135 bool AddItemThenPredecessors(syncable::BaseTransaction* trans, |
136 syncable::ModelEnumSet throttled_types, | 136 syncable::ModelTypeSet throttled_types, |
137 syncable::Entry* item, | 137 syncable::Entry* item, |
138 syncable::IndexedBitField inclusion_filter, | 138 syncable::IndexedBitField inclusion_filter, |
139 sessions::OrderedCommitSet* result); | 139 sessions::OrderedCommitSet* result); |
140 void AddPredecessorsThenItem(syncable::BaseTransaction* trans, | 140 void AddPredecessorsThenItem(syncable::BaseTransaction* trans, |
141 syncable::ModelEnumSet throttled_types, | 141 syncable::ModelTypeSet throttled_types, |
142 syncable::Entry* item, | 142 syncable::Entry* item, |
143 syncable::IndexedBitField inclusion_filter, | 143 syncable::IndexedBitField inclusion_filter, |
144 const ModelSafeRoutingInfo& routes); | 144 const ModelSafeRoutingInfo& routes); |
145 | 145 |
146 bool IsCommitBatchFull(); | 146 bool IsCommitBatchFull(); |
147 | 147 |
148 void AddCreatesAndMoves(const vector<int64>& unsynced_handles, | 148 void AddCreatesAndMoves(const vector<int64>& unsynced_handles, |
149 syncable::WriteTransaction* write_transaction, | 149 syncable::WriteTransaction* write_transaction, |
150 const ModelSafeRoutingInfo& routes, | 150 const ModelSafeRoutingInfo& routes, |
151 syncable::ModelEnumSet throttled_types); | 151 syncable::ModelTypeSet throttled_types); |
152 | 152 |
153 void AddDeletes(const vector<int64>& unsynced_handles, | 153 void AddDeletes(const vector<int64>& unsynced_handles, |
154 syncable::WriteTransaction* write_transaction); | 154 syncable::WriteTransaction* write_transaction); |
155 | 155 |
156 scoped_ptr<sessions::OrderedCommitSet> ordered_commit_set_; | 156 scoped_ptr<sessions::OrderedCommitSet> ordered_commit_set_; |
157 | 157 |
158 int requested_commit_batch_size_; | 158 int requested_commit_batch_size_; |
159 bool passphrase_missing_; | 159 bool passphrase_missing_; |
160 syncable::ModelEnumSet encrypted_types_; | 160 syncable::ModelTypeSet encrypted_types_; |
161 | 161 |
162 DISALLOW_COPY_AND_ASSIGN(GetCommitIdsCommand); | 162 DISALLOW_COPY_AND_ASSIGN(GetCommitIdsCommand); |
163 }; | 163 }; |
164 | 164 |
165 } // namespace browser_sync | 165 } // namespace browser_sync |
166 | 166 |
167 #endif // CHROME_BROWSER_SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_ | 167 #endif // CHROME_BROWSER_SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_ |
OLD | NEW |