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

Unified Diff: components/sync/model_impl/shared_model_type_processor.cc

Issue 2690913005: [Sync] Update EntityData on all codepaths from model type sync bridge (Closed)
Patch Set: Address comments Created 3 years, 10 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_impl/shared_model_type_processor.cc
diff --git a/components/sync/model_impl/shared_model_type_processor.cc b/components/sync/model_impl/shared_model_type_processor.cc
index 614321deacdfc7277bb408809c4a3ed1a00b9582..108aefc5d99089d3a1ba22610ac921ab6151d1e6 100644
--- a/components/sync/model_impl/shared_model_type_processor.cc
+++ b/components/sync/model_impl/shared_model_type_processor.cc
@@ -209,19 +209,14 @@ void SharedModelTypeProcessor::Put(const std::string& storage_key,
return;
}
- // Fill in some data.
- data->client_tag_hash = GetClientTagHash(storage_key, *data);
- if (data->modification_time.is_null()) {
- data->modification_time = base::Time::Now();
- }
-
- ProcessorEntityTracker* entity = GetEntityForTagHash(data->client_tag_hash);
-
+ ProcessorEntityTracker* entity = GetEntityForStorageKey(storage_key);
if (entity == nullptr) {
// The bridge is creating a new entity.
- if (data->creation_time.is_null()) {
- data->creation_time = data->modification_time;
- }
+ data->client_tag_hash = GetClientTagHash(storage_key, *data);
+ if (data->creation_time.is_null())
+ data->creation_time = base::Time::Now();
+ if (data->modification_time.is_null())
+ data->modification_time = data->creation_time;
entity = CreateEntity(storage_key, *data);
} else if (entity->MatchesData(*data)) {
// Ignore changes that don't actually change anything.
@@ -613,7 +608,9 @@ void SharedModelTypeProcessor::ConsumeDataBatch(
ProcessorEntityTracker* entity = GetEntityForStorageKey(data.first);
// If the entity wasn't deleted or updated with new commit.
if (entity != nullptr && entity->RequiresCommitData()) {
- entity->CacheCommitData(data.second.get());
+ // SetCommitData will update EntityData's fields with values from
+ // metadata.
+ entity->SetCommitData(data.second.get());
}
}
}

Powered by Google App Engine
This is Rietveld 408576698