| 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_impl.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_database_impl.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 = 4; | 25 static const int kDatabaseVersion = 4; |
| 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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 kOnResumeHoldupMs); | 1206 kOnResumeHoldupMs); |
| 1204 } | 1207 } |
| 1205 | 1208 |
| 1206 void SafeBrowsingDatabaseImpl::OnResumeDone() { | 1209 void SafeBrowsingDatabaseImpl::OnResumeDone() { |
| 1207 disk_delay_ = kMaxThreadHoldupMs; | 1210 disk_delay_ = kMaxThreadHoldupMs; |
| 1208 } | 1211 } |
| 1209 | 1212 |
| 1210 void SafeBrowsingDatabaseImpl::SetSynchronous() { | 1213 void SafeBrowsingDatabaseImpl::SetSynchronous() { |
| 1211 asynchronous_ = false; | 1214 asynchronous_ = false; |
| 1212 } | 1215 } |
| OLD | NEW |