Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: components/subresource_filter/core/common/flat/rules.fbs

Issue 2793993002: [subresource_filter] Replace KMP by std::search. (Closed)
Patch Set: Fix DCHECK. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 namespace subresource_filter.flat; 1 namespace subresource_filter.flat;
2 2
3 // Corresponds to subresource_filter::proto::UrlPatternType. 3 // Corresponds to subresource_filter::proto::UrlPatternType.
4 enum UrlPatternType : ubyte { 4 enum UrlPatternType : ubyte {
5 SUBSTRING, 5 SUBSTRING,
6 WILDCARDED, 6 WILDCARDED,
7 REGEXP, 7 REGEXP,
8 } 8 }
9 9
10 // Corresponds to subresource_filter::proto::AnchorType. 10 // Corresponds to subresource_filter::proto::AnchorType.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 anchor_left : AnchorType = NONE; 46 anchor_left : AnchorType = NONE;
47 anchor_right : AnchorType = NONE; 47 anchor_right : AnchorType = NONE;
48 48
49 // The list of domains to be included/excluded from the filter's affected set. 49 // The list of domains to be included/excluded from the filter's affected set.
50 // If a particular string in the list starts with '~' then the respective 50 // If a particular string in the list starts with '~' then the respective
51 // domain is excluded, otherwise included. 51 // domain is excluded, otherwise included.
52 domains : [string]; 52 domains : [string];
53 53
54 // A URL pattern in the format defined by |url_pattern_type|. 54 // A URL pattern in the format defined by |url_pattern_type|.
55 url_pattern : string; 55 url_pattern : string;
56
57 // The compound Knuth-Morris-Pratt failure function corresponding to
58 // |url_pattern|. Used for SUBSTRING and WILDCARDED URL patterns only.
59 //
60 // The |url_pattern| is split into subpatterns separated by a '*' wildcard.
61 // Then for each subpattern a failure function of the KMP algorithm is built,
62 // with the caveat that if some subpattern contains at least one '^'
63 // placeholder, all the separator characters in this subpattern are
64 // considered equivalent, and the failure function subarray is prefixed with
65 // the value 1.
66 //
67 // The failure functions of subpatterns are stored sequentially in the
68 // |failure_function| array. Some subpatterns, however, will not have a
69 // corresponding failure function, e.g. the first subpattern if the rule's
70 // |anchor_left| is BOUNDARY.
71 failure_function : [ubyte];
72 } 56 }
73 57
74 // Contains an N-gram (acting as a key in a hash table) and a list of URL rules 58 // Contains an N-gram (acting as a key in a hash table) and a list of URL rules
75 // associated with that N-gram. 59 // associated with that N-gram.
76 table NGramToRules { 60 table NGramToRules {
77 // A string consisting of N (up to 8) non-special characters, which are stored 61 // A string consisting of N (up to 8) non-special characters, which are stored
78 // in the lowest N non-zero bytes, lower bytes corresponding to later symbols. 62 // in the lowest N non-zero bytes, lower bytes corresponding to later symbols.
79 ngram : ulong; 63 ngram : ulong;
80 64
81 // The list of rules containing |ngram| as a substring of their URL pattern. 65 // The list of rules containing |ngram| as a substring of their URL pattern.
(...skipping 26 matching lines...) Expand all
108 // The top-level data structure used to store URL rules. 92 // The top-level data structure used to store URL rules.
109 table IndexedRuleset { 93 table IndexedRuleset {
110 // The index of all blacklist URL rules. 94 // The index of all blacklist URL rules.
111 blacklist_index : UrlPatternIndex; 95 blacklist_index : UrlPatternIndex;
112 96
113 // The index of all whitelist URL rules. 97 // The index of all whitelist URL rules.
114 whitelist_index : UrlPatternIndex; 98 whitelist_index : UrlPatternIndex;
115 } 99 }
116 100
117 root_type IndexedRuleset; 101 root_type IndexedRuleset;
OLDNEW
« no previous file with comments | « components/subresource_filter/core/common/BUILD.gn ('k') | components/subresource_filter/core/common/fuzzy_pattern_matching.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698