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 "net/disk_cache/block_files.h" | 5 #include "net/disk_cache/block_files.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/histogram.h" | 8 #include "base/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "net/disk_cache/file_lock.h" | 11 #include "net/disk_cache/file_lock.h" |
12 | 12 |
| 13 using base::Time; |
| 14 |
13 namespace { | 15 namespace { |
14 | 16 |
15 const wchar_t* kBlockName = L"data_"; | 17 const wchar_t* kBlockName = L"data_"; |
16 | 18 |
17 // This array is used to perform a fast lookup of the nibble bit pattern to the | 19 // This array is used to perform a fast lookup of the nibble bit pattern to the |
18 // type of entry that can be stored there (number of consecutive blocks). | 20 // type of entry that can be stored there (number of consecutive blocks). |
19 const char s_types[16] = {4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}; | 21 const char s_types[16] = {4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}; |
20 | 22 |
21 // Returns the type of block (number of consecutive blocks that can be stored) | 23 // Returns the type of block (number of consecutive blocks that can be stored) |
22 // for a given nibble of the bitmap. | 24 // for a given nibble of the bitmap. |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 int num_entries = (file_size - sizeof(*header)) / header->entry_size; | 414 int num_entries = (file_size - sizeof(*header)) / header->entry_size; |
413 header->max_entries = num_entries; | 415 header->max_entries = num_entries; |
414 } | 416 } |
415 | 417 |
416 FixAllocationCounters(header); | 418 FixAllocationCounters(header); |
417 header->updating = 0; | 419 header->updating = 0; |
418 return true; | 420 return true; |
419 } | 421 } |
420 | 422 |
421 } // namespace disk_cache | 423 } // namespace disk_cache |
OLD | NEW |