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 // See net/disk_cache/disk_cache.h for the public interface. | 5 // See net/disk_cache/disk_cache.h for the public interface. |
6 | 6 |
7 #ifndef NET_DISK_CACHE_BLOCK_FILES_H__ | 7 #ifndef NET_DISK_CACHE_BLOCK_FILES_H__ |
8 #define NET_DISK_CACHE_BLOCK_FILES_H__ | 8 #define NET_DISK_CACHE_BLOCK_FILES_H__ |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // Returns the appropriate file to use for a new block. | 55 // Returns the appropriate file to use for a new block. |
56 MappedFile* FileForNewBlock(FileType block_type, int block_count); | 56 MappedFile* FileForNewBlock(FileType block_type, int block_count); |
57 | 57 |
58 // Returns the next block file on this chain, creating new files if needed. | 58 // Returns the next block file on this chain, creating new files if needed. |
59 MappedFile* NextFile(const MappedFile* file); | 59 MappedFile* NextFile(const MappedFile* file); |
60 | 60 |
61 // Creates an empty block file and returns its index. | 61 // Creates an empty block file and returns its index. |
62 int CreateNextBlockFile(FileType block_type); | 62 int CreateNextBlockFile(FileType block_type); |
63 | 63 |
| 64 // Removes a chained block file that is now empty. |
| 65 void RemoveEmptyFile(FileType block_type); |
| 66 |
64 // Restores the header of a potentially inconsistent file. | 67 // Restores the header of a potentially inconsistent file. |
65 bool FixBlockFileHeader(MappedFile* file); | 68 bool FixBlockFileHeader(MappedFile* file); |
66 | 69 |
67 // Returns the filename for a given file index. | 70 // Returns the filename for a given file index. |
68 std::wstring Name(int index); | 71 std::wstring Name(int index); |
69 | 72 |
70 bool init_; | 73 bool init_; |
71 char* zero_buffer_; // Buffer to speed-up cleaning deleted entries. | 74 char* zero_buffer_; // Buffer to speed-up cleaning deleted entries. |
72 std::wstring path_; // Path to the backing folder. | 75 std::wstring path_; // Path to the backing folder. |
73 std::vector<MappedFile*> block_files_; // The actual files. | 76 std::vector<MappedFile*> block_files_; // The actual files. |
74 | 77 |
75 DISALLOW_EVIL_CONSTRUCTORS(BlockFiles); | 78 DISALLOW_EVIL_CONSTRUCTORS(BlockFiles); |
76 }; | 79 }; |
77 | 80 |
78 } // namespace disk_cache | 81 } // namespace disk_cache |
79 | 82 |
80 #endif // NET_DISK_CACHE_BLOCK_FILES_H__ | 83 #endif // NET_DISK_CACHE_BLOCK_FILES_H__ |
OLD | NEW |