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

Side by Side Diff: net/disk_cache/v3/block_bitmaps.h

Issue 15203004: Disk cache: Reference CL for the implementation of file format version 3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: IndexTable review Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/v3/backend_worker.cc ('k') | net/disk_cache/v3/block_bitmaps.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
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_V3_BLOCK_BITMAPS_H_
8 #define NET_DISK_CACHE_V3_BLOCK_BITMAPS_H_
9
10 #include "base/files/file_path.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "net/base/net_export.h"
14 #include "net/disk_cache/addr.h"
15 #include "net/disk_cache/block_files.h"
16 #include "net/disk_cache/mapped_file.h"
17
18 namespace disk_cache {
19
20 class BackendImplV3;
21
22 // This class is the interface in the v3 disk cache to the set of files holding
23 // cached data that is small enough to not be efficiently stored in a dedicated
24 // file (i.e. < kMaxBlockSize). It is primarily used to allocate and free
25 // regions in those files used to store data.
26 class NET_EXPORT_PRIVATE BlockBitmaps {
27 public:
28 explicit BlockBitmaps(BackendImplV3* backend);
29 ~BlockBitmaps();
30
31 void Init(const BlockFilesBitmaps& bitmaps);
32
33 // Creates a new entry on a block file. block_type indicates the size of block
34 // to be used (as defined on cache_addr.h), block_count is the number of
35 // blocks to allocate, and block_address is the address of the new entry.
36 bool CreateBlock(FileType block_type, int block_count, Addr* block_address);
37
38 // Removes an entry from the block files.
39 void DeleteBlock(Addr address);
40
41 // Releases the internal bitmaps. The cache is being purged.
42 void Clear();
43
44 // Sends UMA stats.
45 void ReportStats();
46
47 // Returns true if the blocks pointed by a given address are currently used.
48 // This method is only intended for debugging.
49 bool IsValid(Addr address);
50
51 private:
52 // Returns the header number that stores a given address.
53 int GetHeaderNumber(Addr address);
54
55 // Returns the number of entry blocks for the given file type.
56 int EmptyBlocksForType(int first_file);
57
58 // Returns the appropriate header to use for a new block.
59 int HeaderNumberForNewBlock(FileType block_type, int block_count);
60
61 // Retrieves stats for the given file index.
62 void GetFileStats(int index, int* used_count, int* load);
63
64 BlockFilesBitmaps bitmaps_;
65 BackendImplV3* backend_;
66 int empty_counts_[kFirstAdditionalBlockFileV3];
67
68 DISALLOW_COPY_AND_ASSIGN(BlockBitmaps);
69 };
70
71 } // namespace disk_cache
72
73 #endif // NET_DISK_CACHE_V3_BLOCK_BITMAPS_H_
OLDNEW
« no previous file with comments | « net/disk_cache/v3/backend_worker.cc ('k') | net/disk_cache/v3/block_bitmaps.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698