Index: components/subresource_filter/core/common/url_pattern_index.cc |
diff --git a/components/subresource_filter/core/common/url_pattern_index.cc b/components/subresource_filter/core/common/url_pattern_index.cc |
index 574f577a32533c1d0811f55d579d152c22f0a3d7..fdab2ede938d62f70f9ebf593fbf0f259177bb4e 100644 |
--- a/components/subresource_filter/core/common/url_pattern_index.cc |
+++ b/components/subresource_filter/core/common/url_pattern_index.cc |
@@ -551,7 +551,8 @@ const flat::UrlRule* UrlPatternIndexMatcher::FindMatch( |
proto::ElementType element_type, |
proto::ActivationType activation_type, |
bool is_third_party, |
- bool disable_generic_rules) const { |
+ bool disable_generic_rules, |
+ RuleRecorder* recorder) const { |
if (!flat_index_ || !url.is_valid()) |
return nullptr; |
if ((element_type == proto::ELEMENT_TYPE_UNSPECIFIED) == |
@@ -559,9 +560,16 @@ const flat::UrlRule* UrlPatternIndexMatcher::FindMatch( |
return nullptr; |
} |
- return FindMatchInFlatUrlPatternIndex(*flat_index_, url, first_party_origin, |
- element_type, activation_type, |
- is_third_party, disable_generic_rules); |
+ const flat::UrlRule* rule = FindMatchInFlatUrlPatternIndex( |
+ *flat_index_, url, first_party_origin, element_type, activation_type, |
+ is_third_party, disable_generic_rules); |
+ |
+ // Log the rule if used. We don't care about blacklist or whitelist I assume. |
+ // Can we just use url_pattern or are there rules with same pattern |
+ // but different options. |
+ if (recorder && rule) |
+ recorder->RecordRuleUsage(rule); |
+ return rule; |
} |
} // namespace subresource_filter |