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

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: Created 7 years, 6 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 | 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 handles the set of block-files open by the disk cache.
23 class BlockBitmaps {
24 public:
25 explicit BlockBitmaps(BackendImplV3* backend);
26 ~BlockBitmaps();
27
28 // Performs the object initialization. create_files indicates if the backing
29 // files should be created or just open.
30 void Init(const BlockFilesBitmaps& bitmaps);
31
32 // Returns the header that stores a given address.
33 int GetHeader(Addr address);
34
35 // Creates a new entry on a block file. block_type indicates the size of block
36 // to be used (as defined on cache_addr.h), block_count is the number of
37 // blocks to allocate, and block_address is the address of the new entry.
38 bool CreateBlock(FileType block_type, int block_count, Addr* block_address);
39
40 // Removes an entry from the block files.
41 void DeleteBlock(Addr address);
42
43 // Releases the internal bitmaps. The cache is being purged.
44 void Clear();
45
46 // Sends UMA stats.
47 void ReportStats();
48
49 // Returns true if the blocks pointed by a given address are currently used.
50 // This method is only intended for debugging.
51 bool IsValid(Addr address);
52
53 private:
54 // Returns the number of entry blocks for the given file type.
55 int EmptyBlocksForType(int first_file);
56
57 // Returns the appropriate header to use for a new block.
58 int HeaderForNewBlock(FileType block_type, int block_count);
59
60 // Restores the header of a potentially inconsistent file.
61 bool FixBlockFileHeader(MappedFile* file);
62
63 // Retrieves stats for the given file index.
64 void GetFileStats(int index, int* used_count, int* load);
65
66 BlockFilesBitmaps bitmaps_;
67 BackendImplV3* backend_;
68 int empty_counts_[kFirstAdditionalBlockFileV3];
69
70 DISALLOW_COPY_AND_ASSIGN(BlockBitmaps);
71 };
72
73 } // namespace disk_cache
74
75 #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