OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 of the cache. | 5 // See net/disk_cache/disk_cache.h for the public interface of the cache. |
6 | 6 |
7 #ifndef NET_DISK_CACHE_MAPPED_FILE_H_ | 7 #ifndef NET_DISK_CACHE_MAPPED_FILE_H_ |
8 #define NET_DISK_CACHE_MAPPED_FILE_H_ | 8 #define NET_DISK_CACHE_MAPPED_FILE_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
11 #include "net/base/net_api.h" | 11 #include "net/base/net_export.h" |
12 #include "net/disk_cache/disk_format.h" | 12 #include "net/disk_cache/disk_format.h" |
13 #include "net/disk_cache/file.h" | 13 #include "net/disk_cache/file.h" |
14 #include "net/disk_cache/file_block.h" | 14 #include "net/disk_cache/file_block.h" |
15 | 15 |
16 class FilePath; | 16 class FilePath; |
17 | 17 |
18 namespace disk_cache { | 18 namespace disk_cache { |
19 | 19 |
20 // This class implements a memory mapped file used to access block-files. The | 20 // This class implements a memory mapped file used to access block-files. The |
21 // idea is that the header and bitmap will be memory mapped all the time, and | 21 // idea is that the header and bitmap will be memory mapped all the time, and |
22 // the actual data for the blocks will be access asynchronously (most of the | 22 // the actual data for the blocks will be access asynchronously (most of the |
23 // time). | 23 // time). |
24 class NET_TEST MappedFile : public File { | 24 class NET_EXPORT_PRIVATE MappedFile : public File { |
25 public: | 25 public: |
26 MappedFile() : File(true), init_(false) {} | 26 MappedFile() : File(true), init_(false) {} |
27 | 27 |
28 // Performs object initialization. name is the file to use, and size is the | 28 // Performs object initialization. name is the file to use, and size is the |
29 // ammount of data to memory map from th efile. If size is 0, the whole file | 29 // ammount of data to memory map from th efile. If size is 0, the whole file |
30 // will be mapped in memory. | 30 // will be mapped in memory. |
31 void* Init(const FilePath& name, size_t size); | 31 void* Init(const FilePath& name, size_t size); |
32 | 32 |
33 void* buffer() const { | 33 void* buffer() const { |
34 return buffer_; | 34 return buffer_; |
(...skipping 12 matching lines...) Expand all Loading... |
47 #endif | 47 #endif |
48 void* buffer_; // Address of the memory mapped buffer. | 48 void* buffer_; // Address of the memory mapped buffer. |
49 size_t view_size_; // Size of the memory pointed by buffer_. | 49 size_t view_size_; // Size of the memory pointed by buffer_. |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(MappedFile); | 51 DISALLOW_COPY_AND_ASSIGN(MappedFile); |
52 }; | 52 }; |
53 | 53 |
54 } // namespace disk_cache | 54 } // namespace disk_cache |
55 | 55 |
56 #endif // NET_DISK_CACHE_MAPPED_FILE_H_ | 56 #endif // NET_DISK_CACHE_MAPPED_FILE_H_ |
OLD | NEW |