summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorlipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-24 22:57:12 +0000
committerlipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-24 22:57:12 +0000
commit499a62259f33b73f1dd3297fc9d66b981da4716d (patch)
tree629e6e6b4927eaedc44c2167e26a8f07f52427ed /sync
parentbc4297aad8940a1d13d92f7d71c0ee6d1c8c7aaa (diff)
downloadchromium_src-499a62259f33b73f1dd3297fc9d66b981da4716d.zip
chromium_src-499a62259f33b73f1dd3297fc9d66b981da4716d.tar.gz
chromium_src-499a62259f33b73f1dd3297fc9d66b981da4716d.tar.bz2
Ignore tombstones for items belonging to unrequested types.
During a sync cycle(regular or configuration) the server might send us tombstones for items that don't belong to one of the types that the client requested. If the server sent such tombstones, with this patch, the client would ignore them. BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10432003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138923 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/engine/verify_updates_command.cc19
-rw-r--r--sync/engine/verify_updates_command.h1
2 files changed, 18 insertions, 2 deletions
diff --git a/sync/engine/verify_updates_command.cc b/sync/engine/verify_updates_command.cc
index c4ebe67..f590b94 100644
--- a/sync/engine/verify_updates_command.cc
+++ b/sync/engine/verify_updates_command.cc
@@ -7,6 +7,7 @@
#include <string>
#include "base/location.h"
+#include "sync/engine/model_safe_worker.h"
#include "sync/engine/syncer.h"
#include "sync/engine/syncer_proto_util.h"
#include "sync/engine/syncer_types.h"
@@ -20,6 +21,7 @@ namespace browser_sync {
using syncable::WriteTransaction;
using syncable::GET_BY_ID;
+using syncable::ModelTypeSet;
using syncable::SYNCER;
namespace {
@@ -97,6 +99,9 @@ SyncerError VerifyUpdatesCommand::ModelChangingExecuteImpl(
const GetUpdatesResponse& updates = status->updates_response().get_updates();
int update_count = updates.entries().size();
+ ModelTypeSet requested_types = browser_sync::GetRoutingInfoTypes(
+ session->routing_info());
+
DVLOG(1) << update_count << " entries to verify";
for (int i = 0; i < update_count; i++) {
const SyncEntity& update =
@@ -107,6 +112,7 @@ SyncerError VerifyUpdatesCommand::ModelChangingExecuteImpl(
continue;
VerifyUpdateResult result = VerifyUpdate(&trans, update,
+ requested_types,
session->routing_info());
status->mutable_update_progress()->AddVerifyResult(result.value, update);
status->increment_num_updates_downloaded_by(1);
@@ -121,6 +127,7 @@ SyncerError VerifyUpdatesCommand::ModelChangingExecuteImpl(
VerifyUpdatesCommand::VerifyUpdateResult VerifyUpdatesCommand::VerifyUpdate(
syncable::WriteTransaction* trans, const SyncEntity& entry,
+ const ModelTypeSet& requested_types,
const ModelSafeRoutingInfo& routes) {
syncable::Id id = entry.id();
VerifyUpdateResult result = {VERIFY_FAIL, GROUP_PASSIVE};
@@ -153,8 +160,16 @@ VerifyUpdatesCommand::VerifyUpdateResult VerifyUpdatesCommand::VerifyUpdate(
}
if (VERIFY_UNDECIDED == result.value) {
- if (deleted)
- result.value = VERIFY_SUCCESS;
+ if (deleted) {
+ // For deletes the server could send tombostones for items that
+ // the client did not request. If so ignore those items.
+ if (IsRealDataType(placement_type) &&
+ !requested_types.Has(placement_type)) {
+ result.value = VERIFY_SKIP;
+ } else {
+ result.value = VERIFY_SUCCESS;
+ }
+ }
}
// If we have an existing entry, we check here for updates that break
diff --git a/sync/engine/verify_updates_command.h b/sync/engine/verify_updates_command.h
index 37a0b1f..8ccc471 100644
--- a/sync/engine/verify_updates_command.h
+++ b/sync/engine/verify_updates_command.h
@@ -40,6 +40,7 @@ class VerifyUpdatesCommand : public ModelChangingSyncerCommand {
};
VerifyUpdateResult VerifyUpdate(syncable::WriteTransaction* trans,
const SyncEntity& entry,
+ const syncable::ModelTypeSet& requested_types,
const ModelSafeRoutingInfo& routes);
DISALLOW_COPY_AND_ASSIGN(VerifyUpdatesCommand);
};