| 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 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ |
| 6 #define CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ | 6 #define CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <bitset> | 10 #include <bitset> |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 EntryKernel* GetEntryById(const Id& id, ScopedKernelLock* const lock); | 903 EntryKernel* GetEntryById(const Id& id, ScopedKernelLock* const lock); |
| 904 | 904 |
| 905 DirOpenResult OpenImpl(const FilePath& file_path, const std::string& name, | 905 DirOpenResult OpenImpl(const FilePath& file_path, const std::string& name, |
| 906 DirectoryChangeDelegate* delegate); | 906 DirectoryChangeDelegate* delegate); |
| 907 | 907 |
| 908 template <class T> void TestAndSet(T* kernel_data, const T* data_to_set); | 908 template <class T> void TestAndSet(T* kernel_data, const T* data_to_set); |
| 909 | 909 |
| 910 public: | 910 public: |
| 911 typedef std::vector<int64> ChildHandles; | 911 typedef std::vector<int64> ChildHandles; |
| 912 | 912 |
| 913 // Returns the child meta handles for given parent id. Clears | 913 // Returns the child meta handles (even those for deleted/unlinked |
| 914 // |result| if there are no children. | 914 // nodes) for given parent id. Clears |result| if there are no |
| 915 // children. |
| 915 void GetChildHandlesById(BaseTransaction*, const Id& parent_id, | 916 void GetChildHandlesById(BaseTransaction*, const Id& parent_id, |
| 916 ChildHandles* result); | 917 ChildHandles* result); |
| 917 | 918 |
| 918 // Returns the child meta handles for given meta handle. Clears | 919 // Returns the child meta handles (even those for deleted/unlinked |
| 919 // |result| if there are no children. | 920 // nodes) for given meta handle. Clears |result| if there are no |
| 921 // children. |
| 920 void GetChildHandlesByHandle(BaseTransaction*, int64 handle, | 922 void GetChildHandlesByHandle(BaseTransaction*, int64 handle, |
| 921 ChildHandles* result); | 923 ChildHandles* result); |
| 922 | 924 |
| 925 // Returns true iff |id| has children. |
| 926 bool HasChildren(BaseTransaction* trans, const Id& id); |
| 927 |
| 923 // Find the first or last child in the positional ordering under a parent, | 928 // Find the first or last child in the positional ordering under a parent, |
| 924 // and return its id. Returns a root Id if parent has no children. | 929 // and return its id. Returns a root Id if parent has no children. |
| 925 virtual Id GetFirstChildId(BaseTransaction* trans, const Id& parent_id); | 930 Id GetFirstChildId(BaseTransaction* trans, const Id& parent_id); |
| 926 Id GetLastChildId(BaseTransaction* trans, const Id& parent_id); | 931 Id GetLastChildId(BaseTransaction* trans, const Id& parent_id); |
| 927 | 932 |
| 928 // Compute a local predecessor position for |update_item|. The position | 933 // Compute a local predecessor position for |update_item|. The position |
| 929 // is determined by the SERVER_POSITION_IN_PARENT value of |update_item|, | 934 // is determined by the SERVER_POSITION_IN_PARENT value of |update_item|, |
| 930 // as well as the SERVER_POSITION_IN_PARENT values of any up-to-date | 935 // as well as the SERVER_POSITION_IN_PARENT values of any up-to-date |
| 931 // children of |parent_id|. | 936 // children of |parent_id|. |
| 932 Id ComputePrevIdFromServerPosition( | 937 Id ComputePrevIdFromServerPosition( |
| 933 const EntryKernel* update_item, | 938 const EntryKernel* update_item, |
| 934 const syncable::Id& parent_id); | 939 const syncable::Id& parent_id); |
| 935 | 940 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 // children of |parent_id| in the kernel's parent_id_child_index. | 1147 // children of |parent_id| in the kernel's parent_id_child_index. |
| 1143 ParentIdChildIndex::iterator GetParentChildIndexUpperBound( | 1148 ParentIdChildIndex::iterator GetParentChildIndexUpperBound( |
| 1144 const ScopedKernelLock& lock, | 1149 const ScopedKernelLock& lock, |
| 1145 const Id& parent_id); | 1150 const Id& parent_id); |
| 1146 | 1151 |
| 1147 // Append the handles of the children of |parent_id| to |result|. | 1152 // Append the handles of the children of |parent_id| to |result|. |
| 1148 void AppendChildHandles( | 1153 void AppendChildHandles( |
| 1149 const ScopedKernelLock& lock, | 1154 const ScopedKernelLock& lock, |
| 1150 const Id& parent_id, Directory::ChildHandles* result); | 1155 const Id& parent_id, Directory::ChildHandles* result); |
| 1151 | 1156 |
| 1157 // Returns a pointer to what is probably (but not certainly) the |
| 1158 // first child of |parent_id|, or NULL if |parent_id| definitely has |
| 1159 // no children. |
| 1160 EntryKernel* GetPossibleFirstChild( |
| 1161 const ScopedKernelLock& lock, const Id& parent_id); |
| 1162 |
| 1152 Kernel* kernel_; | 1163 Kernel* kernel_; |
| 1153 | 1164 |
| 1154 DirectoryBackingStore* store_; | 1165 DirectoryBackingStore* store_; |
| 1155 }; | 1166 }; |
| 1156 | 1167 |
| 1157 class ScopedKernelLock { | 1168 class ScopedKernelLock { |
| 1158 public: | 1169 public: |
| 1159 explicit ScopedKernelLock(const Directory*); | 1170 explicit ScopedKernelLock(const Directory*); |
| 1160 ~ScopedKernelLock() {} | 1171 ~ScopedKernelLock() {} |
| 1161 | 1172 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1247 bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid); | 1258 bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid); |
| 1248 | 1259 |
| 1249 // This function sets only the flags needed to get this entry to sync. | 1260 // This function sets only the flags needed to get this entry to sync. |
| 1250 void MarkForSyncing(syncable::MutableEntry* e); | 1261 void MarkForSyncing(syncable::MutableEntry* e); |
| 1251 | 1262 |
| 1252 } // namespace syncable | 1263 } // namespace syncable |
| 1253 | 1264 |
| 1254 std::ostream& operator <<(std::ostream&, const syncable::Blob&); | 1265 std::ostream& operator <<(std::ostream&, const syncable::Blob&); |
| 1255 | 1266 |
| 1256 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ | 1267 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ |
| OLD | NEW |