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 27 matching lines...) Expand all Loading... |
38 // values are preferred to minimize looping overhead during processing. | 38 // values are preferred to minimize looping overhead during processing. |
39 const int64 kUpdateStorageBytes = 100 * 1024; | 39 const int64 kUpdateStorageBytes = 100 * 1024; |
40 | 40 |
41 // Prevent excessive sharding by setting a lower limit on the shard stride. | 41 // Prevent excessive sharding by setting a lower limit on the shard stride. |
42 // Smaller values should work fine, but very small values will probably lead to | 42 // Smaller values should work fine, but very small values will probably lead to |
43 // poor performance. Shard stride is indirectly related to | 43 // poor performance. Shard stride is indirectly related to |
44 // |kUpdateStorageBytes|, setting that very small will bump against this. | 44 // |kUpdateStorageBytes|, setting that very small will bump against this. |
45 const uint32 kMinShardStride = 1 << 24; | 45 const uint32 kMinShardStride = 1 << 24; |
46 | 46 |
47 // Strides over the entire SBPrefix space. | 47 // Strides over the entire SBPrefix space. |
48 const uint64 kMaxShardStride = 1ULL << 32; | 48 const uint64 kMaxShardStride = GG_LONGLONG(1u) << 32; |
49 | 49 |
50 // Maximum SBPrefix value. | 50 // Maximum SBPrefix value. |
51 const SBPrefix kMaxSBPrefix = ~0; | 51 const SBPrefix kMaxSBPrefix = ~0; |
52 | 52 |
53 // Header at the front of the main database file. | 53 // Header at the front of the main database file. |
54 struct FileHeaderV8 { | 54 struct FileHeaderV8 { |
55 int32 magic, version; | 55 int32 magic, version; |
56 uint32 add_chunk_count, sub_chunk_count; | 56 uint32 add_chunk_count, sub_chunk_count; |
57 uint32 shard_stride; | 57 uint32 shard_stride; |
58 // TODO(shess): Is this where 64-bit will bite me? Perhaps write a | 58 // TODO(shess): Is this where 64-bit will bite me? Perhaps write a |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 // With SQLite support gone, one way to get to this code is if the | 1209 // With SQLite support gone, one way to get to this code is if the |
1210 // existing file is a SQLite file. Make sure the journal file is | 1210 // existing file is a SQLite file. Make sure the journal file is |
1211 // also removed. | 1211 // also removed. |
1212 const base::FilePath journal_filename( | 1212 const base::FilePath journal_filename( |
1213 basename.value() + FILE_PATH_LITERAL("-journal")); | 1213 basename.value() + FILE_PATH_LITERAL("-journal")); |
1214 if (base::PathExists(journal_filename)) | 1214 if (base::PathExists(journal_filename)) |
1215 base::DeleteFile(journal_filename, false); | 1215 base::DeleteFile(journal_filename, false); |
1216 | 1216 |
1217 return true; | 1217 return true; |
1218 } | 1218 } |
OLD | NEW |