summaryrefslogtreecommitdiffstats
path: root/sync/engine/process_updates_command.cc
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-12 18:15:45 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-12 18:15:45 +0000
commit447a5b6333539c309e015ee8f98ff6d9e131fa85 (patch)
tree4357764ce00fdfbff7809d348a16a5f601bd3b08 /sync/engine/process_updates_command.cc
parent13d5e1af907ece2266b391c322344fb0af43d9f0 (diff)
downloadchromium_src-447a5b6333539c309e015ee8f98ff6d9e131fa85.zip
chromium_src-447a5b6333539c309e015ee8f98ff6d9e131fa85.tar.gz
chromium_src-447a5b6333539c309e015ee8f98ff6d9e131fa85.tar.bz2
Remove syncproto.h
Replace sync/engine/syncproto.h with sync/syncable/syncable_proto_util.h and .cc. The tasks that used to be performed by member functions of the syncer:: proto wrapper classes are now handled by static member functions. Unfortunately, serialization and de-serialization of syncable::Id to/from proto fields has gotten a bit uglier. On the other hand, it's now much less magical and mysterious. The test intended to prevent regressions of crbug.com/134715 has been replaced with a DCHECK. We'll have to rely on it to ensure that the protocol_version field is always explicitly set. BUG=136454 TEST= Review URL: https://chromiumcodereview.appspot.com/10735041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146393 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/engine/process_updates_command.cc')
-rw-r--r--sync/engine/process_updates_command.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/sync/engine/process_updates_command.cc b/sync/engine/process_updates_command.cc
index f239a6a..ccf3def 100644
--- a/sync/engine/process_updates_command.cc
+++ b/sync/engine/process_updates_command.cc
@@ -11,10 +11,10 @@
#include "sync/engine/syncer.h"
#include "sync/engine/syncer_proto_util.h"
#include "sync/engine/syncer_util.h"
-#include "sync/engine/syncproto.h"
#include "sync/sessions/sync_session.h"
#include "sync/syncable/directory.h"
#include "sync/syncable/mutable_entry.h"
+#include "sync/syncable/syncable_proto_util.h"
#include "sync/syncable/syncable_util.h"
#include "sync/syncable/write_transaction.h"
#include "sync/util/cryptographer.h"
@@ -72,12 +72,13 @@ SyncerError ProcessUpdatesCommand::ModelChangingExecuteImpl(
namespace {
// Returns true if the entry is still ok to process.
-bool ReverifyEntry(syncable::WriteTransaction* trans, const SyncEntity& entry,
+bool ReverifyEntry(syncable::WriteTransaction* trans,
+ const sync_pb::SyncEntity& entry,
syncable::MutableEntry* same_id) {
const bool deleted = entry.has_deleted() && entry.deleted();
- const bool is_directory = entry.IsFolder();
- const syncer::ModelType model_type = entry.GetModelType();
+ const bool is_directory = IsFolder(entry);
+ const syncer::ModelType model_type = GetModelType(entry);
return VERIFY_SUCCESS == VerifyUpdateConsistency(trans,
entry,
@@ -90,12 +91,10 @@ bool ReverifyEntry(syncable::WriteTransaction* trans, const SyncEntity& entry,
// Process a single update. Will avoid touching global state.
ServerUpdateProcessingResult ProcessUpdatesCommand::ProcessUpdate(
- const sync_pb::SyncEntity& proto_update,
+ const sync_pb::SyncEntity& update,
const Cryptographer* cryptographer,
syncable::WriteTransaction* const trans) {
-
- const SyncEntity& update = *static_cast<const SyncEntity*>(&proto_update);
- syncable::Id server_id = update.id();
+ const syncable::Id& server_id = SyncableIdFromProto(update.id_string());
const std::string name = SyncerProtoUtil::NameFromSyncEntity(update);
// Look to see if there's a local item that should recieve this update,
@@ -150,7 +149,8 @@ ServerUpdateProcessingResult ProcessUpdatesCommand::ProcessUpdate(
// overwrite SERVER_SPECIFICS.
// MTIME, CTIME, and NON_UNIQUE_NAME are not enforced.
if (!update.deleted() && !target_entry.Get(syncable::SERVER_IS_DEL) &&
- (update.parent_id() == target_entry.Get(syncable::SERVER_PARENT_ID)) &&
+ (SyncableIdFromProto(update.parent_id_string()) ==
+ target_entry.Get(syncable::SERVER_PARENT_ID)) &&
(update.position_in_parent() ==
target_entry.Get(syncable::SERVER_POSITION_IN_PARENT)) &&
update.has_specifics() && update.specifics().has_encrypted() &&