| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "sync/syncable/syncable.h" | 5 #include "sync/syncable/syncable.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <functional> | 9 #include <functional> |
| 10 #include <iomanip> | 10 #include <iomanip> |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 ScopedKernelLock lock(this); | 1151 ScopedKernelLock lock(this); |
| 1152 copy(kernel_->unsynced_metahandles->begin(), | 1152 copy(kernel_->unsynced_metahandles->begin(), |
| 1153 kernel_->unsynced_metahandles->end(), back_inserter(*result)); | 1153 kernel_->unsynced_metahandles->end(), back_inserter(*result)); |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 int64 Directory::unsynced_entity_count() const { | 1156 int64 Directory::unsynced_entity_count() const { |
| 1157 ScopedKernelLock lock(this); | 1157 ScopedKernelLock lock(this); |
| 1158 return kernel_->unsynced_metahandles->size(); | 1158 return kernel_->unsynced_metahandles->size(); |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 FullModelTypeSet Directory::GetServerTypesWithUnappliedUpdates( | |
| 1162 BaseTransaction* trans) const { | |
| 1163 syncable::FullModelTypeSet server_types; | |
| 1164 ScopedKernelLock lock(this); | |
| 1165 for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { | |
| 1166 const ModelType type = ModelTypeFromInt(i); | |
| 1167 if (!kernel_->unapplied_update_metahandles[type].empty()) { | |
| 1168 server_types.Put(type); | |
| 1169 } | |
| 1170 } | |
| 1171 return server_types; | |
| 1172 } | |
| 1173 | |
| 1174 void Directory::GetUnappliedUpdateMetaHandles( | 1161 void Directory::GetUnappliedUpdateMetaHandles( |
| 1175 BaseTransaction* trans, | 1162 BaseTransaction* trans, |
| 1176 FullModelTypeSet server_types, | 1163 FullModelTypeSet server_types, |
| 1177 std::vector<int64>* result) { | 1164 std::vector<int64>* result) { |
| 1178 result->clear(); | 1165 result->clear(); |
| 1179 ScopedKernelLock lock(this); | 1166 ScopedKernelLock lock(this); |
| 1180 for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { | 1167 for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { |
| 1181 const ModelType type = ModelTypeFromInt(i); | 1168 const ModelType type = ModelTypeFromInt(i); |
| 1182 if (server_types.Has(type)) { | 1169 if (server_types.Has(type)) { |
| 1170 if (kernel_->unapplied_update_metahandles[type].empty()) |
| 1171 continue; |
| 1183 std::copy(kernel_->unapplied_update_metahandles[type].begin(), | 1172 std::copy(kernel_->unapplied_update_metahandles[type].begin(), |
| 1184 kernel_->unapplied_update_metahandles[type].end(), | 1173 kernel_->unapplied_update_metahandles[type].end(), |
| 1185 back_inserter(*result)); | 1174 back_inserter(*result)); |
| 1186 } | 1175 } |
| 1187 } | 1176 } |
| 1188 } | 1177 } |
| 1189 | 1178 |
| 1190 | 1179 |
| 1191 class IdFilter { | 1180 class IdFilter { |
| 1192 public: | 1181 public: |
| (...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2396 if (entry->ref(NEXT_ID).IsRoot() || | 2385 if (entry->ref(NEXT_ID).IsRoot() || |
| 2397 entry->ref(NEXT_ID) != entry->ref(PREV_ID)) { | 2386 entry->ref(NEXT_ID) != entry->ref(PREV_ID)) { |
| 2398 return entry; | 2387 return entry; |
| 2399 } | 2388 } |
| 2400 } | 2389 } |
| 2401 // There were no children in the linked list. | 2390 // There were no children in the linked list. |
| 2402 return NULL; | 2391 return NULL; |
| 2403 } | 2392 } |
| 2404 | 2393 |
| 2405 } // namespace syncable | 2394 } // namespace syncable |
| OLD | NEW |