| 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 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
| 9 #include "base/md5.h" | 9 #include "base/md5.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // values are preferred to minimize looping overhead during processing. | 39 // values are preferred to minimize looping overhead during processing. |
| 40 const int64 kUpdateStorageBytes = 100 * 1024; | 40 const int64 kUpdateStorageBytes = 100 * 1024; |
| 41 | 41 |
| 42 // Prevent excessive sharding by setting a lower limit on the shard stride. | 42 // Prevent excessive sharding by setting a lower limit on the shard stride. |
| 43 // Smaller values should work fine, but very small values will probably lead to | 43 // Smaller values should work fine, but very small values will probably lead to |
| 44 // poor performance. Shard stride is indirectly related to | 44 // poor performance. Shard stride is indirectly related to |
| 45 // |kUpdateStorageBytes|, setting that very small will bump against this. | 45 // |kUpdateStorageBytes|, setting that very small will bump against this. |
| 46 const uint32 kMinShardStride = 1 << 24; | 46 const uint32 kMinShardStride = 1 << 24; |
| 47 | 47 |
| 48 // Strides over the entire SBPrefix space. | 48 // Strides over the entire SBPrefix space. |
| 49 const uint64 kMaxShardStride = GG_LONGLONG(1u) << 32; | 49 const uint64 kMaxShardStride = 1ULL << 32; |
| 50 | 50 |
| 51 // Maximum SBPrefix value. | 51 // Maximum SBPrefix value. |
| 52 const SBPrefix kMaxSBPrefix = ~0; | 52 const SBPrefix kMaxSBPrefix = ~0; |
| 53 | 53 |
| 54 // Header at the front of the main database file. | 54 // Header at the front of the main database file. |
| 55 struct FileHeaderV8 { | 55 struct FileHeaderV8 { |
| 56 int32 magic, version; | 56 int32 magic, version; |
| 57 uint32 add_chunk_count, sub_chunk_count; | 57 uint32 add_chunk_count, sub_chunk_count; |
| 58 uint32 shard_stride; | 58 uint32 shard_stride; |
| 59 // TODO(shess): Is this where 64-bit will bite me? Perhaps write a | 59 // TODO(shess): Is this where 64-bit will bite me? Perhaps write a |
| (...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 // With SQLite support gone, one way to get to this code is if the | 1254 // With SQLite support gone, one way to get to this code is if the |
| 1255 // existing file is a SQLite file. Make sure the journal file is | 1255 // existing file is a SQLite file. Make sure the journal file is |
| 1256 // also removed. | 1256 // also removed. |
| 1257 const base::FilePath journal_filename( | 1257 const base::FilePath journal_filename( |
| 1258 basename.value() + FILE_PATH_LITERAL("-journal")); | 1258 basename.value() + FILE_PATH_LITERAL("-journal")); |
| 1259 if (base::PathExists(journal_filename)) | 1259 if (base::PathExists(journal_filename)) |
| 1260 base::DeleteFile(journal_filename, false); | 1260 base::DeleteFile(journal_filename, false); |
| 1261 | 1261 |
| 1262 return true; | 1262 return true; |
| 1263 } | 1263 } |
| OLD | NEW |