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

Unified Diff: components/sync/model/fake_model_type_sync_bridge.cc

Issue 2935583002: [Sync] Implement support for untracking new entities (Closed)
Patch Set: add comments Created 3 years, 6 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: components/sync/model/fake_model_type_sync_bridge.cc
diff --git a/components/sync/model/fake_model_type_sync_bridge.cc b/components/sync/model/fake_model_type_sync_bridge.cc
index 538fba0f337b0f7985798253737b9974d6fe94cc..d1e44c3c43c8f27c70ee6a749068e99912f36315 100644
--- a/components/sync/model/fake_model_type_sync_bridge.cc
+++ b/components/sync/model/fake_model_type_sync_bridge.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
+#include "base/stl_util.h"
#include "components/sync/base/hash_util.h"
#include "components/sync/model/mutable_data_batch.h"
#include "components/sync/model_impl/in_memory_metadata_change_list.h"
@@ -213,8 +214,12 @@ base::Optional<ModelError> FakeModelTypeSyncBridge::MergeSyncData(
EXPECT_NE(SupportsGetStorageKey(), storage_key.empty());
if (storage_key.empty()) {
storage_key = GetStorageKeyImpl(change.data());
- change_processor()->UpdateStorageKey(change.data(), storage_key,
- metadata_change_list.get());
+ if (base::ContainsKey(keys_to_ignore_, storage_key)) {
+ change_processor()->UntrackEntity(change.data());
+ } else {
+ change_processor()->UpdateStorageKey(change.data(), storage_key,
+ metadata_change_list.get());
+ }
}
remote_storage_keys.insert(storage_key);
db_->PutData(storage_key, change.data());
@@ -382,4 +387,8 @@ std::unique_ptr<EntityData> FakeModelTypeSyncBridge::CopyEntityData(
return new_data;
}
+void FakeModelTypeSyncBridge::SetKeyToIgnore(const std::string key) {
+ keys_to_ignore_.insert(key);
+}
+
} // namespace syncer
« no previous file with comments | « components/sync/model/fake_model_type_sync_bridge.h ('k') | components/sync/model/model_type_change_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698