summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync
diff options
context:
space:
mode:
authorjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-11 15:51:40 +0000
committerjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-11 15:51:40 +0000
commit88f6351cd9da0846003bd1d79840bf9436d6b886 (patch)
tree497bec530ea31d19b05488a3bf119f1cc533cb59 /chrome/browser/sync
parenta6ee41bcba06dba2212bba3fe1df6fc71a4e8f5f (diff)
downloadchromium_src-88f6351cd9da0846003bd1d79840bf9436d6b886.zip
chromium_src-88f6351cd9da0846003bd1d79840bf9436d6b886.tar.gz
chromium_src-88f6351cd9da0846003bd1d79840bf9436d6b886.tar.bz2
Revert 176340
> sync: Initialize entries with a valid model type > > This change modifies two important sync functions. > > The first is MutableEntry's CREATE constructor. It now requires that > the ModelType of the entry to be specified when the entry is create. > This doesn't quite eliminate the existence of nodes without a valid > model type (the CREATE_NEW_UPDATE_ITEM can still make them), but it > helps. > > This paves the way for the upcoming UniquePosition change. Part of that > change is that bookmarks must be granted a unique tag on creation. To > support this, we must know at creation time the type of a new entry, so > we can take the appropriate bookmark-specific steps if necessary. > > The second function to get a new signature is WriteNode's > InitByCreation(), which has been renamed to > WriteNode::InitBookmarkByCreation(). The function can only be used to > create bookmarks, so the new name describes its function more precisely. > > Updates to the call-sites of MutableEntry's constructor make up the > majority of this change. This change also includes some minor updates > to test functions that create entries to make them compatible with the > stricter assertions or to make them more closely reflect real world > behaviour. > > BUG=145412,126505 > > > Review URL: https://chromiumcodereview.appspot.com/11817010 TBR=rlarocque@chromium.org Review URL: https://codereview.chromium.org/11863011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176352 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r--chrome/browser/sync/glue/bookmark_change_processor.cc4
-rw-r--r--chrome/browser/sync/profile_sync_service_autofill_unittest.cc3
-rw-r--r--chrome/browser/sync/profile_sync_service_bookmark_unittest.cc7
3 files changed, 7 insertions, 7 deletions
diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/chrome/browser/sync/glue/bookmark_change_processor.cc
index 344f5a9..b55d279 100644
--- a/chrome/browser/sync/glue/bookmark_change_processor.cc
+++ b/chrome/browser/sync/glue/bookmark_change_processor.cc
@@ -404,7 +404,7 @@ bool BookmarkChangeProcessor::PlaceSyncNode(MoveOrCreate operation,
if (index == 0) {
// Insert into first position.
success = (operation == CREATE) ?
- dst->InitBookmarkByCreation(sync_parent, NULL) :
+ dst->InitByCreation(syncer::BOOKMARKS, sync_parent, NULL) :
dst->SetPosition(sync_parent, NULL);
if (success) {
DCHECK_EQ(dst->GetParentId(), sync_parent.GetId());
@@ -420,7 +420,7 @@ bool BookmarkChangeProcessor::PlaceSyncNode(MoveOrCreate operation,
return false;
}
success = (operation == CREATE) ?
- dst->InitBookmarkByCreation(sync_parent, &sync_prev) :
+ dst->InitByCreation(syncer::BOOKMARKS, sync_parent, &sync_prev) :
dst->SetPosition(sync_parent, &sync_prev);
if (success) {
DCHECK_EQ(dst->GetParentId(), sync_parent.GetId());
diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
index 2e8ac94..c952eab 100644
--- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
@@ -741,8 +741,7 @@ class FakeServerUpdater : public base::RefCountedThreadSafe<FakeServerUpdater> {
// Simulates effects of UpdateLocalDataFromServerData
MutableEntry parent(&trans, GET_BY_SERVER_TAG,
syncer::ModelTypeToRootTag(syncer::AUTOFILL));
- MutableEntry item(&trans, CREATE, syncer::AUTOFILL,
- parent.Get(syncer::syncable::ID), tag);
+ MutableEntry item(&trans, CREATE, parent.Get(syncer::syncable::ID), tag);
ASSERT_TRUE(item.good());
item.Put(SPECIFICS, entity_specifics);
item.Put(SERVER_SPECIFICS, entity_specifics);
diff --git a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
index 2b72b22..618b4ee 100644
--- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
@@ -81,12 +81,13 @@ class FakeServerChange {
EXPECT_EQ(BaseNode::INIT_OK, parent.InitByIdLookup(parent_id));
syncer::WriteNode node(trans_);
if (predecessor_id == 0) {
- EXPECT_TRUE(node.InitBookmarkByCreation(parent, NULL));
+ EXPECT_TRUE(node.InitByCreation(syncer::BOOKMARKS, parent, NULL));
} else {
syncer::ReadNode predecessor(trans_);
EXPECT_EQ(BaseNode::INIT_OK, predecessor.InitByIdLookup(predecessor_id));
EXPECT_EQ(predecessor.GetParentId(), parent.GetId());
- EXPECT_TRUE(node.InitBookmarkByCreation(parent, &predecessor));
+ EXPECT_TRUE(node.InitByCreation(syncer::BOOKMARKS, parent,
+ &predecessor));
}
EXPECT_EQ(node.GetPredecessorId(), predecessor_id);
EXPECT_EQ(node.GetParentId(), parent_id);
@@ -360,7 +361,7 @@ class ProfileSyncServiceBookmarkTest : public testing::Test {
predecessor = &predecessor_node;
}
syncer::WriteNode node(&trans);
- if (!node.InitBookmarkByCreation(root, predecessor))
+ if (!node.InitByCreation(type, root, predecessor))
return false;
node.SetIsFolder(true);
node.GetMutableEntryForTest()->Put(