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> |
11 #include <iterator> | 11 #include <iterator> |
| 12 #include <utility> |
12 | 13 |
13 #include "base/base64.h" | 14 #include "base/base64.h" |
14 #include "base/guid.h" | 15 #include "base/guid.h" |
15 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
16 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
18 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
19 #include "sync/internal_api/public/base/attachment_id_proto.h" | 20 #include "sync/internal_api/public/base/attachment_id_proto.h" |
20 #include "sync/internal_api/public/base/unique_position.h" | 21 #include "sync/internal_api/public/base/unique_position.h" |
21 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | 22 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 std::unique_ptr<base::DictionaryValue> node( | 1151 std::unique_ptr<base::DictionaryValue> node( |
1151 kernel->ToValue(GetCryptographer(trans))); | 1152 kernel->ToValue(GetCryptographer(trans))); |
1152 | 1153 |
1153 // Add the position index if appropriate. This must be done here (and not | 1154 // 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 | 1155 // in EntryKernel) because the EntryKernel does not have access to its |
1155 // siblings. | 1156 // siblings. |
1156 if (kernel->ShouldMaintainPosition() && !kernel->ref(IS_DEL)) { | 1157 if (kernel->ShouldMaintainPosition() && !kernel->ref(IS_DEL)) { |
1157 node->SetInteger("positionIndex", GetPositionIndex(trans, kernel)); | 1158 node->SetInteger("positionIndex", GetPositionIndex(trans, kernel)); |
1158 } | 1159 } |
1159 | 1160 |
1160 nodes->Append(node.release()); | 1161 nodes->Append(std::move(node)); |
1161 } | 1162 } |
1162 | 1163 |
1163 return nodes; | 1164 return nodes; |
1164 } | 1165 } |
1165 | 1166 |
1166 bool Directory::CheckInvariantsOnTransactionClose( | 1167 bool Directory::CheckInvariantsOnTransactionClose( |
1167 syncable::BaseTransaction* trans, | 1168 syncable::BaseTransaction* trans, |
1168 const MetahandleSet& modified_handles) { | 1169 const MetahandleSet& modified_handles) { |
1169 // NOTE: The trans may be in the process of being destructed. Be careful if | 1170 // NOTE: The trans may be in the process of being destructed. Be careful if |
1170 // you wish to call any of its virtual methods. | 1171 // you wish to call any of its virtual methods. |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 Directory::Kernel* Directory::kernel() { | 1579 Directory::Kernel* Directory::kernel() { |
1579 return kernel_; | 1580 return kernel_; |
1580 } | 1581 } |
1581 | 1582 |
1582 const Directory::Kernel* Directory::kernel() const { | 1583 const Directory::Kernel* Directory::kernel() const { |
1583 return kernel_; | 1584 return kernel_; |
1584 } | 1585 } |
1585 | 1586 |
1586 } // namespace syncable | 1587 } // namespace syncable |
1587 } // namespace syncer | 1588 } // namespace syncer |
OLD | NEW |