OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_BLOOM_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_BLOOM_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_BLOOM_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_BLOOM_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 #include <queue> | 10 #include <queue> |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 // Called when the user's machine has resumed from a lower power state. | 75 // Called when the user's machine has resumed from a lower power state. |
76 virtual void HandleResume(); | 76 virtual void HandleResume(); |
77 | 77 |
78 // Returns true if we have successfully started the update transaction. | 78 // Returns true if we have successfully started the update transaction. |
79 virtual bool UpdateStarted(); | 79 virtual bool UpdateStarted(); |
80 virtual void UpdateFinished(bool update_succeeded); | 80 virtual void UpdateFinished(bool update_succeeded); |
81 | 81 |
82 virtual bool NeedToCheckUrl(const GURL& url); | 82 virtual bool NeedToCheckUrl(const GURL& url); |
83 | 83 |
| 84 // How many bits to use per item. See the design doc for more information. |
| 85 static const int kBloomFilterSizeRatio = 25; |
| 86 |
84 private: | 87 private: |
85 // Opens the database. | 88 // Opens the database. |
86 bool Open(); | 89 bool Open(); |
87 | 90 |
88 // Closes the database. | 91 // Closes the database. |
89 bool Close(); | 92 bool Close(); |
90 | 93 |
91 // Creates the SQL tables. | 94 // Creates the SQL tables. |
92 bool CreateTables(); | 95 bool CreateTables(); |
93 | 96 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // Lock for protecting access to the bloom filter and hash cache. | 254 // Lock for protecting access to the bloom filter and hash cache. |
252 Lock lookup_lock_; | 255 Lock lookup_lock_; |
253 | 256 |
254 // A store for GetHash results that have not yet been written to the database. | 257 // A store for GetHash results that have not yet been written to the database. |
255 HashList pending_full_hashes_; | 258 HashList pending_full_hashes_; |
256 | 259 |
257 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseBloom); | 260 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseBloom); |
258 }; | 261 }; |
259 | 262 |
260 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_BLOOM_H_ | 263 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_BLOOM_H_ |
OLD | NEW |