Commit b52b52fc authored by Jan Krcal's avatar Jan Krcal Committed by Commit Bot

[USS] Make Delete() / UntrackEntityForStorageKey() ignore unknown keys

This CL makes it fully legal that bridges can call Delete() or
UntrackEntityForStorageKey() of the processor for keys that are not in
sync or are already deleted.

This was the case even before but this CL removes misleading comments,
unnecessary DLOGs and extends documentation in the interface.

Bug: NONE
Change-Id: I305c7301f35543908813ef6fa78b2d018222c594
Reviewed-on: https://chromium-review.googlesource.com/c/1347368Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Jan Krcal <jkrcal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610388}
parent 5a1f2697
......@@ -37,7 +37,8 @@ class ModelTypeChangeProcessor {
std::unique_ptr<EntityData> entity_data,
MetadataChangeList* metadata_change_list) = 0;
// Inform the processor of a deleted entity.
// Inform the processor of a deleted entity. The call is ignored if
// |storage_key| is unknown.
virtual void Delete(const std::string& storage_key,
MetadataChangeList* metadata_change_list) = 0;
......
......@@ -445,10 +445,7 @@ void ClientTagBasedModelTypeProcessor::Delete(
ProcessorEntityTracker* entity = GetEntityForStorageKey(storage_key);
if (entity == nullptr) {
// That's unusual, but not necessarily a bad thing.
// Missing is as good as deleted as far as the model is concerned.
DLOG(WARNING) << "Attempted to delete missing item."
<< " storage key: " << storage_key;
return;
}
......@@ -498,12 +495,7 @@ void ClientTagBasedModelTypeProcessor::UntrackEntityForStorageKey(
// Look-up the client tag hash.
auto iter = storage_key_to_tag_hash_.find(storage_key);
if (iter == storage_key_to_tag_hash_.end()) {
// TODO(jkrcal): Add metrics keyed by the model_type to see which model_type
// violates the proper behavior expected here (https://crbug.com/847822).
// That's unusual, but not necessarily a bad thing.
// Missing is as good as untracked as far as the model is concerned.
DLOG(WARNING) << "Attempted to untrack missing item with storage_key: "
<< storage_key;
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment