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

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

Issue 642023004: Standardize usage of virtual/override/final in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // An entry with this tag already exists. 49 // An entry with this tag already exists.
50 INIT_FAILED_ENTRY_ALREADY_EXISTS, 50 INIT_FAILED_ENTRY_ALREADY_EXISTS,
51 // The constructor for a new MutableEntry with the specified data failed. 51 // The constructor for a new MutableEntry with the specified data failed.
52 INIT_FAILED_COULD_NOT_CREATE_ENTRY, 52 INIT_FAILED_COULD_NOT_CREATE_ENTRY,
53 // Setting the predecessor failed 53 // Setting the predecessor failed
54 INIT_FAILED_SET_PREDECESSOR, 54 INIT_FAILED_SET_PREDECESSOR,
55 }; 55 };
56 56
57 // Create a WriteNode using the given transaction. 57 // Create a WriteNode using the given transaction.
58 explicit WriteNode(WriteTransaction* transaction); 58 explicit WriteNode(WriteTransaction* transaction);
59 virtual ~WriteNode(); 59 ~WriteNode() override;
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 InitByLookupResult InitByIdLookup(int64 id) override;
66 virtual InitByLookupResult InitByClientTagLookup( 66 InitByLookupResult InitByClientTagLookup(ModelType model_type,
67 ModelType model_type, 67 const std::string& tag) override;
68 const std::string& tag) override;
69 68
70 // Create a new bookmark node with the specified parent and predecessor. Use 69 // Create a new bookmark node with the specified parent and predecessor. Use
71 // a NULL |predecessor| to indicate that this is to be the first child. 70 // a NULL |predecessor| to indicate that this is to be the first child.
72 // |predecessor| must be a child of |new_parent| or NULL. Returns false on 71 // |predecessor| must be a child of |new_parent| or NULL. Returns false on
73 // failure. 72 // failure.
74 bool InitBookmarkByCreation(const BaseNode& parent, 73 bool InitBookmarkByCreation(const BaseNode& parent,
75 const BaseNode* predecessor); 74 const BaseNode* predecessor);
76 75
77 // Create nodes using this function if they're unique items that 76 // 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 77 // you want to fetch using client_tag. Note that the behavior of these
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // Set the priority preference specifics. 170 // Set the priority preference specifics.
172 // Should only be called if GetModelType() == PRIORITY_PREFERENCE. 171 // Should only be called if GetModelType() == PRIORITY_PREFERENCE.
173 void SetPriorityPreferenceSpecifics( 172 void SetPriorityPreferenceSpecifics(
174 const sync_pb::PriorityPreferenceSpecifics& specifics); 173 const sync_pb::PriorityPreferenceSpecifics& specifics);
175 174
176 // Set the attachment metadata. 175 // Set the attachment metadata.
177 void SetAttachmentMetadata( 176 void SetAttachmentMetadata(
178 const sync_pb::AttachmentMetadata& attachment_metadata); 177 const sync_pb::AttachmentMetadata& attachment_metadata);
179 178
180 // Implementation of BaseNode's abstract virtual accessors. 179 // Implementation of BaseNode's abstract virtual accessors.
181 virtual const syncable::Entry* GetEntry() const override; 180 const syncable::Entry* GetEntry() const override;
182 181
183 virtual const BaseTransaction* GetTransaction() const override; 182 const BaseTransaction* GetTransaction() const override;
184 183
185 syncable::MutableEntry* GetMutableEntryForTest(); 184 syncable::MutableEntry* GetMutableEntryForTest();
186 185
187 private: 186 private:
188 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData); 187 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData);
189 188
190 void* operator new(size_t size); // Node is meant for stack use only. 189 void* operator new(size_t size); // Node is meant for stack use only.
191 190
192 // Helper to set the previous node. 191 // Helper to set the previous node.
193 bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT; 192 bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT;
194 193
195 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an 194 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an
196 // upcoming commit pass. 195 // upcoming commit pass.
197 void MarkForSyncing(); 196 void MarkForSyncing();
198 197
199 // The underlying syncable object which this class wraps. 198 // The underlying syncable object which this class wraps.
200 syncable::MutableEntry* entry_; 199 syncable::MutableEntry* entry_;
201 200
202 // The sync API transaction that is the parent of this node. 201 // The sync API transaction that is the parent of this node.
203 WriteTransaction* transaction_; 202 WriteTransaction* transaction_;
204 203
205 DISALLOW_COPY_AND_ASSIGN(WriteNode); 204 DISALLOW_COPY_AND_ASSIGN(WriteNode);
206 }; 205 };
207 206
208 } // namespace syncer 207 } // namespace syncer
209 208
210 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ 209 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/test/test_internal_components_factory.h ('k') | sync/internal_api/public/write_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698