OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 private: | 44 private: |
45 virtual ~MappedFile(); | 45 virtual ~MappedFile(); |
46 | 46 |
47 bool init_; | 47 bool init_; |
48 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
49 HANDLE section_; | 49 HANDLE section_; |
50 #endif | 50 #endif |
51 void* buffer_; // Address of the memory mapped buffer. | 51 void* buffer_; // Address of the memory mapped buffer. |
52 size_t view_size_; // Size of the memory pointed by buffer_. | 52 size_t view_size_; // Size of the memory pointed by buffer_. |
| 53 #if defined(POSIX_AVOID_MMAP) |
| 54 void* snapshot_; // Copy of the buffer taken when it was last flushed. |
| 55 #endif |
53 | 56 |
54 DISALLOW_COPY_AND_ASSIGN(MappedFile); | 57 DISALLOW_COPY_AND_ASSIGN(MappedFile); |
55 }; | 58 }; |
56 | 59 |
57 // Helper class for calling Flush() on exit from the current scope. | 60 // Helper class for calling Flush() on exit from the current scope. |
58 class ScopedFlush { | 61 class ScopedFlush { |
59 public: | 62 public: |
60 explicit ScopedFlush(MappedFile* file) : file_(file) {} | 63 explicit ScopedFlush(MappedFile* file) : file_(file) {} |
61 ~ScopedFlush() { | 64 ~ScopedFlush() { |
62 file_->Flush(); | 65 file_->Flush(); |
63 } | 66 } |
64 private: | 67 private: |
65 MappedFile* file_; | 68 MappedFile* file_; |
66 }; | 69 }; |
67 | 70 |
68 } // namespace disk_cache | 71 } // namespace disk_cache |
69 | 72 |
70 #endif // NET_DISK_CACHE_MAPPED_FILE_H_ | 73 #endif // NET_DISK_CACHE_MAPPED_FILE_H_ |
OLD | NEW |