Diff
Modified: trunk/ChangeLog (279084 => 279085)
--- trunk/ChangeLog 2021-06-21 21:36:27 UTC (rev 279084)
+++ trunk/ChangeLog 2021-06-21 21:42:01 UTC (rev 279085)
@@ -1,3 +1,12 @@
+2021-06-21 Fujii Hironori <[email protected]>
+
+ [WinCairo] Turn ENABLE_SHAREABLE_RESOURCE on
+ https://bugs.webkit.org/show_bug.cgi?id=227011
+
+ Reviewed by Don Olmstead.
+
+ * Source/cmake/OptionsWin.cmake: Turned ENABLE_SHAREABLE_RESOURCE on for WinCairo port.
+
2021-06-18 Sergio Villar Senin <[email protected]>
Ignore clangd's directory with index files
Modified: trunk/Source/WTF/ChangeLog (279084 => 279085)
--- trunk/Source/WTF/ChangeLog 2021-06-21 21:36:27 UTC (rev 279084)
+++ trunk/Source/WTF/ChangeLog 2021-06-21 21:42:01 UTC (rev 279085)
@@ -1,3 +1,31 @@
+2021-06-21 Fujii Hironori <[email protected]>
+
+ [WinCairo] Turn ENABLE_SHAREABLE_RESOURCE on
+ https://bugs.webkit.org/show_bug.cgi?id=227011
+
+ Reviewed by Don Olmstead.
+
+ Added a new member m_fileMapping to MappedFileData to store a file
+ mapping object handle to create a SharedMemory from a
+ MappedFileData on Windows.
+
+ Conditioned out MappedFileData::leakHandle() if OS(WINDOWS). And,
+ removed unmapViewOfFile(). Destruction of MappedFileData should be
+ done by ~MappedFileData.
+
+ * wtf/FileSystem.cpp:
+ (WTF::FileSystemImpl::MappedFileData::~MappedFileData):
+ (WTF::FileSystemImpl::MappedFileData::mapFileHandle):
+ (WTF::FileSystemImpl::unmapViewOfFile): Deleted.
+ * wtf/FileSystem.h:
+ (WTF::FileSystemImpl::MappedFileData::fileMapping const):
+ (WTF::FileSystemImpl::MappedFileData::MappedFileData):
+ (WTF::FileSystemImpl::MappedFileData::operator=):
+ * wtf/win/FileSystemWin.cpp:
+ (WTF::FileSystemImpl::MappedFileData::~MappedFileData):
+ (WTF::FileSystemImpl::MappedFileData::mapFileHandle):
+ (WTF::FileSystemImpl::unmapViewOfFile): Deleted.
+
2021-06-21 Kate Cheney <[email protected]>
Migrate App Privacy Report code from WebKitAdditions
Modified: trunk/Source/WTF/wtf/FileSystem.cpp (279084 => 279085)
--- trunk/Source/WTF/wtf/FileSystem.cpp 2021-06-21 21:36:27 UTC (rev 279084)
+++ trunk/Source/WTF/wtf/FileSystem.cpp 2021-06-21 21:42:01 UTC (rev 279085)
@@ -317,13 +317,6 @@
#endif
-MappedFileData::~MappedFileData()
-{
- if (!m_fileData)
- return;
- unmapViewOfFile(m_fileData, m_fileSize);
-}
-
MappedFileData::MappedFileData(const String& filePath, MappedFileMode mapMode, bool& success)
{
auto fd = openFile(filePath, FileSystem::FileOpenMode::Read);
@@ -334,6 +327,13 @@
#if HAVE(MMAP)
+MappedFileData::~MappedFileData()
+{
+ if (!m_fileData)
+ return;
+ munmap(m_fileData, m_fileSize);
+}
+
bool MappedFileData::mapFileHandle(PlatformFileHandle handle, FileOpenMode openMode, MappedFileMode mapMode)
{
if (!isHandleValid(handle))
@@ -387,12 +387,6 @@
m_fileSize = size;
return true;
}
-
-bool unmapViewOfFile(void* buffer, size_t size)
-{
- return !munmap(buffer, size);
-}
-
#endif
PlatformFileHandle openAndLockFile(const String& path, FileOpenMode openMode, OptionSet<FileLockMode> lockMode)
Modified: trunk/Source/WTF/wtf/FileSystem.h (279084 => 279085)
--- trunk/Source/WTF/wtf/FileSystem.h 2021-06-21 21:36:27 UTC (rev 279084)
+++ trunk/Source/WTF/wtf/FileSystem.h 2021-06-21 21:42:01 UTC (rev 279085)
@@ -210,8 +210,6 @@
WTF_EXPORT_PRIVATE bool isSafeToUseMemoryMapForPath(const String&);
WTF_EXPORT_PRIVATE void makeSafeToUseMemoryMapForPath(const String&);
-WTF_EXPORT_PRIVATE bool unmapViewOfFile(void* buffer, size_t);
-
class MappedFileData {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -227,7 +225,12 @@
const void* data() const { return m_fileData; }
unsigned size() const { return m_fileSize; }
+#if !OS(WINDOWS)
void* leakHandle() { return std::exchange(m_fileData, nullptr); }
+#endif
+#if OS(WINDOWS)
+ HANDLE fileMapping() const { return m_fileMapping; }
+#endif
private:
WTF_EXPORT_PRIVATE bool mapFileHandle(PlatformFileHandle, FileOpenMode, MappedFileMode);
@@ -234,6 +237,9 @@
void* m_fileData { nullptr };
unsigned m_fileSize { 0 };
+#if OS(WINDOWS)
+ HANDLE m_fileMapping { nullptr };
+#endif
};
inline MappedFileData::MappedFileData(PlatformFileHandle handle, MappedFileMode mapMode, bool& success)
@@ -249,6 +255,9 @@
inline MappedFileData::MappedFileData(MappedFileData&& other)
: m_fileData(std::exchange(other.m_fileData, nullptr))
, m_fileSize(std::exchange(other.m_fileSize, 0))
+#if OS(WINDOWS)
+ , m_fileMapping(std::exchange(other.m_fileMapping, nullptr))
+#endif
{
}
@@ -256,6 +265,9 @@
{
m_fileData = std::exchange(other.m_fileData, nullptr);
m_fileSize = std::exchange(other.m_fileSize, 0);
+#if OS(WINDOWS)
+ m_fileMapping = std::exchange(other.m_fileMapping, nullptr);
+#endif
return *this;
}
Modified: trunk/Source/WTF/wtf/win/FileSystemWin.cpp (279084 => 279085)
--- trunk/Source/WTF/wtf/win/FileSystemWin.cpp 2021-06-21 21:36:27 UTC (rev 279084)
+++ trunk/Source/WTF/wtf/win/FileSystemWin.cpp 2021-06-21 21:42:01 UTC (rev 279085)
@@ -363,9 +363,12 @@
});
}
-bool unmapViewOfFile(void* buffer, size_t)
+MappedFileData::~MappedFileData()
{
- return UnmapViewOfFile(buffer);
+ if (m_fileData)
+ UnmapViewOfFile(m_fileData);
+ if (m_fileMapping)
+ CloseHandle(m_fileMapping);
}
bool MappedFileData::mapFileHandle(PlatformFileHandle handle, FileOpenMode openMode, MappedFileMode)
@@ -399,12 +402,11 @@
break;
}
- auto mapping = CreateFileMapping(handle, nullptr, pageProtection, 0, 0, nullptr);
- if (!mapping)
+ m_fileMapping = CreateFileMapping(handle, nullptr, pageProtection, 0, 0, nullptr);
+ if (!m_fileMapping)
return false;
- m_fileData = MapViewOfFile(mapping, desiredAccess, 0, 0, *size);
- CloseHandle(mapping);
+ m_fileData = MapViewOfFile(m_fileMapping, desiredAccess, 0, 0, *size);
if (!m_fileData)
return false;
m_fileSize = *size;
Modified: trunk/Source/WebCore/ChangeLog (279084 => 279085)
--- trunk/Source/WebCore/ChangeLog 2021-06-21 21:36:27 UTC (rev 279084)
+++ trunk/Source/WebCore/ChangeLog 2021-06-21 21:42:01 UTC (rev 279085)
@@ -1,3 +1,13 @@
+2021-06-21 Fujii Hironori <[email protected]>
+
+ [WinCairo] Turn ENABLE_SHAREABLE_RESOURCE on
+ https://bugs.webkit.org/show_bug.cgi?id=227011
+
+ Reviewed by Don Olmstead.
+
+ * loader/cache/CachedResource.cpp:
+ * loader/cache/CachedResource.h:
+
2021-06-21 Chris Dumez <[email protected]>
Too much CPU time is spent under MemoryPressureHandler::currentMemoryUsagePolicy()
Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (279084 => 279085)
--- trunk/Source/WebCore/loader/cache/CachedResource.cpp 2021-06-21 21:36:27 UTC (rev 279084)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp 2021-06-21 21:42:01 UTC (rev 279085)
@@ -904,7 +904,7 @@
m_resource.didAddClient(m_client);
}
-#if USE(FOUNDATION) || USE(SOUP)
+#if ENABLE(SHAREABLE_RESOURCE)
void CachedResource::tryReplaceEncodedData(SharedBuffer& newBuffer)
{
Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (279084 => 279085)
--- trunk/Source/WebCore/loader/cache/CachedResource.h 2021-06-21 21:36:27 UTC (rev 279084)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h 2021-06-21 21:42:01 UTC (rev 279085)
@@ -281,7 +281,7 @@
virtual void didSendData(unsigned long long /* bytesSent */, unsigned long long /* totalBytesToBeSent */) { }
-#if USE(FOUNDATION) || USE(SOUP)
+#if ENABLE(SHAREABLE_RESOURCE)
WEBCORE_EXPORT void tryReplaceEncodedData(SharedBuffer&);
#endif
Modified: trunk/Source/WebKit/ChangeLog (279084 => 279085)
--- trunk/Source/WebKit/ChangeLog 2021-06-21 21:36:27 UTC (rev 279084)
+++ trunk/Source/WebKit/ChangeLog 2021-06-21 21:42:01 UTC (rev 279085)
@@ -1,3 +1,13 @@
+2021-06-21 Fujii Hironori <[email protected]>
+
+ [WinCairo] Turn ENABLE_SHAREABLE_RESOURCE on
+ https://bugs.webkit.org/show_bug.cgi?id=227011
+
+ Reviewed by Don Olmstead.
+
+ * NetworkProcess/cache/NetworkCacheDataCurl.cpp:
+ (WebKit::NetworkCache::Data::tryCreateSharedMemory const): Added.
+
2021-06-21 Kate Cheney <[email protected]>
Migrate App Privacy Report code from WebKitAdditions
Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheDataCurl.cpp (279084 => 279085)
--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheDataCurl.cpp 2021-06-21 21:36:27 UTC (rev 279084)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheDataCurl.cpp 2021-06-21 21:42:01 UTC (rev 279085)
@@ -26,6 +26,8 @@
#include "config.h"
#include "NetworkCacheData.h"
+#include "SharedMemory.h"
+
namespace WebKit {
namespace NetworkCache {
@@ -105,5 +107,20 @@
return { WTFMove(mappedFile) };
}
+#if ENABLE(SHAREABLE_RESOURCE) && OS(WINDOWS)
+RefPtr<SharedMemory> Data::tryCreateSharedMemory() const
+{
+ if (isNull() || !isMap())
+ return nullptr;
+
+ HANDLE handle = WTF::get<FileSystem::MappedFileData>(*m_buffer).fileMapping();
+ HANDLE newHandle;
+ if (!DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(), &newHandle, 0, false, DUPLICATE_SAME_ACCESS))
+ return nullptr;
+
+ return SharedMemory::adopt(newHandle, m_size, SharedMemory::Protection::ReadOnly);
+}
+#endif
+
} // namespace NetworkCache
} // namespace WebKit
Modified: trunk/Source/cmake/OptionsWin.cmake (279084 => 279085)
--- trunk/Source/cmake/OptionsWin.cmake 2021-06-21 21:36:27 UTC (rev 279084)
+++ trunk/Source/cmake/OptionsWin.cmake 2021-06-21 21:42:01 UTC (rev 279085)
@@ -66,6 +66,7 @@
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILTERS_LEVEL_2 PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_ENCRYPTED_MEDIA PUBLIC OFF)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE ON)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SHAREABLE_RESOURCE PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL2 PUBLIC ON)