• Maksim Moskvitin's avatar
    [Invalidations] Introduce dedicated class for Topic · 62fad577
    Maksim Moskvitin authored
    This CL introduces new class for invalidation Topics, it's temporary
    called TopicData, but will be renamed to Topic once legacy Topic alias
    usages will be removed.
    
    TopicData contains topic name and a boolean to identify whether topic
    is public. It would allow us to simplify external API and clean up
    internal usages of Topics - having TopicMetadata and Topics in some
    places and Topic names and TopicSet in other places is confusing.
    
    This CL modifies
    InvalidatorRegistrarWithMemory::UpdateRegisteredTopics() to use the new
    class. Internal usages in InvalidatorRegistrarWithMemory also updated,
    but a bunch of methods exposes old Topics, because they are used
    outside components/invalidation and it's better to update them on later
    stages.
    
    There is one potential behavioral change in case of existing bug in the
    code: topics subscriptions were stored in prefs without |is_public|
    field, before migration was introduced in
    https://cr-rev.appspot.com/c/1570963. This migration assumes that all
    previously stored topics are private and likely happened when there was
    no public topics in launched projects. If this statement isn't
    accurate, then there is a behavioral change:
    Before: public topic subscription loaded from legacy prefs, the code
    assumes it's a private topic until the same topic is passed into
    UpdateInterestedTopics().
    After: buggy version of public topic remains in "interesting" state,
    once UpdateInterestedTopics() is called with correct TopicData there
    are two version of this Topic (one is private (buggy) and one is public
    (correct)).
    It happens because |is_public| become a part of Topic identifier.
    
    Bug: 1029698
    Change-Id: I8febb82aa7f0294ccb4198467f5bd0f56bbd5798
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2091351
    Commit-Queue: Maksim Moskvitin <mmoskvitin@google.com>
    Reviewed-by: default avatarMarc Treib <treib@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#749629}
    62fad577
invalidation_util.h 1.61 KB