Chromium Code Reviews| Index: net/disk_cache/v3/block_bitmaps.h |
| =================================================================== |
| --- net/disk_cache/v3/block_bitmaps.h (revision 210990) |
| +++ net/disk_cache/v3/block_bitmaps.h (working copy) |
| @@ -4,43 +4,34 @@ |
| // See net/disk_cache/disk_cache.h for the public interface. |
| -#ifndef NET_DISK_CACHE_BLOCK_FILES_H_ |
| -#define NET_DISK_CACHE_BLOCK_FILES_H_ |
| +#ifndef NET_DISK_CACHE_V3_BLOCK_BITMAPS_H_ |
| +#define NET_DISK_CACHE_V3_BLOCK_BITMAPS_H_ |
| -#include <vector> |
| - |
| #include "base/files/file_path.h" |
| -#include "base/gtest_prod_util.h" |
| -#include "base/memory/scoped_ptr.h" |
| #include "net/base/net_export.h" |
| #include "net/disk_cache/addr.h" |
| -#include "net/disk_cache/mapped_file.h" |
| +#include "net/disk_cache/block_files.h" |
| namespace disk_cache { |
| // This class handles the set of block-files open by the disk cache. |
|
gavinp
2013/08/05 17:06:15
Can we expand on this comment a bit? I'm still a b
rvargas (doing something else)
2013/08/05 19:50:45
Expended the comment. I can think of handles/repre
gavinp
2013/08/06 01:11:02
None of "handles/represents/encapsulates" are grea
rvargas (doing something else)
2013/08/08 02:50:01
"dedicated files" is a basic concept of this cache
gavinp
2013/08/08 03:04:46
If I understood what this class did, I would be ha
Randy Smith (Not in Mondays)
2013/08/09 19:11:49
At risk of saying something completely wrong (whic
rvargas (doing something else)
2013/08/09 19:53:41
Thanks. I'm more than happy happy to use that desc
|
| -class NET_EXPORT_PRIVATE BlockFiles { |
| +class NET_EXPORT_PRIVATE BlockBitmaps { |
| public: |
| - explicit BlockFiles(const base::FilePath& path); |
| - ~BlockFiles(); |
| + BlockBitmaps(); |
| + ~BlockBitmaps(); |
| - // Performs the object initialization. create_files indicates if the backing |
| - // files should be created or just open. |
| - bool Init(bool create_files); |
| + void Init(const BlockFilesBitmaps& bitmaps); |
| // Creates a new entry on a block file. block_type indicates the size of block |
| // to be used (as defined on cache_addr.h), block_count is the number of |
| // blocks to allocate, and block_address is the address of the new entry. |
| bool CreateBlock(FileType block_type, int block_count, Addr* block_address); |
| - // Removes an entry from the block files. If deep is true, the storage is zero |
| - // filled; otherwise the entry is removed but the data is not altered (must be |
| - // already zeroed). |
| - void DeleteBlock(Addr address, bool deep); |
| + // Removes an entry from the block files. |
| + void DeleteBlock(Addr address); |
| - // Close all the files and set the internal state to be initializad again. The |
| - // cache is being purged. |
| - void CloseFiles(); |
| + // Releases the internal bitmaps. The cache is being purged. |
| + void Clear(); |
| // Sends UMA stats. |
| void ReportStats(); |
| @@ -50,26 +41,20 @@ |
| bool IsValid(Addr address); |
| private: |
| - // Returns the file that stores a given address. |
| - MappedFile* GetFile(Addr address); |
| + // Returns the header number that stores a given address. |
| + int GetHeaderNumber(Addr address); |
| - // Attemp to grow this file. Fails if the file cannot be extended anymore. |
| - bool GrowBlockFile(MappedFile* file, BlockFileHeader* header); |
| + // Returns the appropriate header to use for a new block. |
| + int HeaderNumberForNewBlock(FileType block_type, int block_count); |
| - // Returns the appropriate file to use for a new block. |
| - MappedFile* FileForNewBlock(FileType block_type, int block_count); |
| - |
| - // Restores the header of a potentially inconsistent file. |
| - bool FixBlockFileHeader(MappedFile* file); |
| - |
| // Retrieves stats for the given file index. |
| void GetFileStats(int index, int* used_count, int* load); |
| - bool init_; |
| + BlockFilesBitmaps bitmaps_; |
| - DISALLOW_COPY_AND_ASSIGN(BlockFiles); |
| + DISALLOW_COPY_AND_ASSIGN(BlockBitmaps); |
| }; |
| } // namespace disk_cache |
| -#endif // NET_DISK_CACHE_BLOCK_FILES_H_ |
| +#endif // NET_DISK_CACHE_V3_BLOCK_BITMAPS_H_ |