OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef BASE_FILES_MEMORY_MAPPED_FILE_H_ | 5 #ifndef BASE_FILES_MEMORY_MAPPED_FILE_H_ |
6 #define BASE_FILES_MEMORY_MAPPED_FILE_H_ | 6 #define BASE_FILES_MEMORY_MAPPED_FILE_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 // Start of the region (measured in bytes from the beginning of the file). | 35 // Start of the region (measured in bytes from the beginning of the file). |
36 int64 offset; | 36 int64 offset; |
37 | 37 |
38 // Length of the region in bytes. | 38 // Length of the region in bytes. |
39 int64 size; | 39 int64 size; |
40 | 40 |
41 private: | 41 private: |
42 // This ctor is used only by kWholeFile, to construct a zero-sized Region | 42 // This ctor is used only by kWholeFile, to construct a zero-sized Region |
43 // (which is forbidden by the public ctor) and uniquely identify kWholeFile. | 43 // (which is forbidden by the public ctor) and uniquely identify kWholeFile. |
44 Region(); | 44 Region(base::LinkerInitialized); |
45 }; | 45 }; |
46 | 46 |
47 // Opens an existing file and maps it into memory. Access is restricted to | 47 // Opens an existing file and maps it into memory. Access is restricted to |
48 // read only. If this object already points to a valid memory mapped file | 48 // read only. If this object already points to a valid memory mapped file |
49 // then this method will fail and return false. If it cannot open the file, | 49 // then this method will fail and return false. If it cannot open the file, |
50 // the file does not exist, or the memory mapping fails, it will return false. | 50 // the file does not exist, or the memory mapping fails, it will return false. |
51 // Later we may want to allow the user to specify access. | 51 // Later we may want to allow the user to specify access. |
52 bool Initialize(const FilePath& file_name); | 52 bool Initialize(const FilePath& file_name); |
53 | 53 |
54 // As above, but works with an already-opened file. MemoryMappedFile takes | 54 // As above, but works with an already-opened file. MemoryMappedFile takes |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 win::ScopedHandle file_mapping_; | 98 win::ScopedHandle file_mapping_; |
99 bool image_; // Map as an image. | 99 bool image_; // Map as an image. |
100 #endif | 100 #endif |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(MemoryMappedFile); | 102 DISALLOW_COPY_AND_ASSIGN(MemoryMappedFile); |
103 }; | 103 }; |
104 | 104 |
105 } // namespace base | 105 } // namespace base |
106 | 106 |
107 #endif // BASE_FILES_MEMORY_MAPPED_FILE_H_ | 107 #endif // BASE_FILES_MEMORY_MAPPED_FILE_H_ |
OLD | NEW |