[webkit-changes] [WebKit/WebKit] 78d256: [WTF][GLib] Rework FileSystem::openFile()

Alicia Boya García noreply at github.com
Tue Apr 25 06:49:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 78d2561b2bf73ecfc596b303f3321e6789c1f659
      https://github.com/WebKit/WebKit/commit/78d2561b2bf73ecfc596b303f3321e6789c1f659
  Author: Alicia Boya Garcia <aboya at igalia.com>
  Date:   2023-04-25 (Tue, 25 Apr 2023)

  Changed paths:
    M Source/WTF/wtf/FileSystem.cpp
    M Source/WTF/wtf/FileSystem.h
    M Source/WTF/wtf/glib/FileSystemGlib.cpp
    M Source/WTF/wtf/posix/FileSystemPOSIX.cpp
    M Source/WebKit/NetworkProcess/cache/NetworkCacheDataGLib.cpp
    M Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp

  Log Message:
  -----------
  [WTF][GLib] Rework FileSystem::openFile()
https://bugs.webkit.org/show_bug.cgi?id=254813

Reviewed by Michael Catanzaro and Adrian Perez de Castro.

Fixes REGRESSION(259689 at main). The previous implementation failed when
asked to create a file in ReadWrite mode.

This patch also increases the test coverage for FileSystem::openFile().
Previously, few argument combinations where tested, which caused the
regression to go unnoticed.

Read requests no longer create a read-write stream.

To accomodate that, PlatformFileHandle in GLib is now the generic
GSeekable* rather than GFileIOStream* (which implies a read-write file
handle).

This patch also introduces WTF::FileSystem::posixFileDescriptor() for
non-Windows platforms, which allows decoupling of the GIO API in a few
places in WebKit.

* Source/WTF/wtf/FileSystem.cpp:
(WTF::FileSystemImpl::MappedFileData::mapFileHandle):
* Source/WTF/wtf/FileSystem.h:
* Source/WTF/wtf/glib/FileSystemGlib.cpp:
(WTF::FileSystemImpl::genericGIOFileClose):
(WTF::FileSystemImpl::genericGIOFileQueryInfo):
(WTF::FileSystemImpl::genericGIOGetInputStream):
(WTF::FileSystemImpl::genericGIOGetOutputStream):
(WTF::FileSystemImpl::genericGIOGetFileDescriptorBased):
(WTF::FileSystemImpl::posixFileDescriptor):
(WTF::FileSystemImpl::fileSize):
(WTF::FileSystemImpl::fileID):
(WTF::FileSystemImpl::openTemporaryFile):
(WTF::FileSystemImpl::openFile):
(WTF::FileSystemImpl::closeFile):
(WTF::FileSystemImpl::seekFile):
(WTF::FileSystemImpl::truncateFile):
(WTF::FileSystemImpl::flushFile):
(WTF::FileSystemImpl::writeToFile):
(WTF::FileSystemImpl::readFromFile):
(WTF::FileSystemImpl::lockFile):
(WTF::FileSystemImpl::unlockFile):
* Source/WTF/wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::posixFileDescriptor):
* Source/WebKit/NetworkProcess/cache/NetworkCacheDataGLib.cpp:
(WebKit::NetworkCache::Data::tryCreateSharedMemory const):
* Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp:
(TestWebKitAPI::TEST_F):

Canonical link: https://commits.webkit.org/263367@main




More information about the webkit-changes mailing list