| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/directory.h" | 5 #include "sync/syncable/directory.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 ScopedKernelLock lock(this); | 903 ScopedKernelLock lock(this); |
| 904 copy(kernel_->unsynced_metahandles.begin(), | 904 copy(kernel_->unsynced_metahandles.begin(), |
| 905 kernel_->unsynced_metahandles.end(), back_inserter(*result)); | 905 kernel_->unsynced_metahandles.end(), back_inserter(*result)); |
| 906 } | 906 } |
| 907 | 907 |
| 908 int64 Directory::unsynced_entity_count() const { | 908 int64 Directory::unsynced_entity_count() const { |
| 909 ScopedKernelLock lock(this); | 909 ScopedKernelLock lock(this); |
| 910 return kernel_->unsynced_metahandles.size(); | 910 return kernel_->unsynced_metahandles.size(); |
| 911 } | 911 } |
| 912 | 912 |
| 913 FullModelTypeSet Directory::GetServerTypesWithUnappliedUpdates( | 913 bool Directory::TypeHasUnappliedUpdates(ModelType type) { |
| 914 BaseTransaction* trans) const { | |
| 915 FullModelTypeSet server_types; | |
| 916 ScopedKernelLock lock(this); | 914 ScopedKernelLock lock(this); |
| 917 for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { | 915 return !kernel_->unapplied_update_metahandles[type].empty(); |
| 918 const ModelType type = ModelTypeFromInt(i); | |
| 919 if (!kernel_->unapplied_update_metahandles[type].empty()) { | |
| 920 server_types.Put(type); | |
| 921 } | |
| 922 } | |
| 923 return server_types; | |
| 924 } | 916 } |
| 925 | 917 |
| 926 void Directory::GetUnappliedUpdateMetaHandles( | 918 void Directory::GetUnappliedUpdateMetaHandles( |
| 927 BaseTransaction* trans, | 919 BaseTransaction* trans, |
| 928 FullModelTypeSet server_types, | 920 FullModelTypeSet server_types, |
| 929 std::vector<int64>* result) { | 921 std::vector<int64>* result) { |
| 930 result->clear(); | 922 result->clear(); |
| 931 ScopedKernelLock lock(this); | 923 ScopedKernelLock lock(this); |
| 932 for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { | 924 for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { |
| 933 const ModelType type = ModelTypeFromInt(i); | 925 const ModelType type = ModelTypeFromInt(i); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 | 1287 |
| 1296 for (OrderedChildSet::const_iterator i = children->begin(); | 1288 for (OrderedChildSet::const_iterator i = children->begin(); |
| 1297 i != children->end(); ++i) { | 1289 i != children->end(); ++i) { |
| 1298 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); | 1290 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); |
| 1299 result->push_back((*i)->ref(META_HANDLE)); | 1291 result->push_back((*i)->ref(META_HANDLE)); |
| 1300 } | 1292 } |
| 1301 } | 1293 } |
| 1302 | 1294 |
| 1303 } // namespace syncable | 1295 } // namespace syncable |
| 1304 } // namespace syncer | 1296 } // namespace syncer |
| OLD | NEW |