OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // See net/disk_cache/disk_cache.h for the public interface. | 5 // See net/disk_cache/disk_cache.h for the public interface. |
6 | 6 |
7 #ifndef NET_DISK_CACHE_BLOCK_FILES_H__ | 7 #ifndef NET_DISK_CACHE_BLOCK_FILES_H__ |
8 #define NET_DISK_CACHE_BLOCK_FILES_H__ | 8 #define NET_DISK_CACHE_BLOCK_FILES_H__ |
9 #pragma once | 9 #pragma once |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
16 #include "net/disk_cache/addr.h" | 16 #include "net/disk_cache/addr.h" |
17 #include "net/disk_cache/mapped_file.h" | 17 #include "net/disk_cache/mapped_file.h" |
18 | 18 |
19 class ThreadChecker; | 19 class ThreadChecker; |
20 | 20 |
21 namespace disk_cache { | 21 namespace disk_cache { |
22 | 22 |
23 // This class handles the set of block-files open by the disk cache. | 23 // This class handles the set of block-files open by the disk cache. |
24 class BlockFiles { | 24 class BlockFiles { |
25 public: | 25 public: |
26 explicit BlockFiles(const FilePath& path) | 26 explicit BlockFiles(const FilePath& path); |
27 : init_(false), zero_buffer_(NULL), path_(path) {} | |
28 ~BlockFiles(); | 27 ~BlockFiles(); |
29 | 28 |
30 // Performs the object initialization. create_files indicates if the backing | 29 // Performs the object initialization. create_files indicates if the backing |
31 // files should be created or just open. | 30 // files should be created or just open. |
32 bool Init(bool create_files); | 31 bool Init(bool create_files); |
33 | 32 |
34 // Returns the file that stores a given address. | 33 // Returns the file that stores a given address. |
35 MappedFile* GetFile(Addr address); | 34 MappedFile* GetFile(Addr address); |
36 | 35 |
37 // Creates a new entry on a block file. block_type indicates the size of block | 36 // Creates a new entry on a block file. block_type indicates the size of block |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_ZeroSizeFile); | 92 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_ZeroSizeFile); |
94 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_InvalidFile); | 93 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_InvalidFile); |
95 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_Stats); | 94 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_Stats); |
96 | 95 |
97 DISALLOW_COPY_AND_ASSIGN(BlockFiles); | 96 DISALLOW_COPY_AND_ASSIGN(BlockFiles); |
98 }; | 97 }; |
99 | 98 |
100 } // namespace disk_cache | 99 } // namespace disk_cache |
101 | 100 |
102 #endif // NET_DISK_CACHE_BLOCK_FILES_H__ | 101 #endif // NET_DISK_CACHE_BLOCK_FILES_H__ |
OLD | NEW |