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

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: Changed server_position to server_ordinal in DB 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
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..0231514bfa70380d945e1b9bcb804caaa6dfde48 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
akalin 2012/10/05 00:57:59 see comment in other file
vishwath 2012/10/05 18:34:49 Done.
+// shifted to completely uing Ordinals.
akalin 2012/10/05 00:57:59 uing -> using
vishwath 2012/10/05 18:34:49 Done.
+// See 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.

Powered by Google App Engine
This is Rietveld 408576698