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

Unified Diff: base/files/memory_mapped_file_win.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 7 and 8 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_win.cc
diff --git a/base/files/memory_mapped_file_win.cc b/base/files/memory_mapped_file_win.cc
index 4e7e934e1c858823f13a2c7842a1daa0e390591b..f8206a5280afca03d22db27e18bb28d8f99a75e1 100644
--- a/base/files/memory_mapped_file_win.cc
+++ b/base/files/memory_mapped_file_win.cc
@@ -25,7 +25,13 @@ bool MemoryMappedFile::MapFileRegionToMemory(
if (!file_.IsValid())
return false;
- int flags = image_ ? SEC_IMAGE | PAGE_READONLY : PAGE_READONLY;
+ int flags = 0;
+ if (image_)
+ flags = SEC_IMAGE | PAGE_READONLY;
+ else
+ flags = (file_.flags() & File::FLAG_WRITE ||
+ file_.flags() & File::FLAG_APPEND) ?
+ PAGE_READWRITE : PAGE_READONLY;
file_mapping_.Set(::CreateFileMapping(file_.GetPlatformFile(), NULL,
flags, 0, 0, NULL));
@@ -66,8 +72,9 @@ bool MemoryMappedFile::MapFileRegionToMemory(
length_ = static_cast<size_t>(region.size);
}
+ int map_flags = (flags & PAGE_READONLY) ? FILE_MAP_READ : FILE_MAP_WRITE;
data_ = static_cast<uint8*>(::MapViewOfFile(file_mapping_.Get(),
- FILE_MAP_READ,
+ map_flags,
map_start.HighPart,
map_start.LowPart,
map_size));

Powered by Google App Engine
This is Rietveld 408576698