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

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

Issue 2915763005: [Sync] Implement support for updating storage key for new entities (Closed)
Patch Set: Rebase. Fix recommit for encryption scenario. 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/model_type_sync_bridge.cc
diff --git a/components/sync/model/model_type_sync_bridge.cc b/components/sync/model/model_type_sync_bridge.cc
index 0e5a1dd454493a2e28acc8ed00d9e05c08488083..e4c6f87b6c1282ffd828a7c44f455530cbabe672 100644
--- a/components/sync/model/model_type_sync_bridge.cc
+++ b/components/sync/model/model_type_sync_bridge.cc
@@ -8,6 +8,7 @@
#include "base/memory/ptr_util.h"
#include "components/sync/model/metadata_batch.h"
+#include "components/sync/model/metadata_change_list.h"
namespace syncer {
@@ -20,6 +21,23 @@ ModelTypeSyncBridge::ModelTypeSyncBridge(
ModelTypeSyncBridge::~ModelTypeSyncBridge() {}
+base::Optional<ModelError> ModelTypeSyncBridge::MergeSyncData(
+ std::unique_ptr<MetadataChangeList> metadata_change_list,
+ EntityChangeList entity_data) {
+ EntityDataMap entity_data_map;
+ for (const auto& change : entity_data) {
+ DCHECK_EQ(EntityChange::ACTION_ADD, change.type());
+ DCHECK(!change.storage_key().empty());
+ DCHECK(entity_data_map.find(change.storage_key()) == entity_data_map.end());
+ entity_data_map.emplace(change.storage_key(), change.data_ptr());
+ }
+ return MergeSyncData(std::move(metadata_change_list), entity_data_map);
+}
+
+bool ModelTypeSyncBridge::SupportsGetStorageKey() const {
+ return true;
+}
+
ConflictResolution ModelTypeSyncBridge::ResolveConflict(
const EntityData& local_data,
const EntityData& remote_data) const {
« no previous file with comments | « components/sync/model/model_type_sync_bridge.h ('k') | components/sync/model_impl/processor_entity_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698