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 28 matching lines...) Expand all Loading... |
39 // | 39 // |
40 // The on-disk format looks like: | 40 // The on-disk format looks like: |
41 // 4 byte magic number | 41 // 4 byte magic number |
42 // 4 byte version number | 42 // 4 byte version number |
43 // 4 byte |index_.size()| | 43 // 4 byte |index_.size()| |
44 // 4 byte |deltas_.size()| | 44 // 4 byte |deltas_.size()| |
45 // n * 8 byte |&index_[0]..&index_[n]| | 45 // n * 8 byte |&index_[0]..&index_[n]| |
46 // m * 2 byte |&deltas_[0]..&deltas_[m]| | 46 // m * 2 byte |&deltas_[0]..&deltas_[m]| |
47 // 16 byte digest | 47 // 16 byte digest |
48 | 48 |
49 #ifndef CHROME_BROWSER_SAFE_BROWSING_PREFIX_SET_H_ | 49 #ifndef COMPONENTS_SAFE_BROWSING_DB_PREFIX_SET_H_ |
50 #define CHROME_BROWSER_SAFE_BROWSING_PREFIX_SET_H_ | 50 #define COMPONENTS_SAFE_BROWSING_DB_PREFIX_SET_H_ |
51 | 51 |
52 #include <utility> | 52 #include <utility> |
53 #include <vector> | 53 #include <vector> |
54 | 54 |
55 #include "base/gtest_prod_util.h" | 55 #include "base/gtest_prod_util.h" |
| 56 #include "base/macros.h" |
56 #include "base/memory/scoped_ptr.h" | 57 #include "base/memory/scoped_ptr.h" |
57 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 58 #include "components/safe_browsing_db/safe_browsing_db_util.h" |
58 | 59 |
59 namespace base { | 60 namespace base { |
60 class FilePath; | 61 class FilePath; |
61 } | 62 } |
62 | 63 |
63 namespace safe_browsing { | 64 namespace safe_browsing { |
64 | 65 |
65 class PrefixSet { | 66 class PrefixSet { |
66 public: | 67 public: |
67 ~PrefixSet(); | 68 ~PrefixSet(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 177 |
177 // Buffers prefixes until enough are avaliable to emit a run. | 178 // Buffers prefixes until enough are avaliable to emit a run. |
178 std::vector<SBPrefix> buffer_; | 179 std::vector<SBPrefix> buffer_; |
179 | 180 |
180 // The PrefixSet being built. | 181 // The PrefixSet being built. |
181 scoped_ptr<PrefixSet> prefix_set_; | 182 scoped_ptr<PrefixSet> prefix_set_; |
182 }; | 183 }; |
183 | 184 |
184 } // namespace safe_browsing | 185 } // namespace safe_browsing |
185 | 186 |
186 #endif // CHROME_BROWSER_SAFE_BROWSING_PREFIX_SET_H_ | 187 #endif // COMPONENTS_SAFE_BROWSING_DB_PREFIX_SET_H_ |
OLD | NEW |