Commit 2ce45ebe authored by Maksim Moskvitin's avatar Maksim Moskvitin Committed by Commit Bot

Update comments around InvalidationHandler::GetOwnerName()

GetOwnerName() must return unique value for each handler within
the same invalidation service. This is currently not the case for
CloudPolicyInvalidator.

This change documents this contract to avoid further API misuse and
updates TODO for codepath depending on this contract.

Bug: 1020117, 1049591
Change-Id: I7fbda6569bf6837c274be753fee5a472bbe2fff4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2049973Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Maksim Moskvitin <mmoskvitin@google.com>
Cr-Commit-Position: refs/heads/master@{#740273}
parent b1b11f58
...@@ -139,8 +139,10 @@ bool InvalidatorRegistrarWithMemory::UpdateRegisteredTopics( ...@@ -139,8 +139,10 @@ bool InvalidatorRegistrarWithMemory::UpdateRegisteredTopics(
DictionaryPrefUpdate update(prefs_, kTopicsToHandler); DictionaryPrefUpdate update(prefs_, kTopicsToHandler);
base::Value* pref_data = update->FindDictKey(sender_id_); base::Value* pref_data = update->FindDictKey(sender_id_);
// TODO(crbug.com/1020117): This does currently *not* remove subscribed topics // TODO(crbug.com/1020117): This does currently *not* remove subscribed
// which are not registered, but it almost certainly should. // topics which are not registered, but it almost certainly should. It
// requires GetOwnerName() to return unique value for each handler, which is
// currently not the case for CloudPolicyInvalidator (see crbug.com/1049591).
auto to_unregister = FindRemovedTopics(old_topics, topics); auto to_unregister = FindRemovedTopics(old_topics, topics);
for (const auto& topic : to_unregister) { for (const auto& topic : to_unregister) {
pref_data->RemoveKey(topic); pref_data->RemoveKey(topic);
......
...@@ -28,6 +28,10 @@ class INVALIDATION_EXPORT InvalidationHandler { ...@@ -28,6 +28,10 @@ class INVALIDATION_EXPORT InvalidationHandler {
virtual void OnIncomingInvalidation( virtual void OnIncomingInvalidation(
const ObjectIdInvalidationMap& invalidation_map) = 0; const ObjectIdInvalidationMap& invalidation_map) = 0;
// Returned value must be unique for the handlers using the same invalidation
// service.
// TODO(crbug.com/1049591): this is currently not the case for
// CloudPolicyInvalidator.
virtual std::string GetOwnerName() const = 0; virtual std::string GetOwnerName() const = 0;
// Called on change of |client_id|. Client id is used to identify the // Called on change of |client_id|. Client id is used to identify the
......
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