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

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

Issue 1545553003: Switch to standard integer types in sync/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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_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 <stddef.h>
9 #include <stdint.h>
10
8 #include <string> 11 #include <string>
9 12
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/macros.h"
12 #include "sync/base/sync_export.h" 15 #include "sync/base/sync_export.h"
13 #include "sync/internal_api/public/base/model_type.h" 16 #include "sync/internal_api/public/base/model_type.h"
14 #include "sync/internal_api/public/base_node.h" 17 #include "sync/internal_api/public/base_node.h"
15 18
16 namespace syncer { 19 namespace syncer {
17 20
18 // ReadNode wraps a syncable::Entry to provide the functionality of a 21 // ReadNode wraps a syncable::Entry to provide the functionality of a
19 // read-only BaseNode. 22 // read-only BaseNode.
20 class SYNC_EXPORT ReadNode : public BaseNode { 23 class SYNC_EXPORT ReadNode : public BaseNode {
21 public: 24 public:
22 // Create an unpopulated ReadNode on the given transaction. Call some flavor 25 // Create an unpopulated ReadNode on the given transaction. Call some flavor
23 // of Init to populate the ReadNode with a database entry. 26 // of Init to populate the ReadNode with a database entry.
24 explicit ReadNode(const BaseTransaction* transaction); 27 explicit ReadNode(const BaseTransaction* transaction);
25 ~ReadNode() override; 28 ~ReadNode() override;
26 29
27 // A client must use one (and only one) of the following Init variants to 30 // A client must use one (and only one) of the following Init variants to
28 // populate the node. 31 // populate the node.
29 32
30 // BaseNode implementation. 33 // BaseNode implementation.
31 InitByLookupResult InitByIdLookup(int64 id) override; 34 InitByLookupResult InitByIdLookup(int64_t id) override;
32 InitByLookupResult InitByClientTagLookup(ModelType model_type, 35 InitByLookupResult InitByClientTagLookup(ModelType model_type,
33 const std::string& tag) override; 36 const std::string& tag) override;
34 37
35 // There is always a root node, so this can't fail. The root node is 38 // There is always a root node, so this can't fail. The root node is
36 // never mutable, so root lookup is only possible on a ReadNode. 39 // never mutable, so root lookup is only possible on a ReadNode.
37 void InitByRootLookup(); 40 void InitByRootLookup();
38 41
39 // Returns the type root node, if it exists. This is usually created by the 42 // Returns the type root node, if it exists. This is usually created by the
40 // server during first sync. Eventually, we plan to remove support for it 43 // server during first sync. Eventually, we plan to remove support for it
41 // from the protocol and have the client create the node instead. 44 // from the protocol and have the client create the node instead.
42 InitByLookupResult InitTypeRoot(ModelType type); 45 InitByLookupResult InitTypeRoot(ModelType type);
43 46
44 // Returns a server-created and unique-server-tagged item. 47 // Returns a server-created and unique-server-tagged item.
45 // 48 //
46 // This functionality is only useful for bookmarks because only bookmarks 49 // This functionality is only useful for bookmarks because only bookmarks
47 // have server-tagged items. All other server-tagged items are type root 50 // have server-tagged items. All other server-tagged items are type root
48 // nodes, which should be looked up with InitTypeRoot(). 51 // nodes, which should be looked up with InitTypeRoot().
49 InitByLookupResult InitByTagLookupForBookmarks(const std::string& tag); 52 InitByLookupResult InitByTagLookupForBookmarks(const std::string& tag);
50 53
51 // Returns transaction version of the last transaction where this node has 54 // Returns transaction version of the last transaction where this node has
52 // been modified. 55 // been modified.
53 int64 GetTransactionVersion() const; 56 int64_t GetTransactionVersion() const;
54 57
55 // Implementation of BaseNode's abstract virtual accessors. 58 // Implementation of BaseNode's abstract virtual accessors.
56 const syncable::Entry* GetEntry() const override; 59 const syncable::Entry* GetEntry() const override;
57 const BaseTransaction* GetTransaction() const override; 60 const BaseTransaction* GetTransaction() const override;
58 61
59 protected: 62 protected:
60 ReadNode(); 63 ReadNode();
61 64
62 private: 65 private:
63 void* operator new(size_t size); // Node is meant for stack use only. 66 void* operator new(size_t size); // Node is meant for stack use only.
64 67
65 // The underlying syncable object which this class wraps. 68 // The underlying syncable object which this class wraps.
66 syncable::Entry* entry_; 69 syncable::Entry* entry_;
67 70
68 // The sync API transaction that is the parent of this node. 71 // The sync API transaction that is the parent of this node.
69 const BaseTransaction* transaction_; 72 const BaseTransaction* transaction_;
70 73
71 DISALLOW_COPY_AND_ASSIGN(ReadNode); 74 DISALLOW_COPY_AND_ASSIGN(ReadNode);
72 }; 75 };
73 76
74 } // namespace syncer 77 } // namespace syncer
75 78
76 #endif // SYNC_INTERNAL_API_PUBLIC_READ_NODE_H_ 79 #endif // SYNC_INTERNAL_API_PUBLIC_READ_NODE_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/non_blocking_sync_common.h ('k') | sync/internal_api/public/read_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698