| Index: net/disk_cache/v3/block_bitmaps.h
|
| ===================================================================
|
| --- net/disk_cache/v3/block_bitmaps.h (revision 0)
|
| +++ net/disk_cache/v3/block_bitmaps.h (revision 0)
|
| @@ -0,0 +1,71 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// See net/disk_cache/disk_cache.h for the public interface.
|
| +
|
| +#ifndef NET_DISK_CACHE_V3_BLOCK_BITMAPS_H_
|
| +#define NET_DISK_CACHE_V3_BLOCK_BITMAPS_H_
|
| +
|
| +#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/block_files.h"
|
| +#include "net/disk_cache/mapped_file.h"
|
| +
|
| +namespace disk_cache {
|
| +
|
| +class BackendImplV3;
|
| +
|
| +// This class handles the set of block-files open by the disk cache.
|
| +class NET_EXPORT_PRIVATE BlockBitmaps {
|
| + public:
|
| + explicit BlockBitmaps(BackendImplV3* backend);
|
| + ~BlockBitmaps();
|
| +
|
| + // Performs the object initialization.
|
| + 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.
|
| + void DeleteBlock(Addr address);
|
| +
|
| + // Releases the internal bitmaps. The cache is being purged.
|
| + void Clear();
|
| +
|
| + // Sends UMA stats.
|
| + void ReportStats();
|
| +
|
| + // Returns true if the blocks pointed by a given address are currently used.
|
| + // This method is only intended for debugging.
|
| + bool IsValid(Addr address);
|
| +
|
| + private:
|
| + // Returns the header number that stores a given address.
|
| + int GetHeaderNumber(Addr address);
|
| +
|
| + // Returns the number of entry blocks for the given file type.
|
| + int EmptyBlocksForType(int first_file);
|
| +
|
| + // Returns the appropriate header to use for a new block.
|
| + int HeaderForNewBlock(FileType block_type, int block_count);
|
| +
|
| + // Retrieves stats for the given file index.
|
| + void GetFileStats(int index, int* used_count, int* load);
|
| +
|
| + BlockFilesBitmaps bitmaps_;
|
| + BackendImplV3* backend_;
|
| + int empty_counts_[kFirstAdditionalBlockFileV3];
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BlockBitmaps);
|
| +};
|
| +
|
| +} // namespace disk_cache
|
| +
|
| +#endif // NET_DISK_CACHE_V3_BLOCK_BITMAPS_H_
|
|
|
| Property changes on: net\disk_cache\v3\block_bitmaps.h
|
| ___________________________________________________________________
|
| Added: svn:eol-style
|
| + LF
|
|
|
|
|