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

Unified Diff: sync/engine/process_commit_response_command.cc

Issue 10989063: Changed DB to store node positions as Ordinals. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed memory leak error in unittest Created 8 years, 2 months 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/build_commit_command.cc ('k') | sync/engine/process_updates_command.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 8a00608f925bd143a18a35006565e753447bc870..803d6bf6ecfa96722bff3beaa83d85f9949bdd10 100644
--- a/sync/engine/process_commit_response_command.cc
+++ b/sync/engine/process_commit_response_command.cc
@@ -22,6 +22,11 @@
#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;
@@ -46,7 +51,7 @@ using syncable::IS_UNSYNCED;
using syncable::PARENT_ID;
using syncable::SERVER_IS_DEL;
using syncable::SERVER_PARENT_ID;
-using syncable::SERVER_POSITION_IN_PARENT;
+using syncable::SERVER_ORDINAL_IN_PARENT;
using syncable::SERVER_VERSION;
using syncable::SYNCER;
using syncable::SYNCING;
@@ -371,8 +376,9 @@ void ProcessCommitResponseCommand::UpdateServerFieldsAfterCommit(
ProtoTimeToTime(committed_entry.mtime()));
local_entry->Put(syncable::SERVER_CTIME,
ProtoTimeToTime(committed_entry.ctime()));
- local_entry->Put(syncable::SERVER_POSITION_IN_PARENT,
- entry_response.position_in_parent());
+ local_entry->Put(syncable::SERVER_ORDINAL_IN_PARENT,
+ Int64ToNodeOrdinal(entry_response.position_in_parent()));
+
// 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
// get the post-commit ID of the parent indicated by
@@ -420,7 +426,7 @@ void ProcessCommitResponseCommand::OverrideClientFieldsAfterCommit(
if (entry_response.has_position_in_parent()) {
// The SERVER_ field should already have been written.
DCHECK_EQ(entry_response.position_in_parent(),
- local_entry->Get(SERVER_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.
« no previous file with comments | « sync/engine/build_commit_command.cc ('k') | sync/engine/process_updates_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698