Chromium Code Reviews| Index: base/files/memory_mapped_file.h |
| diff --git a/base/files/memory_mapped_file.h b/base/files/memory_mapped_file.h |
| index 8a7f045f351a0365d496f37f5824607cacfdc12e..d69e665dd63789f2df263c25f687b3b7f3426d0e 100644 |
| --- a/base/files/memory_mapped_file.h |
| +++ b/base/files/memory_mapped_file.h |
| @@ -58,13 +58,21 @@ class BASE_EXPORT MemoryMappedFile { |
| // As above, but works with a region of an already-opened file. |
| bool Initialize(File file, const Region& region); |
| + // As above, works with an already-opened file and enables write permission |
| + // when |write| is true. |
| + bool Initialize(File file, bool write); |
|
rvargas (doing something else)
2014/08/29 20:08:58
These two methods look like simple supersets of th
henryhsu
2014/09/01 05:53:44
If using default value for extra argument is stron
wuchengli
2014/09/01 06:57:15
rvargas means removing Initialize(File) and Initia
|
| + |
| + // As above, but works with a region of an already-opened file and enables |
| + // write permission when |write| is true. |
| + bool Initialize(File file, const Region& region, bool write); |
|
wuchengli
2014/08/29 10:03:11
I think this can be removed. This can be added in
henryhsu
2014/09/01 05:53:45
I prefer to keep this because every Initialize fun
|
| + |
| #if defined(OS_WIN) |
| // Opens an existing file and maps it as an image section. Please refer to |
| // the Initialize function above for additional information. |
| bool InitializeAsImageSection(const FilePath& file_name); |
| #endif // OS_WIN |
| - const uint8* data() const { return data_; } |
| + uint8* data() const { return data_; } |
| size_t length() const { return length_; } |
| // Is file_ a valid file handle that points to an open, memory mapped file? |
| @@ -85,7 +93,8 @@ class BASE_EXPORT MemoryMappedFile { |
| // Map the file to memory, set data_ to that memory address. Return true on |
| // success, false on any kind of failure. This is a helper for Initialize(). |
| - bool MapFileRegionToMemory(const Region& region); |
| + // - |write| is used to enable write permission of mmap. |
| + bool MapFileRegionToMemory(const Region& region, bool write); |
| // Closes all open handles. |
| void CloseHandles(); |