Chromium Code Reviews| 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_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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 void DeleteMapBlock(int index, int block_size); | 42 void DeleteMapBlock(int index, int block_size); |
| 43 | 43 |
| 44 // Returns true if the specified block is used. | 44 // Returns true if the specified block is used. |
| 45 bool UsedMapBlock(int index, int size); | 45 bool UsedMapBlock(int index, int size); |
| 46 | 46 |
| 47 // Restores the "empty counters" and allocation hints. | 47 // Restores the "empty counters" and allocation hints. |
| 48 void FixAllocationCounters(); | 48 void FixAllocationCounters(); |
| 49 | 49 |
| 50 // Returns true if the current block file should not be used as-is to store | 50 // Returns true if the current block file should not be used as-is to store |
| 51 // more records. |block_count| is the number of blocks to allocate. | 51 // more records. |block_count| is the number of blocks to allocate. |
| 52 bool NeedToGrowBlockFile(int block_count); | 52 bool NeedToGrowBlockFile(int block_count) const; |
|
gavinp
2013/06/27 07:06:18
Nice!
| |
| 53 | |
| 54 // Returns true if this block file can be used to store an extra record of | |
| 55 // size |block_count|. | |
| 56 bool CanAllocate(int block_count) const; | |
| 53 | 57 |
| 54 // Returns the number of empty blocks for this file. | 58 // Returns the number of empty blocks for this file. |
| 55 int EmptyBlocks() const; | 59 int EmptyBlocks() const; |
| 56 | 60 |
| 57 // Returns true if the counters look OK. | 61 // Returns true if the counters look OK. |
| 58 bool ValidateCounters() const; | 62 bool ValidateCounters() const; |
| 59 | 63 |
| 60 // Returns the size of the wrapped structure (BlockFileHeader). | 64 // Returns the size of the wrapped structure (BlockFileHeader). |
| 61 int Size() const; | 65 int Size() const; |
| 62 | 66 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_TruncatedFile); | 147 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_TruncatedFile); |
| 144 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_InvalidFile); | 148 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_InvalidFile); |
| 145 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_Stats); | 149 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_Stats); |
| 146 | 150 |
| 147 DISALLOW_COPY_AND_ASSIGN(BlockFiles); | 151 DISALLOW_COPY_AND_ASSIGN(BlockFiles); |
| 148 }; | 152 }; |
| 149 | 153 |
| 150 } // namespace disk_cache | 154 } // namespace disk_cache |
| 151 | 155 |
| 152 #endif // NET_DISK_CACHE_BLOCK_FILES_H_ | 156 #endif // NET_DISK_CACHE_BLOCK_FILES_H_ |
| OLD | NEW |