Index: components/reading_list/core/reading_list_store.cc |
diff --git a/components/reading_list/core/reading_list_store.cc b/components/reading_list/core/reading_list_store.cc |
index 8d0f35590d18189661eabd78625bd71c3154709a..015c7c3ac16312d64a7b66aefcfca1b98898e96a 100644 |
--- a/components/reading_list/core/reading_list_store.cc |
+++ b/components/reading_list/core/reading_list_store.cc |
@@ -195,19 +195,18 @@ ReadingListStore::CreateMetadataChangeList() { |
// Perform the initial merge between local and sync data. This should only be |
// called when a data type is first enabled to start syncing, and there is no |
// sync metadata. Best effort should be made to match local and sync data. The |
-// keys in the |entity_data_map| will have been created via GetClientTag(...), |
-// and if a local and sync data should match/merge but disagree on tags, the |
-// service should use the sync data's tag. Any local pieces of data that are |
-// not present in sync should immediately be Put(...) to the processor before |
-// returning. The same MetadataChangeList that was passed into this function |
-// can be passed to Put(...) calls. Delete(...) can also be called but should |
-// not be needed for most model types. Durable storage writes, if not able to |
-// combine all change atomically, should save the metadata after the data |
-// changes, so that this merge will be re-driven by sync if is not completely |
-// saved during the current run. |
+// storage keys in the |entity_data| are populated with GetStorageKey(...), |
+// local and sync copies of the same entity should resolve to the same storage |
+// key. Any local pieces of data that are not present in sync should immediately |
+// be Put(...) to the processor before returning. The same MetadataChangeList |
+// that was passed into this function can be passed to Put(...) calls. |
+// Delete(...) can also be called but should not be needed for most model types. |
+// Durable storage writes, if not able to combine all change atomically, should |
+// save the metadata after the data changes, so that this merge will be re- |
+// driven by sync if is not completely saved during the current run. |
base::Optional<syncer::ModelError> ReadingListStore::MergeSyncData( |
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, |
- syncer::EntityDataMap entity_data_map) { |
+ syncer::EntityChangeList entity_data) { |
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
auto token = EnsureBatchCreated(); |
// Keep track of the last update of each item. |
@@ -216,10 +215,10 @@ base::Optional<syncer::ModelError> ReadingListStore::MergeSyncData( |
model_batch_updates = model_->BeginBatchUpdates(); |
// Merge sync to local data. |
- for (const auto& kv : entity_data_map) { |
- synced_entries.insert(kv.first); |
+ for (const auto& change : entity_data) { |
+ synced_entries.insert(change.storage_key()); |
const sync_pb::ReadingListSpecifics& specifics = |
- kv.second.value().specifics.reading_list(); |
+ change.data().specifics.reading_list(); |
// Deserialize entry. |
std::unique_ptr<ReadingListEntry> entry( |
ReadingListEntry::FromReadingListSpecifics(specifics, clock_->Now())); |