| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef SYNC_SESSIONS_ORDERED_COMMIT_SET_H_ | 5 #ifndef SYNC_SESSIONS_ORDERED_COMMIT_SET_H_ |
| 6 #define SYNC_SESSIONS_ORDERED_COMMIT_SET_H_ | 6 #define SYNC_SESSIONS_ORDERED_COMMIT_SET_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 ModelSafeGroup group) const; | 68 ModelSafeGroup group) const; |
| 69 | 69 |
| 70 size_t Size() const { | 70 size_t Size() const { |
| 71 return commit_ids_.size(); | 71 return commit_ids_.size(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool Empty() const { | 74 bool Empty() const { |
| 75 return Size() == 0; | 75 return Size() == 0; |
| 76 } | 76 } |
| 77 | 77 |
| 78 // Returns all the types that are included in this list. |
| 79 ModelTypeSet Types() const { |
| 80 return types_in_list_; |
| 81 } |
| 82 |
| 78 // Returns true iff any of the commit ids added to this set have model type | 83 // Returns true iff any of the commit ids added to this set have model type |
| 79 // BOOKMARKS. | 84 // BOOKMARKS. |
| 80 bool HasBookmarkCommitId() const; | 85 bool HasBookmarkCommitId() const; |
| 81 | 86 |
| 82 void Append(const OrderedCommitSet& other); | 87 void Append(const OrderedCommitSet& other); |
| 83 void AppendReverse(const OrderedCommitSet& other); | 88 void AppendReverse(const OrderedCommitSet& other); |
| 84 void Truncate(size_t max_size); | 89 void Truncate(size_t max_size); |
| 85 | 90 |
| 86 // Removes all entries from this set. | 91 // Removes all entries from this set. |
| 87 void Clear(); | 92 void Clear(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 108 Projections projections_; | 113 Projections projections_; |
| 109 | 114 |
| 110 // We need this because of operations like AppendReverse that take ids from | 115 // We need this because of operations like AppendReverse that take ids from |
| 111 // one OrderedCommitSet and insert into another -- we need to know the | 116 // one OrderedCommitSet and insert into another -- we need to know the |
| 112 // group for each ID so that the insertion can update the appropriate | 117 // group for each ID so that the insertion can update the appropriate |
| 113 // projection. We could store it in commit_ids_, but sometimes we want | 118 // projection. We could store it in commit_ids_, but sometimes we want |
| 114 // to just return the vector of Ids, so this is more straightforward | 119 // to just return the vector of Ids, so this is more straightforward |
| 115 // and shouldn't take up too much extra space since commit lists are small. | 120 // and shouldn't take up too much extra space since commit lists are small. |
| 116 std::vector<ModelType> types_; | 121 std::vector<ModelType> types_; |
| 117 | 122 |
| 123 // The set of types which are included in this particular list. |
| 124 ModelTypeSet types_in_list_; |
| 125 |
| 118 ModelSafeRoutingInfo routes_; | 126 ModelSafeRoutingInfo routes_; |
| 119 }; | 127 }; |
| 120 | 128 |
| 121 } // namespace sessions | 129 } // namespace sessions |
| 122 } // namespace syncer | 130 } // namespace syncer |
| 123 | 131 |
| 124 #endif // SYNC_SESSIONS_ORDERED_COMMIT_SET_H_ | 132 #endif // SYNC_SESSIONS_ORDERED_COMMIT_SET_H_ |
| 125 | 133 |
| OLD | NEW |