| 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 #include "chrome/browser/safe_browsing/safe_browsing_database_bloom.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_database_bloom.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/platform_thread.h" | 11 #include "base/platform_thread.h" |
| 12 #include "base/sha2.h" | 12 #include "base/sha2.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "chrome/browser/safe_browsing/bloom_filter.h" | 14 #include "chrome/browser/safe_browsing/bloom_filter.h" |
| 15 #include "chrome/browser/safe_browsing/chunk_range.h" | 15 #include "chrome/browser/safe_browsing/chunk_range.h" |
| 16 #include "chrome/common/sqlite_compiled_statement.h" | 16 #include "chrome/common/sqlite_compiled_statement.h" |
| 17 #include "chrome/common/sqlite_utils.h" | 17 #include "chrome/common/sqlite_utils.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 | 19 |
| 20 using base::Time; |
| 21 using base::TimeDelta; |
| 22 |
| 20 // Database version. If this is different than what's stored on disk, the | 23 // Database version. If this is different than what's stored on disk, the |
| 21 // database is reset. | 24 // database is reset. |
| 22 static const int kDatabaseVersion = 6; | 25 static const int kDatabaseVersion = 6; |
| 23 | 26 |
| 24 // Don't want to create too small of a bloom filter initially while we're | 27 // Don't want to create too small of a bloom filter initially while we're |
| 25 // downloading the data and then keep having to rebuild it. | 28 // downloading the data and then keep having to rebuild it. |
| 26 static const int kBloomFilterMinSize = 250000; | 29 static const int kBloomFilterMinSize = 250000; |
| 27 | 30 |
| 28 // How many bits to use per item. See the design doc for more information. | 31 // How many bits to use per item. See the design doc for more information. |
| 29 static const int kBloomFilterSizeRatio = 13; | 32 static const int kBloomFilterSizeRatio = 13; |
| (...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 if (did_resume_) { | 1054 if (did_resume_) { |
| 1052 PlatformThread::Sleep(kOnResumeHoldupMs); | 1055 PlatformThread::Sleep(kOnResumeHoldupMs); |
| 1053 did_resume_ = false; | 1056 did_resume_ = false; |
| 1054 } | 1057 } |
| 1055 } | 1058 } |
| 1056 | 1059 |
| 1057 // This database is always synchronous since we don't need to worry about | 1060 // This database is always synchronous since we don't need to worry about |
| 1058 // blocking any incoming reads. | 1061 // blocking any incoming reads. |
| 1059 void SafeBrowsingDatabaseBloom::SetSynchronous() { | 1062 void SafeBrowsingDatabaseBloom::SetSynchronous() { |
| 1060 } | 1063 } |
| OLD | NEW |