Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Side by Side Diff: net/disk_cache/blockfile/block_bitmaps_v3.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // See net/disk_cache/disk_cache.h for the public interface.
6
7 #ifndef NET_DISK_CACHE_BLOCKFILE_BLOCK_BITMAPS_V3_H_
8 #define NET_DISK_CACHE_BLOCKFILE_BLOCK_BITMAPS_V3_H_
9
10 #include "base/files/file_path.h"
11 #include "net/base/net_export.h"
12 #include "net/disk_cache/blockfile/addr.h"
13 #include "net/disk_cache/blockfile/block_files.h"
14
15 namespace disk_cache {
16
17 class BackendImplV3;
18
19 // This class is the interface in the v3 disk cache to the set of files holding
20 // cached data that is small enough to not be efficiently stored in a dedicated
21 // file (i.e. < kMaxBlockSize). It is primarily used to allocate and free
22 // regions in those files used to store data.
23 class NET_EXPORT_PRIVATE BlockBitmaps {
24 public:
25 BlockBitmaps();
26 ~BlockBitmaps();
27
28 void Init(const BlockFilesBitmaps& bitmaps);
29
30 // Creates a new entry on a block file. block_type indicates the size of block
31 // to be used (as defined on cache_addr.h), block_count is the number of
32 // blocks to allocate, and block_address is the address of the new entry.
33 bool CreateBlock(FileType block_type, int block_count, Addr* block_address);
34
35 // Removes an entry from the block files.
36 void DeleteBlock(Addr address);
37
38 // Releases the internal bitmaps. The cache is being purged.
39 void Clear();
40
41 // Sends UMA stats.
42 void ReportStats();
43
44 // Returns true if the blocks pointed by a given address are currently used.
45 // This method is only intended for debugging.
46 bool IsValid(Addr address);
47
48 private:
49 // Returns the header number that stores a given address.
50 int GetHeaderNumber(Addr address);
51
52 // Returns the appropriate header to use for a new block.
53 int HeaderNumberForNewBlock(FileType block_type, int block_count);
54
55 // Retrieves stats for the given file index.
56 void GetFileStats(int index, int* used_count, int* load);
57
58 BlockFilesBitmaps bitmaps_;
59
60 DISALLOW_COPY_AND_ASSIGN(BlockBitmaps);
61 };
62
63 } // namespace disk_cache
64
65 #endif // NET_DISK_CACHE_BLOCKFILE_BLOCK_BITMAPS_V3_H_
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/bitmap_unittest.cc ('k') | net/disk_cache/blockfile/block_bitmaps_v3.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698