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

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

Issue 302173004: sync: Specialize functions that fetch type root (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/GET_BY_SERVER_TAG_DEPRECATED/GET_BY_SERVER_TAG/ Created 6 years, 6 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
« no previous file with comments | « sync/engine/syncer_unittest.cc ('k') | sync/internal_api/public/write_node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 19 matching lines...) Expand all
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 // Each server-created permanent node is tagged with a unique string. 40 // Returns the type root node, if it exists. This is usually created by the
41 // Look up the node with the particular tag. If it does not exist, 41 // server during first sync. Eventually, we plan to remove support for it
42 // return false. 42 // from the protocol and have the client create the node instead.
43 InitByLookupResult InitByTagLookup(const std::string& tag); 43 InitByLookupResult InitTypeRoot(ModelType type);
44
45 // Returns a server-created and unique-server-tagged item.
46 //
47 // This functionality is only useful for bookmarks because only bookmarks
48 // have server-tagged items. All other server-tagged items are type root
49 // nodes, which should be looked up with InitTypeRoot().
50 InitByLookupResult InitByTagLookupForBookmarks(const std::string& tag);
44 51
45 // Implementation of BaseNode's abstract virtual accessors. 52 // Implementation of BaseNode's abstract virtual accessors.
46 virtual const syncable::Entry* GetEntry() const OVERRIDE; 53 virtual const syncable::Entry* GetEntry() const OVERRIDE;
47 virtual const BaseTransaction* GetTransaction() const OVERRIDE; 54 virtual const BaseTransaction* GetTransaction() const OVERRIDE;
48 55
49 protected: 56 protected:
50 ReadNode(); 57 ReadNode();
51 58
52 private: 59 private:
53 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.
54 61
55 // The underlying syncable object which this class wraps. 62 // The underlying syncable object which this class wraps.
56 syncable::Entry* entry_; 63 syncable::Entry* entry_;
57 64
58 // The sync API transaction that is the parent of this node. 65 // The sync API transaction that is the parent of this node.
59 const BaseTransaction* transaction_; 66 const BaseTransaction* transaction_;
60 67
61 DISALLOW_COPY_AND_ASSIGN(ReadNode); 68 DISALLOW_COPY_AND_ASSIGN(ReadNode);
62 }; 69 };
63 70
64 } // namespace syncer 71 } // namespace syncer
65 72
66 #endif // SYNC_INTERNAL_API_PUBLIC_READ_NODE_H_ 73 #endif // SYNC_INTERNAL_API_PUBLIC_READ_NODE_H_
OLDNEW
« no previous file with comments | « sync/engine/syncer_unittest.cc ('k') | sync/internal_api/public/write_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698