OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ |
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ | 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "components/safe_browsing_db/v4_protocol_manager_util.h" | 12 #include "components/safe_browsing_db/v4_protocol_manager_util.h" |
13 | 13 |
14 namespace safe_browsing { | 14 namespace safe_browsing { |
15 | 15 |
16 class V4Store; | 16 class V4Store; |
17 | 17 |
18 typedef base::Callback<void(std::unique_ptr<V4Store>)> | 18 typedef base::Callback<void(std::unique_ptr<V4Store>)> |
19 UpdatedStoreReadyCallback; | 19 UpdatedStoreReadyCallback; |
20 | 20 |
21 // The size of the hash prefix, in bytes. It should be between 4 to 32 (full | |
22 // hash). | |
23 typedef size_t PrefixSize; | |
24 | |
25 // The sorted list of hash prefixes. | 21 // The sorted list of hash prefixes. |
26 typedef std::string HashPrefixes; | 22 typedef std::string HashPrefixes; |
27 | 23 |
28 // Stores the list of sorted hash prefixes, by size. | 24 // Stores the list of sorted hash prefixes, by size. |
29 // For instance: {4: ["abcd", "bcde", "cdef", "gggg"], 5: ["fffff"]} | 25 // For instance: {4: ["abcd", "bcde", "cdef", "gggg"], 5: ["fffff"]} |
30 typedef base::hash_map<PrefixSize, HashPrefixes> HashPrefixMap; | 26 typedef base::hash_map<PrefixSize, HashPrefixes> HashPrefixMap; |
31 | 27 |
32 // Stores the iterator to the last element merged from the HashPrefixMap for a | 28 // Stores the iterator to the last element merged from the HashPrefixMap for a |
33 // given prefix size. | 29 // given prefix size. |
34 // For instance: {4:iter(3), 5:iter(1)} means that we have already merged | 30 // For instance: {4:iter(3), 5:iter(1)} means that we have already merged |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 const base::FilePath store_path_; | 351 const base::FilePath store_path_; |
356 HashPrefixMap hash_prefix_map_; | 352 HashPrefixMap hash_prefix_map_; |
357 const scoped_refptr<base::SequencedTaskRunner> task_runner_; | 353 const scoped_refptr<base::SequencedTaskRunner> task_runner_; |
358 }; | 354 }; |
359 | 355 |
360 std::ostream& operator<<(std::ostream& os, const V4Store& store); | 356 std::ostream& operator<<(std::ostream& os, const V4Store& store); |
361 | 357 |
362 } // namespace safe_browsing | 358 } // namespace safe_browsing |
363 | 359 |
364 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ | 360 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ |
OLD | NEW |