OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // A read-only set implementation for |SBPrefix| items. Prefixes are | 5 // A read-only set implementation for |SBPrefix| items. Prefixes are |
6 // sorted and stored as 16-bit deltas from the previous prefix. An | 6 // sorted and stored as 16-bit deltas from the previous prefix. An |
7 // index structure provides quick random access, and also handles | 7 // index structure provides quick random access, and also handles |
8 // cases where 16 bits cannot encode a delta. | 8 // cases where 16 bits cannot encode a delta. |
9 // | 9 // |
10 // For example, the sequence {20, 25, 41, 65432, 150000, 160000} would | 10 // For example, the sequence {20, 25, 41, 65432, 150000, 160000} would |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, IntMinMax); | 84 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, IntMinMax); |
85 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, OneElement); | 85 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, OneElement); |
86 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, ReadWrite); | 86 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, ReadWrite); |
87 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, ReadWriteSigned); | 87 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, ReadWriteSigned); |
88 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, Version3); | 88 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, Version3); |
89 | 89 |
90 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, BasicStore); | 90 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, BasicStore); |
91 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, DeleteChunks); | 91 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, DeleteChunks); |
92 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, DetectsCorruption); | 92 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, DetectsCorruption); |
93 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Empty); | 93 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Empty); |
| 94 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, KnockoutPrefixVolunteers); |
94 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, PrefixMinMax); | 95 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, PrefixMinMax); |
95 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, SubKnockout); | 96 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, SubKnockout); |
96 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Version7); | 97 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Version7); |
97 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Version8); | 98 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Version8); |
98 | 99 |
99 // Maximum number of consecutive deltas to encode before generating | 100 // Maximum number of consecutive deltas to encode before generating |
100 // a new index entry. This helps keep the worst-case performance | 101 // a new index entry. This helps keep the worst-case performance |
101 // for |Exists()| under control. | 102 // for |Exists()| under control. |
102 static const size_t kMaxRun = 100; | 103 static const size_t kMaxRun = 100; |
103 | 104 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // Buffers prefixes until enough are avaliable to emit a run. | 175 // Buffers prefixes until enough are avaliable to emit a run. |
175 std::vector<SBPrefix> buffer_; | 176 std::vector<SBPrefix> buffer_; |
176 | 177 |
177 // The PrefixSet being built. | 178 // The PrefixSet being built. |
178 scoped_ptr<PrefixSet> prefix_set_; | 179 scoped_ptr<PrefixSet> prefix_set_; |
179 }; | 180 }; |
180 | 181 |
181 } // namespace safe_browsing | 182 } // namespace safe_browsing |
182 | 183 |
183 #endif // CHROME_BROWSER_SAFE_BROWSING_PREFIX_SET_H_ | 184 #endif // CHROME_BROWSER_SAFE_BROWSING_PREFIX_SET_H_ |
OLD | NEW |