| Index: base/files/memory_mapped_file_posix.cc
|
| diff --git a/base/files/memory_mapped_file_posix.cc b/base/files/memory_mapped_file_posix.cc
|
| index ebf38779f039708835242eb19ed7223927a28f40..6d44484ef16b0612d7ec28ce02b8d87d8a7e8c57 100644
|
| --- a/base/files/memory_mapped_file_posix.cc
|
| +++ b/base/files/memory_mapped_file_posix.cc
|
| @@ -17,7 +17,7 @@ MemoryMappedFile::MemoryMappedFile() : data_(NULL), length_(0) {
|
| }
|
|
|
| bool MemoryMappedFile::MapFileRegionToMemory(
|
| - const MemoryMappedFile::Region& region) {
|
| + const MemoryMappedFile::Region& region, bool write) {
|
| ThreadRestrictions::AssertIOAllowed();
|
|
|
| off_t map_start = 0;
|
| @@ -60,9 +60,12 @@ bool MemoryMappedFile::MapFileRegionToMemory(
|
| length_ = static_cast<size_t>(region.size);
|
| }
|
|
|
| + int flags = PROT_READ;
|
| + if (write)
|
| + flags |= PROT_WRITE;
|
| data_ = static_cast<uint8*>(mmap(NULL,
|
| map_size,
|
| - PROT_READ,
|
| + flags,
|
| MAP_SHARED,
|
| file_.GetPlatformFile(),
|
| map_start));
|
|
|