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

Unified Diff: sync/internal_api/sync_manager_impl.cc

Issue 11636006: WIP: The Bookmark Position Megapatch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Various updates, including switch suffix to unique_client_tag style Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/internal_api/sync_manager_impl.h ('k') | sync/internal_api/sync_manager_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/sync_manager_impl.cc
diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc
index 874444ba1b552a8ddff4779b8f9cb8734e4c1799..b75ea50651a8221f1a6698001df5b4620010a393 100644
--- a/sync/internal_api/sync_manager_impl.cc
+++ b/sync/internal_api/sync_manager_impl.cc
@@ -56,6 +56,7 @@ namespace syncer {
using sessions::SyncSessionContext;
using syncable::ImmutableWriteTransactionInfo;
using syncable::SPECIFICS;
+using syncable::UNIQUE_POSITION;
namespace {
@@ -221,22 +222,6 @@ DictionaryValue* SyncManagerImpl::NotificationInfo::ToValue() const {
return value;
}
-bool SyncManagerImpl::VisiblePositionsDiffer(
- const syncable::EntryKernelMutation& mutation) const {
- const syncable::EntryKernel& a = mutation.original;
- const syncable::EntryKernel& b = mutation.mutated;
- // If the datatype isn't one where the browser model cares about position,
- // don't bother notifying that data model of position-only changes.
- if (!ShouldMaintainPosition(GetModelTypeFromSpecifics(b.ref(SPECIFICS)))) {
- return false;
- }
- if (a.ref(syncable::NEXT_ID) != b.ref(syncable::NEXT_ID))
- return true;
- if (a.ref(syncable::PARENT_ID) != b.ref(syncable::PARENT_ID))
- return true;
- return false;
-}
-
bool SyncManagerImpl::VisiblePropertiesDiffer(
const syncable::EntryKernelMutation& mutation,
Cryptographer* cryptographer) const {
@@ -264,7 +249,7 @@ bool SyncManagerImpl::VisiblePropertiesDiffer(
if (!a_specifics.has_encrypted() && !b_specifics.has_encrypted() &&
a.ref(syncable::NON_UNIQUE_NAME) != b.ref(syncable::NON_UNIQUE_NAME))
return true;
- if (VisiblePositionsDiffer(mutation))
+ if (!a.ref(UNIQUE_POSITION).Equals(b.ref(UNIQUE_POSITION)))
return true;
return false;
}
@@ -902,6 +887,8 @@ void SyncManagerImpl::HandleCalculateChangesChangeEventFromSyncer(
mutations.Get().begin(); it != mutations.Get().end(); ++it) {
bool existed_before = !it->second.original.ref(syncable::IS_DEL);
bool exists_now = !it->second.mutated.ref(syncable::IS_DEL);
+ bool positions_differ = !it->second.original.ref(UNIQUE_POSITION).Equals(
+ it->second.mutated.ref(UNIQUE_POSITION));
// Omit items that aren't associated with a model.
ModelType type =
@@ -917,7 +904,7 @@ void SyncManagerImpl::HandleCalculateChangesChangeEventFromSyncer(
else if (exists_now && existed_before &&
VisiblePropertiesDiffer(it->second, crypto)) {
change_buffers[type].PushUpdatedItem(
- handle, VisiblePositionsDiffer(it->second));
+ handle, positions_differ);
}
SetExtraChangeRecordData(handle, type, &change_buffers[type], crypto,
« no previous file with comments | « sync/internal_api/sync_manager_impl.h ('k') | sync/internal_api/sync_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698