WebKit Bugzilla
Attachment 373649 Details for
Bug 198269
: Implement MappedFileData for Windows
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-198269-20190708113251.patch (text/plain), 4.36 KB, created by
Christopher Reid
on 2019-07-08 11:32:52 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Christopher Reid
Created:
2019-07-08 11:32:52 PDT
Size:
4.36 KB
patch
obsolete
>Subversion Revision: 247011 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index c2f305e77004e1ea1a65c6b9cf0ceb352aaf78a2..9381e7e0310141e3e71b7353abb1e7d2f05b34d7 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,18 @@ >+2019-07-03 Christopher Reid <chris.reid@sony.com> >+ >+ Implement MappedFileData for Windows >+ https://bugs.webkit.org/show_bug.cgi?id=198269 >+ >+ Reviewed by Darin Adler. >+ >+ Original patch by Fujii Hironori. >+ >+ Add Windows implementations for MappedFileData constructor and destructor. >+ >+ * wtf/FileSystem.cpp: >+ * wtf/FileSystem.h: >+ * wtf/win/FileSystemWin.cpp: >+ > 2019-07-01 Philippe Normand <pnormand@igalia.com> > > [GStreamer] Cannot play Bert's Bytes radio stream from http://radio.dos.nl/ >diff --git a/Source/WTF/wtf/FileSystem.cpp b/Source/WTF/wtf/FileSystem.cpp >index ba49b1e77a7a41749ab40235304e9f5bf4daffa8..975429bad09f171587c63f933a1e7ca2d9657e9d 100644 >--- a/Source/WTF/wtf/FileSystem.cpp >+++ b/Source/WTF/wtf/FileSystem.cpp >@@ -274,21 +274,17 @@ bool excludeFromBackup(const String&) > > #endif > >+#if HAVE(MMAP) >+ > MappedFileData::~MappedFileData() > { >-#if !OS(WINDOWS) > if (!m_fileData) > return; > munmap(m_fileData, m_fileSize); >-#endif > } > > MappedFileData::MappedFileData(const String& filePath, bool& success) > { >-#if OS(WINDOWS) >- // FIXME: Implement mapping >- success = false; >-#else > CString fsRep = fileSystemRepresentation(filePath); > int fd = !fsRep.isNull() ? open(fsRep.data(), O_RDONLY) : -1; > if (fd < 0) { >@@ -327,9 +323,10 @@ MappedFileData::MappedFileData(const String& filePath, bool& success) > success = true; > m_fileData = data; > m_fileSize = size; >-#endif > } > >+#endif >+ > PlatformFileHandle openAndLockFile(const String& path, FileOpenMode openMode, OptionSet<FileLockMode> lockMode) > { > auto handle = openFile(path, openMode); >diff --git a/Source/WTF/wtf/win/FileSystemWin.cpp b/Source/WTF/wtf/win/FileSystemWin.cpp >index e473157f228c8b3e87c4c379aa06941c8aa20f93..58c9344808e671053e3160e0796b4022977258e4 100644 >--- a/Source/WTF/wtf/win/FileSystemWin.cpp >+++ b/Source/WTF/wtf/win/FileSystemWin.cpp >@@ -588,5 +588,44 @@ bool deleteNonEmptyDirectory(const String& directoryPath) > return !SHFileOperation(&deleteOperation); > } > >+MappedFileData::~MappedFileData() >+{ >+ if (!m_fileData) >+ return; >+ UnmapViewOfFile(m_fileData); >+} >+ >+MappedFileData::MappedFileData(const String& filePath, bool& success) >+{ >+ success = false; >+ auto file = CreateFile(filePath.wideCharacters().data(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); >+ if (file == INVALID_HANDLE_VALUE) >+ return; >+ >+ long long size; >+ if (!getFileSize(file, size) || size > std::numeric_limits<size_t>::max() || size > std::numeric_limits<decltype(m_fileSize)>::max()) { >+ CloseHandle(file); >+ return; >+ } >+ >+ if (!size) { >+ CloseHandle(file); >+ success = true; >+ return; >+ } >+ >+ auto mapping = CreateFileMapping(file, nullptr, PAGE_READONLY, 0, 0, nullptr); >+ CloseHandle(file); >+ if (!mapping) >+ return; >+ >+ m_fileData = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, size); >+ CloseHandle(mapping); >+ if (!m_fileData) >+ return; >+ m_fileSize = size; >+ success = true; >+} >+ > } // namespace FileSystemImpl > } // namespace WTF >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index bdf9bb358040f6727b85d23e80f6e062f654fef5..4578d5f290043e5998a8666f2c187d3d4013b249 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,12 @@ >+2019-07-03 Christopher Reid <chris.reid@sony.com> >+ >+ Implement MappedFileData for Windows >+ https://bugs.webkit.org/show_bug.cgi?id=198269 >+ >+ Reviewed by Darin Adler. >+ >+ * TestWebKitAPI/PlatformWin.cmake: >+ > 2019-07-01 Philippe Normand <pnormand@igalia.com> > > Unreviewed, GTK a11y tests fix after r246958 >diff --git a/Tools/TestWebKitAPI/PlatformWin.cmake b/Tools/TestWebKitAPI/PlatformWin.cmake >index 0c48cf04fe541e52aa27db78e5747778e2a178ac..349334826fa34db28ae2d8260fc5ae4d524dc0ef 100644 >--- a/Tools/TestWebKitAPI/PlatformWin.cmake >+++ b/Tools/TestWebKitAPI/PlatformWin.cmake >@@ -17,7 +17,6 @@ set(test_main_SOURCES > ) > > # TestWTF >-list(REMOVE_ITEM TestWTF_SOURCES Tests/WTF/FileSystem.cpp) > list(APPEND TestWTF_SOURCES > ${test_main_SOURCES} > win/UtilitiesWin.cpp
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198269
:
370666
|
373420
|
373645
|
373647
| 373649