diff options
author | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-03 20:45:28 +0000 |
---|---|---|
committer | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-03 20:45:28 +0000 |
commit | 65e95b761e3a5a284b85b62968f9d5629828ad54 (patch) | |
tree | 3da236126fc4a2f05a10adebfdeef8b6d02705c1 /sync/internal_api/write_node.cc | |
parent | 1084f4d4971a2a620aac25d193b6942ca1faa69a (diff) | |
download | chromium_src-65e95b761e3a5a284b85b62968f9d5629828ad54.zip chromium_src-65e95b761e3a5a284b85b62968f9d5629828ad54.tar.gz chromium_src-65e95b761e3a5a284b85b62968f9d5629828ad54.tar.bz2 |
sync: Specialize functions that fetch type root
Adds functions to look up the root node of a give type. This replaces
most of the use cases for the functions that look up a node by unique
server tag, so those functions have been renamed to indicate their
near-deprecation.
This is part of the effort to remove the client's dependence on the
server for the creation of type root nodes. Although it's unlikely that
we can make this work for existing types, new types should be prepared
to work properly in the absence of tyep root nodes. The first step on
that path is to abstract away the mechanism by which we look up the type
roots.
Renaming the old lookup by tag functions allows us to ensure that there
no remaining cases where the code base looks up type roots by server
tag. This CL also adds a few DCHECKs to ensure type roots are never
looked up using the old lookup by server tag functions.
BUG=373869
Review URL: https://codereview.chromium.org/302173004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/write_node.cc')
-rw-r--r-- | sync/internal_api/write_node.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sync/internal_api/write_node.cc b/sync/internal_api/write_node.cc index cefd6df..1fbe029 100644 --- a/sync/internal_api/write_node.cc +++ b/sync/internal_api/write_node.cc @@ -310,13 +310,12 @@ BaseNode::InitByLookupResult WriteNode::InitByClientTagLookup( return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; } -BaseNode::InitByLookupResult WriteNode::InitByTagLookup( - const std::string& tag) { +BaseNode::InitByLookupResult WriteNode::InitTypeRoot(ModelType type) { DCHECK(!entry_) << "Init called twice"; - if (tag.empty()) + if (!IsRealDataType(type)) return INIT_FAILED_PRECONDITION; entry_ = new syncable::MutableEntry(transaction_->GetWrappedWriteTrans(), - syncable::GET_BY_SERVER_TAG, tag); + syncable::GET_TYPE_ROOT, type); if (!entry_->good()) return INIT_FAILED_ENTRY_NOT_GOOD; if (entry_->GetIsDel()) |