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

Unified Diff: sync/engine/process_updates_command.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
Index: sync/engine/process_updates_command.cc
diff --git a/sync/engine/process_updates_command.cc b/sync/engine/process_updates_command.cc
index 15a14cb54cc64e7bb517e7c6e4dff8ec53886c15..ccf85c703f2c4bdcae186af42c31691589b67034 100644
--- a/sync/engine/process_updates_command.cc
+++ b/sync/engine/process_updates_command.cc
@@ -19,11 +19,6 @@
#include "sync/syncable/write_transaction.h"
#include "sync/util/cryptographer.h"
-// TODO(vishwath): Remove this include after node positions have
-// shifted to completely using Ordinals.
-// See http://crbug.com/145412 .
-#include "sync/internal_api/public/base/node_ordinal.h"
-
using std::vector;
namespace syncer {
@@ -314,12 +309,23 @@ ServerUpdateProcessingResult ProcessUpdatesCommand::ProcessUpdate(
// (on which any current or future local changes are based) before we
// overwrite SERVER_SPECIFICS.
// MTIME, CTIME, and NON_UNIQUE_NAME are not enforced.
+
+ bool position_matches = true;
+ if (target_entry.GetModelType() == BOOKMARKS && !update.deleted()) {
+ std::string update_tag = GetUniqueBookmarkTagFromUpdate(update);
+ if (UniquePosition::IsValidSuffix(update_tag)) {
+ position_matches = GetUpdatePosition(update, update_tag).Equals(
+ target_entry.Get(syncable::SERVER_UNIQUE_POSITION));
+ } else {
+ NOTREACHED();
+ position_matches = false;
+ }
+ }
+
if (!update.deleted() && !target_entry.Get(syncable::SERVER_IS_DEL) &&
(SyncableIdFromProto(update.parent_id_string()) ==
target_entry.Get(syncable::SERVER_PARENT_ID)) &&
- (update.position_in_parent() ==
- NodeOrdinalToInt64(
- target_entry.Get(syncable::SERVER_ORDINAL_IN_PARENT))) &&
+ position_matches &&
update.has_specifics() && update.specifics().has_encrypted() &&
!cryptographer->CanDecrypt(update.specifics().encrypted())) {
sync_pb::EntitySpecifics prev_specifics =
« no previous file with comments | « sync/engine/process_commit_response_command_unittest.cc ('k') | sync/engine/process_updates_command_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698