Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(804)

Unified Diff: base/files/memory_mapped_file_posix.cc

Issue 430583005: Make VEA test support videos with different coded size and visible size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments of patch set 10 Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));

Powered by Google App Engine
This is Rietveld 408576698