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

Unified Diff: runtime/bin/file_win.cc

Issue 2430473002: Implement File::Map on Windows. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_win.cc
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
index c9f98b560a1e375feea1684c6ed4bde87550611b..3e326c314561904db52862709dbabc2d8205a6e0 100644
--- a/runtime/bin/file_win.cc
+++ b/runtime/bin/file_win.cc
@@ -75,8 +75,24 @@ bool File::IsClosed() {
void* File::Map(MapType type, int64_t position, int64_t length) {
- UNIMPLEMENTED();
- return NULL;
+ ASSERT(handle_->fd() >= 0);
+ int flags;
+ switch (type) {
+ case kReadOnly:
+ flags = PAGE_READONLY;
+ break;
+ case KReadExecute:
+ flags = PAGE_EXECUTE_READ:
+ break;
+ default:
+ return NULL;
+ }
+ HANDLE mapping = CreateFileMapping(handle_->fd(), NULL, flags, 0, 0, NULL);
Cutch 2016/10/17 19:28:57 error checking on mapping?
rmacnak 2016/10/18 00:47:34 Done.
+ return MapViewOfFile(mapping,
Cutch 2016/10/17 19:28:57 check the result of MapViewOfFile and report: OS:
rmacnak 2016/10/18 00:47:34 Done.
+ FILE_MAP_READ,
+ Utils::High32Bits(position),
+ Utils::Low32Bits(position),
+ length);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698