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

Side by Side Diff: net/base/registry_controlled_domains/effective_tld_names_unittest1.cc

Issue 13979002: Add support for split PSL list distinctions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed chrome_frame compilation issue Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* C++ code produced by gperf version 3.0.3 */ 1 /* C++ code produced by gperf version 3.0.3 */
2 /* Command-line: gperf -a -L C++ -C -c -o -t -k '*' -NFindDomain -ZPerfect_Hash_ Test1 -D effective_tld_names_unittest1.gperf */ 2 /* Command-line: gperf -a -L C++ -C -c -o -t -k '*' -NFindDomain -ZPerfect_Hash_ Test1 -D effective_tld_names_unittest1.gperf */
3 3
4 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ 4 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
5 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ 5 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
6 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ 6 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
7 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ 7 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
8 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ 8 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
9 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ 9 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
10 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ 10 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
(...skipping 23 matching lines...) Expand all
34 // Use of this source code is governed by a BSD-style license that can be 34 // Use of this source code is governed by a BSD-style license that can be
35 // found in the LICENSE file. 35 // found in the LICENSE file.
36 // Test file used by registry_controlled_domain_unittest. 36 // Test file used by registry_controlled_domain_unittest.
37 // We edit this file manually, then run 37 // We edit this file manually, then run
38 // gperf -a -L "C++" -C -c -o -t -k '*' -NFindDomain -ZPerfect_Hash_Test1 -D eff ective_tld_names_unittest1.gperf > effective_tld_names_unittest1.cc 38 // gperf -a -L "C++" -C -c -o -t -k '*' -NFindDomain -ZPerfect_Hash_Test1 -D eff ective_tld_names_unittest1.gperf > effective_tld_names_unittest1.cc
39 // to generate the perfect hashmap. 39 // to generate the perfect hashmap.
40 #line 10 "effective_tld_names_unittest1.gperf" 40 #line 10 "effective_tld_names_unittest1.gperf"
41 struct DomainRule { 41 struct DomainRule {
42 const char *name; 42 const char *name;
43 int type; // 1: exception, 2: wildcard 43 int type; // 1: exception, 2: wildcard
44 bool is_private;
44 }; 45 };
45 46
46 #define TOTAL_KEYWORDS 8 47 #define TOTAL_KEYWORDS 11
47 #define MIN_WORD_LENGTH 1 48 #define MIN_WORD_LENGTH 1
48 #define MAX_WORD_LENGTH 11 49 #define MAX_WORD_LENGTH 11
49 #define MIN_HASH_VALUE 1 50 #define MIN_HASH_VALUE 1
50 #define MAX_HASH_VALUE 16 51 #define MAX_HASH_VALUE 17
51 /* maximum key range = 16, duplicates = 0 */ 52 /* maximum key range = 17, duplicates = 0 */
52 53
53 class Perfect_Hash_Test1 54 class Perfect_Hash_Test1
54 { 55 {
55 private: 56 private:
56 static inline unsigned int hash (const char *str, unsigned int len); 57 static inline unsigned int hash (const char *str, unsigned int len);
57 public: 58 public:
58 static const struct DomainRule *FindDomain (const char *str, unsigned int len) ; 59 static const struct DomainRule *FindDomain (const char *str, unsigned int len) ;
59 }; 60 };
60 61
61 inline unsigned int 62 inline unsigned int
62 Perfect_Hash_Test1::hash (register const char *str, register unsigned int len) 63 Perfect_Hash_Test1::hash (register const char *str, register unsigned int len)
63 { 64 {
64 static const unsigned char asso_values[] = 65 static const unsigned char asso_values[] =
65 { 66 {
66 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 67 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
67 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 68 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
68 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 69 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
69 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 70 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
70 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 71 18, 18, 18, 18, 18, 18, 0, 18, 18, 18,
71 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 72 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
72 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 73 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
73 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 74 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
74 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 75 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
75 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 76 18, 18, 18, 18, 18, 18, 18, 0, 0, 0,
76 17, 5, 0, 17, 17, 17, 0, 17, 17, 0, 77 18, 5, 0, 18, 18, 0, 0, 18, 18, 0,
77 17, 0, 0, 17, 0, 17, 17, 17, 17, 17, 78 5, 0, 0, 18, 0, 18, 5, 18, 0, 18,
78 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 79 18, 18, 0, 18, 18, 18, 18, 18, 18, 18,
79 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 80 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
80 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 81 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
81 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 82 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
82 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 83 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
83 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 84 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
84 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 85 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
85 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 86 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
86 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 87 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
87 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 88 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
88 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 89 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
89 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 90 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
90 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 91 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
91 17, 17, 17, 17, 17, 17 92 18, 18, 18, 18, 18, 18
92 }; 93 };
93 register int hval = len; 94 register int hval = len;
94 95
95 switch (hval) 96 switch (hval)
96 { 97 {
97 default: 98 default:
98 hval += asso_values[(unsigned char)str[10]]; 99 hval += asso_values[(unsigned char)str[10]];
99 /*FALLTHROUGH*/ 100 /*FALLTHROUGH*/
100 case 10: 101 case 10:
101 hval += asso_values[(unsigned char)str[9]]; 102 hval += asso_values[(unsigned char)str[9]];
(...skipping 27 matching lines...) Expand all
129 break; 130 break;
130 } 131 }
131 return hval; 132 return hval;
132 } 133 }
133 134
134 const struct DomainRule * 135 const struct DomainRule *
135 Perfect_Hash_Test1::FindDomain (register const char *str, register unsigned int len) 136 Perfect_Hash_Test1::FindDomain (register const char *str, register unsigned int len)
136 { 137 {
137 static const struct DomainRule wordlist[] = 138 static const struct DomainRule wordlist[] =
138 { 139 {
140 #line 22 "effective_tld_names_unittest1.gperf"
141 {"c", 2, false},
142 #line 16 "effective_tld_names_unittest1.gperf"
143 {"jp", 0, false},
144 #line 23 "effective_tld_names_unittest1.gperf"
145 {"b.c", 1, false},
146 #line 17 "effective_tld_names_unittest1.gperf"
147 {"ac.jp", 0, false},
148 #line 18 "effective_tld_names_unittest1.gperf"
149 {"bar.jp", 2, false},
150 #line 24 "effective_tld_names_unittest1.gperf"
151 {"no", 0, false},
152 #line 19 "effective_tld_names_unittest1.gperf"
153 {"baz.bar.jp", 2, false},
139 #line 21 "effective_tld_names_unittest1.gperf" 154 #line 21 "effective_tld_names_unittest1.gperf"
140 {"c", 2}, 155 {"bar.baz.com", 0, false},
141 #line 15 "effective_tld_names_unittest1.gperf" 156 #line 25 "effective_tld_names_unittest1.gperf"
142 {"jp", 0}, 157 {"priv.no", 0, true},
143 #line 22 "effective_tld_names_unittest1.gperf"
144 {"b.c", 1},
145 #line 16 "effective_tld_names_unittest1.gperf"
146 {"ac.jp", 0},
147 #line 17 "effective_tld_names_unittest1.gperf"
148 {"bar.jp", 2},
149 #line 18 "effective_tld_names_unittest1.gperf"
150 {"baz.bar.jp", 2},
151 #line 20 "effective_tld_names_unittest1.gperf" 158 #line 20 "effective_tld_names_unittest1.gperf"
152 {"bar.baz.com", 0}, 159 {"pref.bar.jp", 1, false},
153 #line 19 "effective_tld_names_unittest1.gperf" 160 #line 26 "effective_tld_names_unittest1.gperf"
154 {"pref.bar.jp", 1} 161 {"private", 0, true}
155 }; 162 };
156 163
157 static const signed char lookup[] = 164 static const signed char lookup[] =
158 { 165 {
159 -1, 0, 1, 2, -1, 3, 4, -1, -1, -1, 5, 6, -1, -1, 166 -1, 0, 1, 2, -1, 3, 4, 5, -1, -1, 6, 7, 8, -1,
160 -1, -1, 7 167 -1, -1, 9, 10
161 }; 168 };
162 169
163 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 170 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
164 { 171 {
165 register int key = hash (str, len); 172 register int key = hash (str, len);
166 173
167 if (key <= MAX_HASH_VALUE && key >= 0) 174 if (key <= MAX_HASH_VALUE && key >= 0)
168 { 175 {
169 register int index = lookup[key]; 176 register int index = lookup[key];
170 177
171 if (index >= 0) 178 if (index >= 0)
172 { 179 {
173 register const char *s = wordlist[index].name; 180 register const char *s = wordlist[index].name;
174 181
175 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') 182 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
176 return &wordlist[index]; 183 return &wordlist[index];
177 } 184 }
178 } 185 }
179 } 186 }
180 return 0; 187 return 0;
181 } 188 }
182 #line 23 "effective_tld_names_unittest1.gperf" 189 #line 27 "effective_tld_names_unittest1.gperf"
183 190
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698