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

Side by Side Diff: sync/internal_api/public/write_node.h

Issue 11863011: Revert 176340 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 months 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 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 #ifndef SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_
6 #define SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 // A client must use one (and only one) of the following Init variants to 61 // A client must use one (and only one) of the following Init variants to
62 // populate the node. 62 // populate the node.
63 63
64 // BaseNode implementation. 64 // BaseNode implementation.
65 virtual InitByLookupResult InitByIdLookup(int64 id) OVERRIDE; 65 virtual InitByLookupResult InitByIdLookup(int64 id) OVERRIDE;
66 virtual InitByLookupResult InitByClientTagLookup( 66 virtual InitByLookupResult InitByClientTagLookup(
67 ModelType model_type, 67 ModelType model_type,
68 const std::string& tag) OVERRIDE; 68 const std::string& tag) OVERRIDE;
69 69
70 // Create a new bookmark node with the specified parent and predecessor. Use 70 // Create a new node with the specified parent and predecessor. |model_type|
71 // a NULL |predecessor| to indicate that this is to be the first child. 71 // dictates the type of the item, and controls which EntitySpecifics proto
72 // extension can be used with this item. Use a NULL |predecessor|
73 // to indicate that this is to be the first child.
72 // |predecessor| must be a child of |new_parent| or NULL. Returns false on 74 // |predecessor| must be a child of |new_parent| or NULL. Returns false on
73 // failure. 75 // failure.
74 bool InitBookmarkByCreation(const BaseNode& parent, 76 bool InitByCreation(ModelType model_type,
75 const BaseNode* predecessor); 77 const BaseNode& parent,
78 const BaseNode* predecessor);
76 79
77 // Create nodes using this function if they're unique items that 80 // Create nodes using this function if they're unique items that
78 // you want to fetch using client_tag. Note that the behavior of these 81 // you want to fetch using client_tag. Note that the behavior of these
79 // items is slightly different than that of normal items. 82 // items is slightly different than that of normal items.
80 // Most importantly, if it exists locally, this function will 83 // Most importantly, if it exists locally, this function will
81 // actually undelete it 84 // actually undelete it
82 // Client unique tagged nodes must NOT be folders. 85 // Client unique tagged nodes must NOT be folders.
83 InitUniqueByCreationResult InitUniqueByCreation( 86 InitUniqueByCreationResult InitUniqueByCreation(
84 ModelType model_type, 87 ModelType model_type,
85 const BaseNode& parent, 88 const BaseNode& parent,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 176
174 virtual const BaseTransaction* GetTransaction() const OVERRIDE; 177 virtual const BaseTransaction* GetTransaction() const OVERRIDE;
175 178
176 syncable::MutableEntry* GetMutableEntryForTest(); 179 syncable::MutableEntry* GetMutableEntryForTest();
177 180
178 private: 181 private:
179 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData); 182 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData);
180 183
181 void* operator new(size_t size); // Node is meant for stack use only. 184 void* operator new(size_t size); // Node is meant for stack use only.
182 185
186 // Helper to set model type. This will clear any specifics data.
187 void PutModelType(ModelType model_type);
188
183 // Helper to set the previous node. 189 // Helper to set the previous node.
184 bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT; 190 bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT;
185 191
186 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an 192 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an
187 // upcoming commit pass. 193 // upcoming commit pass.
188 void MarkForSyncing(); 194 void MarkForSyncing();
189 195
190 // The underlying syncable object which this class wraps. 196 // The underlying syncable object which this class wraps.
191 syncable::MutableEntry* entry_; 197 syncable::MutableEntry* entry_;
192 198
193 // The sync API transaction that is the parent of this node. 199 // The sync API transaction that is the parent of this node.
194 WriteTransaction* transaction_; 200 WriteTransaction* transaction_;
195 201
196 DISALLOW_COPY_AND_ASSIGN(WriteNode); 202 DISALLOW_COPY_AND_ASSIGN(WriteNode);
197 }; 203 };
198 204
199 } // namespace syncer 205 } // namespace syncer
200 206
201 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ 207 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/test/test_entry_factory.h ('k') | sync/internal_api/sync_encryption_handler_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698