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/engine | |
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/engine')
-rw-r--r-- | sync/engine/apply_control_data_updates.cc | 6 | ||||
-rw-r--r-- | sync/engine/apply_control_data_updates_unittest.cc | 3 | ||||
-rw-r--r-- | sync/engine/directory_commit_contribution_unittest.cc | 10 | ||||
-rw-r--r-- | sync/engine/syncer_unittest.cc | 1 |
4 files changed, 6 insertions, 14 deletions
diff --git a/sync/engine/apply_control_data_updates.cc b/sync/engine/apply_control_data_updates.cc index e97741e..9b4b837 100644 --- a/sync/engine/apply_control_data_updates.cc +++ b/sync/engine/apply_control_data_updates.cc @@ -17,7 +17,7 @@ namespace syncer { -using syncable::GET_BY_SERVER_TAG; +using syncable::GET_TYPE_ROOT; using syncable::IS_UNAPPLIED_UPDATE; using syncable::IS_UNSYNCED; using syncable::SERVER_SPECIFICS; @@ -39,9 +39,7 @@ void ApplyControlDataUpdates(syncable::Directory* dir) { ModelTypeSet control_types = ControlTypes(); for (ModelTypeSet::Iterator iter = control_types.First(); iter.Good(); iter.Inc()) { - syncable::MutableEntry entry(&trans, - syncable::GET_BY_SERVER_TAG, - ModelTypeToRootTag(iter.Get())); + syncable::MutableEntry entry(&trans, syncable::GET_TYPE_ROOT, iter.Get()); if (!entry.good()) continue; if (!entry.GetIsUnappliedUpdate()) diff --git a/sync/engine/apply_control_data_updates_unittest.cc b/sync/engine/apply_control_data_updates_unittest.cc index caacfbc..7248d14 100644 --- a/sync/engine/apply_control_data_updates_unittest.cc +++ b/sync/engine/apply_control_data_updates_unittest.cc @@ -188,8 +188,7 @@ TEST_F(ApplyControlDataUpdatesTest, EncryptUnsyncedChanges) { // Simulate another nigori update that doesn't change anything. { syncable::WriteTransaction trans(FROM_HERE, UNITTEST, directory()); - MutableEntry entry(&trans, syncable::GET_BY_SERVER_TAG, - ModelTypeToRootTag(NIGORI)); + MutableEntry entry(&trans, syncable::GET_TYPE_ROOT, NIGORI); ASSERT_TRUE(entry.good()); entry.PutServerVersion(entry_factory_->GetNextRevision()); entry.PutIsUnappliedUpdate(true); diff --git a/sync/engine/directory_commit_contribution_unittest.cc b/sync/engine/directory_commit_contribution_unittest.cc index 475985c..b342b54 100644 --- a/sync/engine/directory_commit_contribution_unittest.cc +++ b/sync/engine/directory_commit_contribution_unittest.cc @@ -36,10 +36,7 @@ class DirectoryCommitContributionTest : public ::testing::Test { int64 CreateUnsyncedItem(syncable::WriteTransaction* trans, ModelType type, const std::string& tag) { - syncable::Entry parent_entry( - trans, - syncable::GET_BY_SERVER_TAG, - ModelTypeToRootTag(type)); + syncable::Entry parent_entry(trans, syncable::GET_TYPE_ROOT, type); syncable::MutableEntry entry( trans, syncable::CREATE, @@ -53,10 +50,7 @@ class DirectoryCommitContributionTest : public ::testing::Test { int64 CreateSyncedItem(syncable::WriteTransaction* trans, ModelType type, const std::string& tag) { - syncable::Entry parent_entry( - trans, - syncable::GET_BY_SERVER_TAG, - ModelTypeToRootTag(type)); + syncable::Entry parent_entry(trans, syncable::GET_TYPE_ROOT, type); syncable::MutableEntry entry( trans, syncable::CREATE, diff --git a/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc index b88feb3..98cde3b 100644 --- a/sync/engine/syncer_unittest.cc +++ b/sync/engine/syncer_unittest.cc @@ -86,6 +86,7 @@ using syncable::GET_BY_HANDLE; using syncable::GET_BY_ID; using syncable::GET_BY_CLIENT_TAG; using syncable::GET_BY_SERVER_TAG; +using syncable::GET_TYPE_ROOT; using syncable::UNITTEST; using sessions::MockDebugInfoGetter; |