| 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 #ifndef SYNC_INTERNAL_API_PUBLIC_READ_NODE_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_READ_NODE_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_READ_NODE_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_READ_NODE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 public: | 21 public: |
| 22 // Create an unpopulated ReadNode on the given transaction. Call some flavor | 22 // Create an unpopulated ReadNode on the given transaction. Call some flavor |
| 23 // of Init to populate the ReadNode with a database entry. | 23 // of Init to populate the ReadNode with a database entry. |
| 24 explicit ReadNode(const BaseTransaction* transaction); | 24 explicit ReadNode(const BaseTransaction* transaction); |
| 25 virtual ~ReadNode(); | 25 virtual ~ReadNode(); |
| 26 | 26 |
| 27 // A client must use one (and only one) of the following Init variants to | 27 // A client must use one (and only one) of the following Init variants to |
| 28 // populate the node. | 28 // populate the node. |
| 29 | 29 |
| 30 // BaseNode implementation. | 30 // BaseNode implementation. |
| 31 virtual InitByLookupResult InitByIdLookup(int64 id) OVERRIDE; | 31 virtual InitByLookupResult InitByIdLookup(int64 id) override; |
| 32 virtual InitByLookupResult InitByClientTagLookup( | 32 virtual InitByLookupResult InitByClientTagLookup( |
| 33 ModelType model_type, | 33 ModelType model_type, |
| 34 const std::string& tag) OVERRIDE; | 34 const std::string& tag) override; |
| 35 | 35 |
| 36 // There is always a root node, so this can't fail. The root node is | 36 // There is always a root node, so this can't fail. The root node is |
| 37 // never mutable, so root lookup is only possible on a ReadNode. | 37 // never mutable, so root lookup is only possible on a ReadNode. |
| 38 void InitByRootLookup(); | 38 void InitByRootLookup(); |
| 39 | 39 |
| 40 // Returns the type root node, if it exists. This is usually created by the | 40 // Returns the type root node, if it exists. This is usually created by the |
| 41 // server during first sync. Eventually, we plan to remove support for it | 41 // server during first sync. Eventually, we plan to remove support for it |
| 42 // from the protocol and have the client create the node instead. | 42 // from the protocol and have the client create the node instead. |
| 43 InitByLookupResult InitTypeRoot(ModelType type); | 43 InitByLookupResult InitTypeRoot(ModelType type); |
| 44 | 44 |
| 45 // Returns a server-created and unique-server-tagged item. | 45 // Returns a server-created and unique-server-tagged item. |
| 46 // | 46 // |
| 47 // This functionality is only useful for bookmarks because only bookmarks | 47 // This functionality is only useful for bookmarks because only bookmarks |
| 48 // have server-tagged items. All other server-tagged items are type root | 48 // have server-tagged items. All other server-tagged items are type root |
| 49 // nodes, which should be looked up with InitTypeRoot(). | 49 // nodes, which should be looked up with InitTypeRoot(). |
| 50 InitByLookupResult InitByTagLookupForBookmarks(const std::string& tag); | 50 InitByLookupResult InitByTagLookupForBookmarks(const std::string& tag); |
| 51 | 51 |
| 52 // Implementation of BaseNode's abstract virtual accessors. | 52 // Implementation of BaseNode's abstract virtual accessors. |
| 53 virtual const syncable::Entry* GetEntry() const OVERRIDE; | 53 virtual const syncable::Entry* GetEntry() const override; |
| 54 virtual const BaseTransaction* GetTransaction() const OVERRIDE; | 54 virtual const BaseTransaction* GetTransaction() const override; |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 ReadNode(); | 57 ReadNode(); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 void* operator new(size_t size); // Node is meant for stack use only. | 60 void* operator new(size_t size); // Node is meant for stack use only. |
| 61 | 61 |
| 62 // The underlying syncable object which this class wraps. | 62 // The underlying syncable object which this class wraps. |
| 63 syncable::Entry* entry_; | 63 syncable::Entry* entry_; |
| 64 | 64 |
| 65 // The sync API transaction that is the parent of this node. | 65 // The sync API transaction that is the parent of this node. |
| 66 const BaseTransaction* transaction_; | 66 const BaseTransaction* transaction_; |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(ReadNode); | 68 DISALLOW_COPY_AND_ASSIGN(ReadNode); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace syncer | 71 } // namespace syncer |
| 72 | 72 |
| 73 #endif // SYNC_INTERNAL_API_PUBLIC_READ_NODE_H_ | 73 #endif // SYNC_INTERNAL_API_PUBLIC_READ_NODE_H_ |
| OLD | NEW |