| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, IntMinMax); | 85 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, IntMinMax); |
| 86 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, OneElement); | 86 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, OneElement); |
| 87 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, ReadWrite); | 87 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, ReadWrite); |
| 88 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, ReadWriteSigned); | 88 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, ReadWriteSigned); |
| 89 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, Version3); | 89 FRIEND_TEST_ALL_PREFIXES(PrefixSetTest, Version3); |
| 90 | 90 |
| 91 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, BasicStore); | 91 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, BasicStore); |
| 92 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, DeleteChunks); | 92 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, DeleteChunks); |
| 93 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, DetectsCorruption); | 93 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, DetectsCorruption); |
| 94 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Empty); | 94 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Empty); |
| 95 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, KnockoutPrefixVolunteers); | |
| 96 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, PrefixMinMax); | 95 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, PrefixMinMax); |
| 97 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, SubKnockout); | 96 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, SubKnockout); |
| 98 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Version7); | 97 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Version7); |
| 99 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Version8); | 98 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingStoreFileTest, Version8); |
| 100 | 99 |
| 101 // Maximum number of consecutive deltas to encode before generating | 100 // Maximum number of consecutive deltas to encode before generating |
| 102 // a new index entry. This helps keep the worst-case performance | 101 // a new index entry. This helps keep the worst-case performance |
| 103 // for |Exists()| under control. | 102 // for |Exists()| under control. |
| 104 static const size_t kMaxRun = 100; | 103 static const size_t kMaxRun = 100; |
| 105 | 104 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // Buffers prefixes until enough are avaliable to emit a run. | 175 // Buffers prefixes until enough are avaliable to emit a run. |
| 177 std::vector<SBPrefix> buffer_; | 176 std::vector<SBPrefix> buffer_; |
| 178 | 177 |
| 179 // The PrefixSet being built. | 178 // The PrefixSet being built. |
| 180 scoped_ptr<PrefixSet> prefix_set_; | 179 scoped_ptr<PrefixSet> prefix_set_; |
| 181 }; | 180 }; |
| 182 | 181 |
| 183 } // namespace safe_browsing | 182 } // namespace safe_browsing |
| 184 | 183 |
| 185 #endif // CHROME_BROWSER_SAFE_BROWSING_PREFIX_SET_H_ | 184 #endif // CHROME_BROWSER_SAFE_BROWSING_PREFIX_SET_H_ |
| OLD | NEW |