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

Unified Diff: sync/engine/process_commit_response_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
« no previous file with comments | « sync/engine/get_commit_ids_command.cc ('k') | sync/engine/process_commit_response_command_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/process_commit_response_command.cc
diff --git a/sync/engine/process_commit_response_command.cc b/sync/engine/process_commit_response_command.cc
index 811be36b73791d147d9db6c2beb72b0fed86508e..5c69c6b587dcc7c851d86082dcb5d8105d7ad4ef 100644
--- a/sync/engine/process_commit_response_command.cc
+++ b/sync/engine/process_commit_response_command.cc
@@ -13,6 +13,7 @@
#include "base/location.h"
#include "sync/engine/syncer_proto_util.h"
#include "sync/engine/syncer_util.h"
+#include "sync/internal_api/public/base/unique_position.h"
#include "sync/sessions/sync_session.h"
#include "sync/syncable/entry.h"
#include "sync/syncable/mutable_entry.h"
@@ -22,11 +23,6 @@
#include "sync/syncable/write_transaction.h"
#include "sync/util/time.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::set;
using std::string;
using std::vector;
@@ -50,7 +46,6 @@ using syncable::IS_UNSYNCED;
using syncable::PARENT_ID;
using syncable::SERVER_IS_DEL;
using syncable::SERVER_PARENT_ID;
-using syncable::SERVER_ORDINAL_IN_PARENT;
using syncable::SERVER_VERSION;
using syncable::SYNCER;
using syncable::SYNCING;
@@ -361,8 +356,11 @@ void ProcessCommitResponseCommand::UpdateServerFieldsAfterCommit(
ProtoTimeToTime(committed_entry.mtime()));
local_entry->Put(syncable::SERVER_CTIME,
ProtoTimeToTime(committed_entry.ctime()));
- local_entry->Put(syncable::SERVER_ORDINAL_IN_PARENT,
- Int64ToNodeOrdinal(entry_response.position_in_parent()));
+ if (committed_entry.has_unique_position()) {
+ local_entry->Put(syncable::SERVER_UNIQUE_POSITION,
+ UniquePosition::FromBytes(
+ committed_entry.unique_position()));
+ }
// TODO(nick): The server doesn't set entry_response.server_parent_id in
// practice; to update SERVER_PARENT_ID appropriately here we'd need to
@@ -405,23 +403,6 @@ void ProcessCommitResponseCommand::OverrideClientFieldsAfterCommit(
<< " to new name: " << server_name;
local_entry->Put(syncable::NON_UNIQUE_NAME, server_name);
}
-
- // The server has the final say on positioning, so apply the absolute
- // position that it returns.
- if (entry_response.has_position_in_parent()) {
- // The SERVER_ field should already have been written.
- DCHECK_EQ(entry_response.position_in_parent(),
- NodeOrdinalToInt64(local_entry->Get(SERVER_ORDINAL_IN_PARENT)));
-
- // We just committed successfully, so we assume that the position
- // value we got applies to the PARENT_ID we submitted.
- syncable::Id new_prev = local_entry->ComputePrevIdFromServerPosition(
- local_entry->Get(PARENT_ID));
- if (!local_entry->PutPredecessor(new_prev)) {
- // TODO(lipalani) : Propagate the error to caller. crbug.com/100444.
- NOTREACHED();
- }
- }
}
void ProcessCommitResponseCommand::ProcessSuccessfulCommitResponse(
« no previous file with comments | « sync/engine/get_commit_ids_command.cc ('k') | sync/engine/process_commit_response_command_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698