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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 for (MetahandlesMap::iterator it = kernel_->metahandles_map.begin(); | 1127 for (MetahandlesMap::iterator it = kernel_->metahandles_map.begin(); |
1128 it != kernel_->metahandles_map.end(); ++it) { | 1128 it != kernel_->metahandles_map.end(); ++it) { |
1129 EntryKernel* entry = it->second; | 1129 EntryKernel* entry = it->second; |
1130 const ModelType type = GetModelTypeFromSpecifics(entry->ref(SPECIFICS)); | 1130 const ModelType type = GetModelTypeFromSpecifics(entry->ref(SPECIFICS)); |
1131 (*num_entries_by_type)[type]++; | 1131 (*num_entries_by_type)[type]++; |
1132 if (entry->ref(IS_DEL)) | 1132 if (entry->ref(IS_DEL)) |
1133 (*num_to_delete_entries_by_type)[type]++; | 1133 (*num_to_delete_entries_by_type)[type]++; |
1134 } | 1134 } |
1135 } | 1135 } |
1136 | 1136 |
1137 scoped_ptr<base::ListValue> Directory::GetNodeDetailsForType( | 1137 std::unique_ptr<base::ListValue> Directory::GetNodeDetailsForType( |
1138 BaseTransaction* trans, | 1138 BaseTransaction* trans, |
1139 ModelType type) { | 1139 ModelType type) { |
1140 scoped_ptr<base::ListValue> nodes(new base::ListValue()); | 1140 std::unique_ptr<base::ListValue> nodes(new base::ListValue()); |
1141 | 1141 |
1142 ScopedKernelLock lock(this); | 1142 ScopedKernelLock lock(this); |
1143 for (MetahandlesMap::iterator it = kernel_->metahandles_map.begin(); | 1143 for (MetahandlesMap::iterator it = kernel_->metahandles_map.begin(); |
1144 it != kernel_->metahandles_map.end(); ++it) { | 1144 it != kernel_->metahandles_map.end(); ++it) { |
1145 if (GetModelTypeFromSpecifics(it->second->ref(SPECIFICS)) != type) { | 1145 if (GetModelTypeFromSpecifics(it->second->ref(SPECIFICS)) != type) { |
1146 continue; | 1146 continue; |
1147 } | 1147 } |
1148 | 1148 |
1149 EntryKernel* kernel = it->second; | 1149 EntryKernel* kernel = it->second; |
1150 scoped_ptr<base::DictionaryValue> node( | 1150 std::unique_ptr<base::DictionaryValue> node( |
1151 kernel->ToValue(GetCryptographer(trans))); | 1151 kernel->ToValue(GetCryptographer(trans))); |
1152 | 1152 |
1153 // Add the position index if appropriate. This must be done here (and not | 1153 // Add the position index if appropriate. This must be done here (and not |
1154 // in EntryKernel) because the EntryKernel does not have access to its | 1154 // in EntryKernel) because the EntryKernel does not have access to its |
1155 // siblings. | 1155 // siblings. |
1156 if (kernel->ShouldMaintainPosition() && !kernel->ref(IS_DEL)) { | 1156 if (kernel->ShouldMaintainPosition() && !kernel->ref(IS_DEL)) { |
1157 node->SetInteger("positionIndex", GetPositionIndex(trans, kernel)); | 1157 node->SetInteger("positionIndex", GetPositionIndex(trans, kernel)); |
1158 } | 1158 } |
1159 | 1159 |
1160 nodes->Append(node.release()); | 1160 nodes->Append(node.release()); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 Directory::Kernel* Directory::kernel() { | 1578 Directory::Kernel* Directory::kernel() { |
1579 return kernel_; | 1579 return kernel_; |
1580 } | 1580 } |
1581 | 1581 |
1582 const Directory::Kernel* Directory::kernel() const { | 1582 const Directory::Kernel* Directory::kernel() const { |
1583 return kernel_; | 1583 return kernel_; |
1584 } | 1584 } |
1585 | 1585 |
1586 } // namespace syncable | 1586 } // namespace syncable |
1587 } // namespace syncer | 1587 } // namespace syncer |
OLD | NEW |