Chromium Code Reviews| Index: sync/internal_api/shared_model_type_processor.cc |
| diff --git a/sync/internal_api/shared_model_type_processor.cc b/sync/internal_api/shared_model_type_processor.cc |
| index c963a3c7a4d8e3471d58b9f8e18390e41eb4ead0..563316525529440af9c2d36b6088d2ab83a1d474 100644 |
| --- a/sync/internal_api/shared_model_type_processor.cc |
| +++ b/sync/internal_api/shared_model_type_processor.cc |
| @@ -243,8 +243,11 @@ void SharedModelTypeProcessor::Put(const std::string& tag, |
| entity = CreateEntity(tag, *data); |
| } |
| - // TODO(stanisc): crbug.com/561829: Avoid committing a change if there is no |
| - // actual change. |
| + if (entity->MatchesSpecificsHash(data->specifics)) { |
|
skym
2016/03/28 22:35:38
Should we even bother making this check if entity
maxbogue
2016/03/29 00:32:09
Guess not. Done.
|
| + // Ignore changes that don't actually change anything. |
| + return; |
| + } |
| + |
| entity->MakeLocalChange(std::move(data)); |
| metadata_change_list->UpdateMetadata(tag, entity->metadata()); |
| @@ -373,16 +376,16 @@ void SharedModelTypeProcessor::OnUpdateReceived( |
| entity = CreateEntity(data); |
| entity_changes.push_back( |
| EntityChange::CreateAdd(entity->client_tag(), update.entity)); |
| - } else { |
| - if (data.is_deleted()) { |
| - entity_changes.push_back( |
| - EntityChange::CreateDelete(entity->client_tag())); |
| - } else { |
| - // TODO(stanisc): crbug.com/561829: Avoid sending an update to the |
| - // service if there is no actual change. |
| - entity_changes.push_back( |
| - EntityChange::CreateUpdate(entity->client_tag(), update.entity)); |
| - } |
| + } else if (entity->UpdateIsReflection(update.response_version)) { |
| + // Seen this update before; just ignore it. |
| + continue; |
| + } else if (data.is_deleted()) { |
| + entity_changes.push_back( |
| + EntityChange::CreateDelete(entity->client_tag())); |
| + } else if (!entity->MatchesSpecificsHash(data.specifics)) { |
| + // Specifics have changed, so update the service. |
| + entity_changes.push_back( |
| + EntityChange::CreateUpdate(entity->client_tag(), update.entity)); |
| } |
| entity->ApplyUpdateFromServer(update); |