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 #include "chrome/browser/sync/syncable/syncable.h" | 5 #include "chrome/browser/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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 ScopedKernelLock lock(this); | 1018 ScopedKernelLock lock(this); |
1019 copy(kernel_->unsynced_metahandles->begin(), | 1019 copy(kernel_->unsynced_metahandles->begin(), |
1020 kernel_->unsynced_metahandles->end(), back_inserter(*result)); | 1020 kernel_->unsynced_metahandles->end(), back_inserter(*result)); |
1021 } | 1021 } |
1022 | 1022 |
1023 int64 Directory::unsynced_entity_count() const { | 1023 int64 Directory::unsynced_entity_count() const { |
1024 ScopedKernelLock lock(this); | 1024 ScopedKernelLock lock(this); |
1025 return kernel_->unsynced_metahandles->size(); | 1025 return kernel_->unsynced_metahandles->size(); |
1026 } | 1026 } |
1027 | 1027 |
1028 syncable::ModelTypeBitSet | 1028 FullModelEnumSet Directory::GetServerTypesWithUnappliedUpdates( |
1029 Directory::GetServerTypesWithUnappliedUpdates( | 1029 BaseTransaction* trans) const { |
1030 BaseTransaction* trans) const { | 1030 syncable::FullModelEnumSet server_types; |
1031 syncable::ModelTypeBitSet server_types; | |
1032 ScopedKernelLock lock(this); | 1031 ScopedKernelLock lock(this); |
1033 for (int i = 0; i < MODEL_TYPE_COUNT; ++i) { | 1032 for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { |
1034 if (!kernel_->unapplied_update_metahandles[i].empty()) { | 1033 const ModelType type = ModelTypeFromInt(i); |
1035 server_types.set(i); | 1034 if (!kernel_->unapplied_update_metahandles[type].empty()) { |
| 1035 server_types.Put(type); |
1036 } | 1036 } |
1037 } | 1037 } |
1038 return server_types; | 1038 return server_types; |
1039 } | 1039 } |
1040 | 1040 |
1041 void Directory::GetUnappliedUpdateMetaHandles( | 1041 void Directory::GetUnappliedUpdateMetaHandles( |
1042 BaseTransaction* trans, | 1042 BaseTransaction* trans, |
1043 syncable::ModelTypeBitSet server_types, | 1043 FullModelEnumSet server_types, |
1044 UnappliedUpdateMetaHandles* result) { | 1044 UnappliedUpdateMetaHandles* result) { |
1045 result->clear(); | 1045 result->clear(); |
1046 ScopedKernelLock lock(this); | 1046 ScopedKernelLock lock(this); |
1047 for (int i = 0; i < MODEL_TYPE_COUNT; ++i) { | 1047 for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { |
1048 const ModelType type = ModelTypeFromInt(i); | 1048 const ModelType type = ModelTypeFromInt(i); |
1049 if (server_types.test(type)) { | 1049 if (server_types.Has(type)) { |
1050 std::copy(kernel_->unapplied_update_metahandles[type].begin(), | 1050 std::copy(kernel_->unapplied_update_metahandles[type].begin(), |
1051 kernel_->unapplied_update_metahandles[type].end(), | 1051 kernel_->unapplied_update_metahandles[type].end(), |
1052 back_inserter(*result)); | 1052 back_inserter(*result)); |
1053 } | 1053 } |
1054 } | 1054 } |
1055 } | 1055 } |
1056 | 1056 |
1057 | 1057 |
1058 class IdFilter { | 1058 class IdFilter { |
1059 public: | 1059 public: |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2112 if (entry->ref(NEXT_ID).IsRoot() || | 2112 if (entry->ref(NEXT_ID).IsRoot() || |
2113 entry->ref(NEXT_ID) != entry->ref(PREV_ID)) { | 2113 entry->ref(NEXT_ID) != entry->ref(PREV_ID)) { |
2114 return entry; | 2114 return entry; |
2115 } | 2115 } |
2116 } | 2116 } |
2117 // There were no children in the linked list. | 2117 // There were no children in the linked list. |
2118 return NULL; | 2118 return NULL; |
2119 } | 2119 } |
2120 | 2120 |
2121 } // namespace syncable | 2121 } // namespace syncable |
OLD | NEW |