| 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 namespace base { |
| 19 class ThreadChecker; | 20 class ThreadChecker; |
| 21 } |
| 20 | 22 |
| 21 namespace disk_cache { | 23 namespace disk_cache { |
| 22 | 24 |
| 23 // This class handles the set of block-files open by the disk cache. | 25 // This class handles the set of block-files open by the disk cache. |
| 24 class BlockFiles { | 26 class BlockFiles { |
| 25 public: | 27 public: |
| 26 explicit BlockFiles(const FilePath& path); | 28 explicit BlockFiles(const FilePath& path); |
| 27 ~BlockFiles(); | 29 ~BlockFiles(); |
| 28 | 30 |
| 29 // Performs the object initialization. create_files indicates if the backing | 31 // Performs the object initialization. create_files indicates if the backing |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // Retrieves stats for the given file index. | 82 // Retrieves stats for the given file index. |
| 81 void GetFileStats(int index, int* used_count, int* load); | 83 void GetFileStats(int index, int* used_count, int* load); |
| 82 | 84 |
| 83 // Returns the filename for a given file index. | 85 // Returns the filename for a given file index. |
| 84 FilePath Name(int index); | 86 FilePath Name(int index); |
| 85 | 87 |
| 86 bool init_; | 88 bool init_; |
| 87 char* zero_buffer_; // Buffer to speed-up cleaning deleted entries. | 89 char* zero_buffer_; // Buffer to speed-up cleaning deleted entries. |
| 88 FilePath path_; // Path to the backing folder. | 90 FilePath path_; // Path to the backing folder. |
| 89 std::vector<MappedFile*> block_files_; // The actual files. | 91 std::vector<MappedFile*> block_files_; // The actual files. |
| 90 scoped_ptr<ThreadChecker> thread_checker_; | 92 scoped_ptr<base::ThreadChecker> thread_checker_; |
| 91 | 93 |
| 92 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_ZeroSizeFile); | 94 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_ZeroSizeFile); |
| 93 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_InvalidFile); | 95 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_InvalidFile); |
| 94 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_Stats); | 96 FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_Stats); |
| 95 | 97 |
| 96 DISALLOW_COPY_AND_ASSIGN(BlockFiles); | 98 DISALLOW_COPY_AND_ASSIGN(BlockFiles); |
| 97 }; | 99 }; |
| 98 | 100 |
| 99 } // namespace disk_cache | 101 } // namespace disk_cache |
| 100 | 102 |
| 101 #endif // NET_DISK_CACHE_BLOCK_FILES_H__ | 103 #endif // NET_DISK_CACHE_BLOCK_FILES_H__ |
| OLD | NEW |