Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chrome/browser/sync/syncable/syncable.h

Issue 8402014: [Sync] Make GetFirstChildId return a flag indicating success (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup comments Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 918
919 // Returns the child meta handles (even those for deleted/unlinked 919 // Returns the child meta handles (even those for deleted/unlinked
920 // nodes) for given meta handle. Clears |result| if there are no 920 // nodes) for given meta handle. Clears |result| if there are no
921 // children. 921 // children.
922 void GetChildHandlesByHandle(BaseTransaction*, int64 handle, 922 void GetChildHandlesByHandle(BaseTransaction*, int64 handle,
923 ChildHandles* result); 923 ChildHandles* result);
924 924
925 // Returns true iff |id| has children. 925 // Returns true iff |id| has children.
926 bool HasChildren(BaseTransaction* trans, const Id& id); 926 bool HasChildren(BaseTransaction* trans, const Id& id);
927 927
928 // Find the first or last child in the positional ordering under a parent, 928 // Find the first child in the positional ordering under a parent,
929 // and return its id. Returns a root Id if parent has no children. 929 // and fill in |*first_child_id| with its id. Fills in a root Id if
930 Id GetFirstChildId(BaseTransaction* trans, const Id& parent_id); 930 // parent has no children. Returns true if the first child was
931 Id GetLastChildId(BaseTransaction* trans, const Id& parent_id); 931 // successfully found, or false if an error was encountered.
932 bool GetFirstChildId(BaseTransaction* trans, const Id& parent_id,
Nicolas Zea 2011/10/27 18:28:30 WARN_UNUSED_RESULT for new methods that return err
akalin 2011/10/27 21:11:43 Done.
933 Id* first_child_id);
934
935 // Find the last child in the positional ordering under a parent,
936 // and fill in |*first_child_id| with its id. Fills in a root Id if
937 // parent has no children. Returns true if the first child was
938 // successfully found, or false if an error was encountered.
939 bool GetLastChildIdForTest(
Nicolas Zea 2011/10/27 18:28:30 Prefer having first argument on this line and othe
akalin 2011/10/27 21:11:43 Done.
940 BaseTransaction* trans, const Id& parent_id,
941 Id* last_child_id);
932 942
933 // Compute a local predecessor position for |update_item|. The position 943 // Compute a local predecessor position for |update_item|. The position
934 // is determined by the SERVER_POSITION_IN_PARENT value of |update_item|, 944 // is determined by the SERVER_POSITION_IN_PARENT value of |update_item|,
935 // as well as the SERVER_POSITION_IN_PARENT values of any up-to-date 945 // as well as the SERVER_POSITION_IN_PARENT values of any up-to-date
936 // children of |parent_id|. 946 // children of |parent_id|.
937 Id ComputePrevIdFromServerPosition( 947 Id ComputePrevIdFromServerPosition(
938 const EntryKernel* update_item, 948 const EntryKernel* update_item,
939 const syncable::Id& parent_id); 949 const syncable::Id& parent_id);
940 950
941 // SaveChanges works by taking a consistent snapshot of the current Directory 951 // SaveChanges works by taking a consistent snapshot of the current Directory
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 // children of |parent_id| in the kernel's parent_id_child_index. 1157 // children of |parent_id| in the kernel's parent_id_child_index.
1148 ParentIdChildIndex::iterator GetParentChildIndexUpperBound( 1158 ParentIdChildIndex::iterator GetParentChildIndexUpperBound(
1149 const ScopedKernelLock& lock, 1159 const ScopedKernelLock& lock,
1150 const Id& parent_id); 1160 const Id& parent_id);
1151 1161
1152 // Append the handles of the children of |parent_id| to |result|. 1162 // Append the handles of the children of |parent_id| to |result|.
1153 void AppendChildHandles( 1163 void AppendChildHandles(
1154 const ScopedKernelLock& lock, 1164 const ScopedKernelLock& lock,
1155 const Id& parent_id, Directory::ChildHandles* result); 1165 const Id& parent_id, Directory::ChildHandles* result);
1156 1166
1157 // Returns a pointer to what is probably (but not certainly) the 1167 // Return a pointer to what is probably (but not certainly) the
1158 // first child of |parent_id|, or NULL if |parent_id| definitely has 1168 // first child of |parent_id|, or NULL if |parent_id| definitely has
1159 // no children. 1169 // no children.
1160 EntryKernel* GetPossibleFirstChild( 1170 EntryKernel* GetPossibleFirstChild(
1161 const ScopedKernelLock& lock, const Id& parent_id); 1171 const ScopedKernelLock& lock, const Id& parent_id);
1162 1172
1173 // Return a pointer to what is probably (but not certainly) the last
1174 // child of |parent_id|, or NULL if |parent_id| definitely has no
1175 // children.
1176 EntryKernel* GetPossibleLastChildForTest(
1177 const ScopedKernelLock& lock, const Id& parent_id);
1178
1163 Kernel* kernel_; 1179 Kernel* kernel_;
1164 1180
1165 DirectoryBackingStore* store_; 1181 DirectoryBackingStore* store_;
1166 }; 1182 };
1167 1183
1168 class ScopedKernelLock { 1184 class ScopedKernelLock {
1169 public: 1185 public:
1170 explicit ScopedKernelLock(const Directory*); 1186 explicit ScopedKernelLock(const Directory*);
1171 ~ScopedKernelLock() {} 1187 ~ScopedKernelLock() {}
1172 1188
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid); 1274 bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid);
1259 1275
1260 // This function sets only the flags needed to get this entry to sync. 1276 // This function sets only the flags needed to get this entry to sync.
1261 void MarkForSyncing(syncable::MutableEntry* e); 1277 void MarkForSyncing(syncable::MutableEntry* e);
1262 1278
1263 } // namespace syncable 1279 } // namespace syncable
1264 1280
1265 std::ostream& operator <<(std::ostream&, const syncable::Blob&); 1281 std::ostream& operator <<(std::ostream&, const syncable::Blob&);
1266 1282
1267 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ 1283 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698