| 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 // 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_BLOCKFILE_BLOCK_FILES_H_ | 7 #ifndef NET_DISK_CACHE_BLOCKFILE_BLOCK_FILES_H_ |
| 8 #define NET_DISK_CACHE_BLOCKFILE_BLOCK_FILES_H_ | 8 #define NET_DISK_CACHE_BLOCKFILE_BLOCK_FILES_H_ |
| 9 | 9 |
| 10 #include <stdint.h> |
| 11 |
| 10 #include <vector> | 12 #include <vector> |
| 11 | 13 |
| 12 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 13 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 15 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
| 16 #include "net/disk_cache/blockfile/addr.h" | 18 #include "net/disk_cache/blockfile/addr.h" |
| 17 #include "net/disk_cache/blockfile/disk_format_base.h" | 19 #include "net/disk_cache/blockfile/disk_format_base.h" |
| 18 #include "net/disk_cache/blockfile/mapped_file.h" | 20 #include "net/disk_cache/blockfile/mapped_file.h" |
| 19 | 21 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Attemp to grow this file. Fails if the file cannot be extended anymore. | 131 // Attemp to grow this file. Fails if the file cannot be extended anymore. |
| 130 bool GrowBlockFile(MappedFile* file, BlockFileHeader* header); | 132 bool GrowBlockFile(MappedFile* file, BlockFileHeader* header); |
| 131 | 133 |
| 132 // Returns the appropriate file to use for a new block. | 134 // Returns the appropriate file to use for a new block. |
| 133 MappedFile* FileForNewBlock(FileType block_type, int block_count); | 135 MappedFile* FileForNewBlock(FileType block_type, int block_count); |
| 134 | 136 |
| 135 // Returns the next block file on this chain, creating new files if needed. | 137 // Returns the next block file on this chain, creating new files if needed. |
| 136 MappedFile* NextFile(MappedFile* file); | 138 MappedFile* NextFile(MappedFile* file); |
| 137 | 139 |
| 138 // Creates an empty block file and returns its index. | 140 // Creates an empty block file and returns its index. |
| 139 int16 CreateNextBlockFile(FileType block_type); | 141 int16_t CreateNextBlockFile(FileType block_type); |
| 140 | 142 |
| 141 // Removes a chained block file that is now empty. | 143 // Removes a chained block file that is now empty. |
| 142 bool RemoveEmptyFile(FileType block_type); | 144 bool RemoveEmptyFile(FileType block_type); |
| 143 | 145 |
| 144 // Restores the header of a potentially inconsistent file. | 146 // Restores the header of a potentially inconsistent file. |
| 145 bool FixBlockFileHeader(MappedFile* file); | 147 bool FixBlockFileHeader(MappedFile* file); |
| 146 | 148 |
| 147 // Retrieves stats for the given file index. | 149 // Retrieves stats for the given file index. |
| 148 void GetFileStats(int index, int* used_count, int* load); | 150 void GetFileStats(int index, int* used_count, int* load); |
| 149 | 151 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 160 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_TruncatedFile); | 162 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_TruncatedFile); |
| 161 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_InvalidFile); | 163 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_InvalidFile); |
| 162 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_Stats); | 164 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_Stats); |
| 163 | 165 |
| 164 DISALLOW_COPY_AND_ASSIGN(BlockFiles); | 166 DISALLOW_COPY_AND_ASSIGN(BlockFiles); |
| 165 }; | 167 }; |
| 166 | 168 |
| 167 } // namespace disk_cache | 169 } // namespace disk_cache |
| 168 | 170 |
| 169 #endif // NET_DISK_CACHE_BLOCKFILE_BLOCK_FILES_H_ | 171 #endif // NET_DISK_CACHE_BLOCKFILE_BLOCK_FILES_H_ |
| OLD | NEW |