| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/entry.h" | 5 #include "sync/syncable/entry.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include <iomanip> | 9 #include <iomanip> |
| 8 | 10 |
| 9 #include "sync/syncable/directory.h" | 11 #include "sync/syncable/directory.h" |
| 10 #include "sync/syncable/syncable_base_transaction.h" | 12 #include "sync/syncable/syncable_base_transaction.h" |
| 11 | 13 |
| 12 namespace syncer { | 14 namespace syncer { |
| 13 namespace syncable { | 15 namespace syncable { |
| 14 | 16 |
| 15 Entry::Entry(BaseTransaction* trans, GetById, const Id& id) | 17 Entry::Entry(BaseTransaction* trans, GetById, const Id& id) |
| 16 : basetrans_(trans) { | 18 : basetrans_(trans) { |
| 17 kernel_ = trans->directory()->GetEntryById(id); | 19 kernel_ = trans->directory()->GetEntryById(id); |
| 18 } | 20 } |
| 19 | 21 |
| 20 Entry::Entry(BaseTransaction* trans, GetByClientTag, const std::string& tag) | 22 Entry::Entry(BaseTransaction* trans, GetByClientTag, const std::string& tag) |
| 21 : basetrans_(trans) { | 23 : basetrans_(trans) { |
| 22 kernel_ = trans->directory()->GetEntryByClientTag(tag); | 24 kernel_ = trans->directory()->GetEntryByClientTag(tag); |
| 23 } | 25 } |
| 24 | 26 |
| 25 Entry::Entry(BaseTransaction* trans, GetTypeRoot, ModelType type) | 27 Entry::Entry(BaseTransaction* trans, GetTypeRoot, ModelType type) |
| 26 : basetrans_(trans) { | 28 : basetrans_(trans) { |
| 27 const std::string& tag = ModelTypeToRootTag(type); | 29 const std::string& tag = ModelTypeToRootTag(type); |
| 28 kernel_ = trans->directory()->GetEntryByServerTag(tag); | 30 kernel_ = trans->directory()->GetEntryByServerTag(tag); |
| 29 } | 31 } |
| 30 | 32 |
| 31 Entry::Entry(BaseTransaction* trans, GetByHandle, int64 metahandle) | 33 Entry::Entry(BaseTransaction* trans, GetByHandle, int64_t metahandle) |
| 32 : basetrans_(trans) { | 34 : basetrans_(trans) { |
| 33 kernel_ = trans->directory()->GetEntryByHandle(metahandle); | 35 kernel_ = trans->directory()->GetEntryByHandle(metahandle); |
| 34 } | 36 } |
| 35 | 37 |
| 36 Entry::Entry(BaseTransaction* trans, GetByServerTag, const std::string& tag) | 38 Entry::Entry(BaseTransaction* trans, GetByServerTag, const std::string& tag) |
| 37 : basetrans_(trans) { | 39 : basetrans_(trans) { |
| 38 kernel_ = trans->directory()->GetEntryByServerTag(tag); | 40 kernel_ = trans->directory()->GetEntryByServerTag(tag); |
| 39 } | 41 } |
| 40 | 42 |
| 41 Directory* Entry::dir() const { | 43 Directory* Entry::dir() const { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 104 } |
| 103 | 105 |
| 104 Id Entry::GetSuccessorId() const { | 106 Id Entry::GetSuccessorId() const { |
| 105 return dir()->GetSuccessorId(kernel_); | 107 return dir()->GetSuccessorId(kernel_); |
| 106 } | 108 } |
| 107 | 109 |
| 108 Id Entry::GetFirstChildId() const { | 110 Id Entry::GetFirstChildId() const { |
| 109 return dir()->GetFirstChildId(basetrans_, kernel_); | 111 return dir()->GetFirstChildId(basetrans_, kernel_); |
| 110 } | 112 } |
| 111 | 113 |
| 112 void Entry::GetChildHandles(std::vector<int64>* result) const { | 114 void Entry::GetChildHandles(std::vector<int64_t>* result) const { |
| 113 dir()->GetChildHandlesById(basetrans_, GetId(), result); | 115 dir()->GetChildHandlesById(basetrans_, GetId(), result); |
| 114 } | 116 } |
| 115 | 117 |
| 116 int Entry::GetTotalNodeCount() const { | 118 int Entry::GetTotalNodeCount() const { |
| 117 return dir()->GetTotalNodeCount(basetrans_, kernel_); | 119 return dir()->GetTotalNodeCount(basetrans_, kernel_); |
| 118 } | 120 } |
| 119 | 121 |
| 120 int Entry::GetPositionIndex() const { | 122 int Entry::GetPositionIndex() const { |
| 121 return dir()->GetPositionIndex(basetrans_, kernel_); | 123 return dir()->GetPositionIndex(basetrans_, kernel_); |
| 122 } | 124 } |
| 123 | 125 |
| 124 bool Entry::ShouldMaintainPosition() const { | 126 bool Entry::ShouldMaintainPosition() const { |
| 125 return kernel_->ShouldMaintainPosition(); | 127 return kernel_->ShouldMaintainPosition(); |
| 126 } | 128 } |
| 127 | 129 |
| 128 bool Entry::ShouldMaintainHierarchy() const { | 130 bool Entry::ShouldMaintainHierarchy() const { |
| 129 return kernel_->ShouldMaintainHierarchy(); | 131 return kernel_->ShouldMaintainHierarchy(); |
| 130 } | 132 } |
| 131 | 133 |
| 132 std::ostream& operator<<(std::ostream& os, const Entry& entry) { | 134 std::ostream& operator<<(std::ostream& os, const Entry& entry) { |
| 133 os << *(entry.kernel_); | 135 os << *(entry.kernel_); |
| 134 return os; | 136 return os; |
| 135 } | 137 } |
| 136 | 138 |
| 137 } // namespace syncable | 139 } // namespace syncable |
| 138 } // namespace syncer | 140 } // namespace syncer |
| OLD | NEW |