• Ehsan Karamad's avatar
    Fix some minor feature policy parsing issues · 5eaea8ea
    Ehsan Karamad authored
    This CL makes the following changes to the feature policy parsing code:
    
      1- ParsedFeaturePolicyDeclaration holds a sorted vector of unique
         |origins|.
      2- AllowList uses std::set instead of std::vector.
      3- When parsing for list of origins, in case of matching all origins
         (*), the current set of origins is cleared.
      4- When comparing ParsedFeaturePolicyDeclaration, if both
         declarations include '*' then the set of origins are not compared.
    
    The noticeable outcome of the CL is that parsed policy will ignore
    repeated origins and will be sorted. This would make the feature lookup
    algorithm more efficient.
    
    Bug: 710324
    Change-Id: I5c67ee2d6cff891304781bea0998e07739006a2e
    Reviewed-on: https://chromium-review.googlesource.com/c/1161753Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
    Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
    Reviewed-by: default avatarIan Clelland <iclelland@chromium.org>
    Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#610887}
    5eaea8ea
feature_policy.cc 12.5 KB