OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 20 matching lines...) Expand all Loading... |
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_; |
35 } | 35 } |
36 | 36 |
37 // Loads or stores a given block from the backing file (synchronously). | 37 // Loads or stores a given block from the backing file (synchronously). |
38 bool Load(const FileBlock* block); | 38 bool Load(const FileBlock* block); |
39 bool Store(const FileBlock* block); | 39 bool Store(const FileBlock* block); |
40 | 40 |
41 protected: | 41 private: |
42 virtual ~MappedFile(); | 42 virtual ~MappedFile(); |
43 | 43 |
44 private: | |
45 bool init_; | 44 bool init_; |
46 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
47 HANDLE section_; | 46 HANDLE section_; |
48 #endif | 47 #endif |
49 void* buffer_; // Address of the memory mapped buffer. | 48 void* buffer_; // Address of the memory mapped buffer. |
50 size_t view_size_; // Size of the memory pointed by buffer_. | 49 size_t view_size_; // Size of the memory pointed by buffer_. |
51 | 50 |
52 DISALLOW_COPY_AND_ASSIGN(MappedFile); | 51 DISALLOW_COPY_AND_ASSIGN(MappedFile); |
53 }; | 52 }; |
54 | 53 |
55 } // namespace disk_cache | 54 } // namespace disk_cache |
56 | 55 |
57 #endif // NET_DISK_CACHE_MAPPED_FILE_H_ | 56 #endif // NET_DISK_CACHE_MAPPED_FILE_H_ |
OLD | NEW |