Title: [277449] trunk
Revision
277449
Author
[email protected]
Date
2021-05-13 13:47:38 -0700 (Thu, 13 May 2021)

Log Message

Rename FileSystem::directoryName() to FileSystem::parentPath()
https://bugs.webkit.org/show_bug.cgi?id=225768

Reviewed by Darin Adler.

Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
consistency with std::filesystem::parent_path() which is used internally.

Source/_javascript_Core:

* API/JSScript.mm:
(validateBytecodeCachePath):

Source/WebCore:

* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::DOMFileSystem::DOMFileSystem):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory):
(WebCore::ApplicationCacheStorage::checkForDeletedResources):
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
(WebCore::CDMSessionAVContentKeySession::contentKeySession):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles):
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::openDatabase):
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::ensureDatabaseFileExists):
* platform/win/SearchPopupMenuDB.cpp:
(WebCore::SearchPopupMenuDB::openDatabase):
* workers/service/server/SWScriptStorage.cpp:
(WebCore::SWScriptStorage::store):

Source/WebKit:

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::writeFile):
* Shared/glib/ProcessExecutablePathGLib.cpp:
(WebKit::getExecutablePath):
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::IconDatabase):
* UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
(webkit_website_data_manager_get_disk_cache_directory):
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::bubblewrapSpawn):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformSetNetworkParameters):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):

Source/WebKitLegacy:

* Storage/StorageTracker.cpp:
(WebKit::ensureDatabaseFileExists):

Source/WebKitLegacy/win:

* Plugins/PluginDatabase.cpp:
(WebCore::PluginDatabase::loadPersistentMetadataCache):

Source/WTF:

* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::readOrMakeSalt):
(WTF::FileSystemImpl::parentPath):
(WTF::FileSystemImpl::directoryName): Deleted.
* wtf/FileSystem.h:

Tools:

* DumpRenderTree/win/DumpRenderTree.cpp:
(findFontFallback):
* TestWebKitAPI/Tests/WTF/FileSystem.cpp:
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/win/PlatformUtilitiesWin.cpp:
(TestWebKitAPI::Util::moduleDirectory):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSScript.mm (277448 => 277449)


--- trunk/Source/_javascript_Core/API/JSScript.mm	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/_javascript_Core/API/JSScript.mm	2021-05-13 20:47:38 UTC (rev 277449)
@@ -84,7 +84,7 @@
         }
     }
 
-    String directory = FileSystem::directoryName(systemPath);
+    String directory = FileSystem::parentPath(systemPath);
     if (directory.isNull()) {
         createError([NSString stringWithFormat:@"Cache path `%@` does not contain in a valid directory", static_cast<NSString *>(systemPath)], error);
         return false;

Modified: trunk/Source/_javascript_Core/ChangeLog (277448 => 277449)


--- trunk/Source/_javascript_Core/ChangeLog	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-05-13 20:47:38 UTC (rev 277449)
@@ -1,5 +1,18 @@
 2021-05-13  Chris Dumez  <[email protected]>
 
+        Rename FileSystem::directoryName() to FileSystem::parentPath()
+        https://bugs.webkit.org/show_bug.cgi?id=225768
+
+        Reviewed by Darin Adler.
+
+        Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
+        consistency with std::filesystem::parent_path() which is used internally.
+
+        * API/JSScript.mm:
+        (validateBytecodeCachePath):
+
+2021-05-13  Chris Dumez  <[email protected]>
+
         Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
         https://bugs.webkit.org/show_bug.cgi?id=225772
 

Modified: trunk/Source/WTF/ChangeLog (277448 => 277449)


--- trunk/Source/WTF/ChangeLog	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WTF/ChangeLog	2021-05-13 20:47:38 UTC (rev 277449)
@@ -1,5 +1,21 @@
 2021-05-13  Chris Dumez  <[email protected]>
 
+        Rename FileSystem::directoryName() to FileSystem::parentPath()
+        https://bugs.webkit.org/show_bug.cgi?id=225768
+
+        Reviewed by Darin Adler.
+
+        Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
+        consistency with std::filesystem::parent_path() which is used internally.
+
+        * wtf/FileSystem.cpp:
+        (WTF::FileSystemImpl::readOrMakeSalt):
+        (WTF::FileSystemImpl::parentPath):
+        (WTF::FileSystemImpl::directoryName): Deleted.
+        * wtf/FileSystem.h:
+
+2021-05-13  Chris Dumez  <[email protected]>
+
         Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
         https://bugs.webkit.org/show_bug.cgi?id=225772
 

Modified: trunk/Source/WTF/wtf/FileSystem.cpp (277448 => 277449)


--- trunk/Source/WTF/wtf/FileSystem.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WTF/wtf/FileSystem.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -518,7 +518,7 @@
     }
 
     Salt salt = makeSalt();
-    FileSystem::makeAllDirectories(FileSystem::directoryName(path));
+    FileSystem::makeAllDirectories(FileSystem::parentPath(path));
     auto file = FileSystem::openFile(path, FileSystem::FileOpenMode::Write, FileSystem::FileAccessPermission::User);
     if (!FileSystem::isHandleValid(file))
         return { };
@@ -744,7 +744,7 @@
     return fromStdFileSystemPath(toStdFileSystemPath(path).filename());
 }
 
-String directoryName(const String& path)
+String parentPath(const String& path)
 {
     return fromStdFileSystemPath(toStdFileSystemPath(path).parent_path());
 }

Modified: trunk/Source/WTF/wtf/FileSystem.h (277448 => 277449)


--- trunk/Source/WTF/wtf/FileSystem.h	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WTF/wtf/FileSystem.h	2021-05-13 20:47:38 UTC (rev 277449)
@@ -125,7 +125,7 @@
 WTF_EXPORT_PRIVATE bool makeAllDirectories(const String& path);
 WTF_EXPORT_PRIVATE String homeDirectoryPath();
 WTF_EXPORT_PRIVATE String pathGetFileName(const String&);
-WTF_EXPORT_PRIVATE String directoryName(const String&);
+WTF_EXPORT_PRIVATE String parentPath(const String&);
 WTF_EXPORT_PRIVATE bool getVolumeFreeSpace(const String&, uint64_t&);
 WTF_EXPORT_PRIVATE Optional<int32_t> getFileDeviceId(const CString&);
 WTF_EXPORT_PRIVATE bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath);

Modified: trunk/Source/WebCore/ChangeLog (277448 => 277449)


--- trunk/Source/WebCore/ChangeLog	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebCore/ChangeLog	2021-05-13 20:47:38 UTC (rev 277449)
@@ -1,5 +1,33 @@
 2021-05-13  Chris Dumez  <[email protected]>
 
+        Rename FileSystem::directoryName() to FileSystem::parentPath()
+        https://bugs.webkit.org/show_bug.cgi?id=225768
+
+        Reviewed by Darin Adler.
+
+        Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
+        consistency with std::filesystem::parent_path() which is used internally.
+
+        * Modules/entriesapi/DOMFileSystem.cpp:
+        (WebCore::DOMFileSystem::DOMFileSystem):
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory):
+        (WebCore::ApplicationCacheStorage::checkForDeletedResources):
+        * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
+        (WebCore::CDMSessionAVContentKeySession::contentKeySession):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles):
+        * platform/network/curl/CookieJarDB.cpp:
+        (WebCore::CookieJarDB::openDatabase):
+        * platform/sql/SQLiteFileSystem.cpp:
+        (WebCore::SQLiteFileSystem::ensureDatabaseFileExists):
+        * platform/win/SearchPopupMenuDB.cpp:
+        (WebCore::SearchPopupMenuDB::openDatabase):
+        * workers/service/server/SWScriptStorage.cpp:
+        (WebCore::SWScriptStorage::store):
+
+2021-05-13  Chris Dumez  <[email protected]>
+
         Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
         https://bugs.webkit.org/show_bug.cgi?id=225772
 

Modified: trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp (277448 => 277449)


--- trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -146,7 +146,7 @@
 DOMFileSystem::DOMFileSystem(Ref<File>&& file)
     : m_name(createCanonicalUUIDString())
     , m_file(WTFMove(file))
-    , m_rootPath(FileSystem::directoryName(m_file->path()))
+    , m_rootPath(FileSystem::parentPath(m_file->path()))
     , m_workQueue(WorkQueue::create("DOMFileSystem work queue"))
 {
     ASSERT(!m_rootPath.endsWith('/'));

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp (277448 => 277449)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -1291,7 +1291,7 @@
             return false;
         
         fullPath = FileSystem::pathByAppendingComponent(directory, path);
-    } while (FileSystem::directoryName(fullPath) != directory || FileSystem::fileExists(fullPath));
+    } while (FileSystem::parentPath(fullPath) != directory || FileSystem::fileExists(fullPath));
     
     FileSystem::PlatformFileHandle handle = FileSystem::openFile(fullPath, FileSystem::FileOpenMode::Write);
     if (!handle)
@@ -1431,7 +1431,7 @@
         
         // Don't exit the flatFileDirectory! This should only happen if the "path" entry contains a directory 
         // component, but protect against it regardless.
-        if (FileSystem::directoryName(fullPath) != flatFileDirectory)
+        if (FileSystem::parentPath(fullPath) != flatFileDirectory)
             continue;
         
         FileSystem::deleteFile(fullPath);

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm (277448 => 277449)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm	2021-05-13 20:47:38 UTC (rev 277449)
@@ -379,7 +379,7 @@
 
         m_contentKeySession = [PAL::getAVContentKeySessionClass() contentKeySessionWithKeySystem:AVContentKeySystemFairPlayStreaming];
     } else {
-        String storageDirectory = FileSystem::directoryName(storagePath);
+        String storageDirectory = FileSystem::parentPath(storagePath);
 
         if (!FileSystem::fileExists(storageDirectory)) {
             if (!FileSystem::makeAllDirectories(storageDirectory))

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (277448 => 277449)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -2208,7 +2208,7 @@
     if (downloadFilePrefixPath.isEmpty())
         return;
 
-    auto templateDirectory = FileSystem::directoryName(downloadFilePrefixPath);
+    auto templateDirectory = FileSystem::parentPath(downloadFilePrefixPath);
     auto templatePrefix = FileSystem::pathGetFileName(downloadFilePrefixPath);
     for (auto& fileName : FileSystem::listDirectory(templateDirectory)) {
         if (!fileName.startsWith(templatePrefix))

Modified: trunk/Source/WebCore/platform/network/curl/CookieJarDB.cpp (277448 => 277449)


--- trunk/Source/WebCore/platform/network/curl/CookieJarDB.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebCore/platform/network/curl/CookieJarDB.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -139,7 +139,7 @@
     }
 
     if (!existsDatabaseFile) {
-        if (!FileSystem::makeAllDirectories(FileSystem::directoryName(m_databasePath)))
+        if (!FileSystem::makeAllDirectories(FileSystem::parentPath(m_databasePath)))
             LOG_ERROR("Unable to create the Cookie Database path %s", m_databasePath.utf8().data());
 
         m_database.open(m_databasePath);

Modified: trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp (277448 => 277449)


--- trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -65,7 +65,7 @@
         return false;
 
     if (checkPathOnly) {
-        String dir = FileSystem::directoryName(fileName);
+        String dir = FileSystem::parentPath(fileName);
         return ensureDatabaseDirectoryExists(dir);
     }
 

Modified: trunk/Source/WebCore/platform/win/SearchPopupMenuDB.cpp (277448 => 277449)


--- trunk/Source/WebCore/platform/win/SearchPopupMenuDB.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebCore/platform/win/SearchPopupMenuDB.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -188,7 +188,7 @@
     }
 
     if (!existsDatabaseFile) {
-        if (!FileSystem::makeAllDirectories(FileSystem::directoryName(m_databaseFilename)))
+        if (!FileSystem::makeAllDirectories(FileSystem::parentPath(m_databaseFilename)))
             LOG_ERROR("Failed to create the search autosave database path %s", m_databaseFilename.utf8().data());
 
         m_database.open(m_databaseFilename);

Modified: trunk/Source/WebCore/workers/service/server/SWScriptStorage.cpp (277448 => 277449)


--- trunk/Source/WebCore/workers/service/server/SWScriptStorage.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebCore/workers/service/server/SWScriptStorage.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -84,7 +84,7 @@
     ASSERT(!isMainThread());
 
     auto scriptPath = this->scriptPath(registrationKey, scriptURL);
-    FileSystem::makeAllDirectories(FileSystem::directoryName(scriptPath));
+    FileSystem::makeAllDirectories(FileSystem::parentPath(scriptPath));
 
     auto iterateOverBufferAndWriteData = [&](const Function<bool(const uint8_t*, size_t)>& writeData) {
         for (auto it = script.buffer()->begin(); it != script.buffer()->end(); ++it)

Modified: trunk/Source/WebKit/ChangeLog (277448 => 277449)


--- trunk/Source/WebKit/ChangeLog	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKit/ChangeLog	2021-05-13 20:47:38 UTC (rev 277449)
@@ -1,5 +1,32 @@
 2021-05-13  Chris Dumez  <[email protected]>
 
+        Rename FileSystem::directoryName() to FileSystem::parentPath()
+        https://bugs.webkit.org/show_bug.cgi?id=225768
+
+        Reviewed by Darin Adler.
+
+        Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
+        consistency with std::filesystem::parent_path() which is used internally.
+
+        * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
+        (WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase):
+        * NetworkProcess/cache/CacheStorageEngine.cpp:
+        (WebKit::CacheStorage::Engine::writeFile):
+        * Shared/glib/ProcessExecutablePathGLib.cpp:
+        (WebKit::getExecutablePath):
+        * UIProcess/API/glib/IconDatabase.cpp:
+        (WebKit::IconDatabase::IconDatabase):
+        * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
+        (webkit_website_data_manager_get_disk_cache_directory):
+        * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
+        (WebKit::bubblewrapSpawn):
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::platformSetNetworkParameters):
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
+
+2021-05-13  Chris Dumez  <[email protected]>
+
         Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
         https://bugs.webkit.org/show_bug.cgi?id=225772
 

Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (277448 => 277449)


--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -369,7 +369,7 @@
 void ResourceLoadStatisticsDatabaseStore::openITPDatabase()
 {
     if (!FileSystem::fileExists(m_storageDirectoryPath)) {
-        if (!FileSystem::makeAllDirectories(FileSystem::directoryName(m_storageDirectoryPath))) {
+        if (!FileSystem::makeAllDirectories(FileSystem::parentPath(m_storageDirectoryPath))) {
             RELEASE_LOG_ERROR(Network, "%p - ResourceLoadStatisticsDatabaseStore::open failed, error message: Failed to create directory database path: %" PUBLIC_LOG_STRING, this, m_storageDirectoryPath.utf8().data());
             return;
         }

Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp (277448 => 277449)


--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -463,7 +463,7 @@
     m_pendingWriteCallbacks.add(++m_pendingCallbacksCounter, WTFMove(callback));
     m_ioQueue->dispatch([this, weakThis = makeWeakPtr(this), identifier = m_pendingCallbacksCounter, data = "" filename = filename.isolatedCopy()]() mutable {
 
-        String directoryPath = FileSystem::directoryName(filename);
+        String directoryPath = FileSystem::parentPath(filename);
         if (!FileSystem::fileExists(directoryPath))
             FileSystem::makeAllDirectories(directoryPath);
 

Modified: trunk/Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp (277448 => 277449)


--- trunk/Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -38,7 +38,7 @@
 {
     CString executablePath = getCurrentExecutablePath();
     if (!executablePath.isNull())
-        return FileSystem::directoryName(FileSystem::stringFromFileSystemRepresentation(executablePath.data()));
+        return FileSystem::parentPath(FileSystem::stringFromFileSystemRepresentation(executablePath.data()));
     return { };
 }
 #endif

Modified: trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp (277448 => 277449)


--- trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -59,7 +59,7 @@
         if (allowDatabaseWrite == AllowDatabaseWrite::No && !FileSystem::fileExists(path))
             return;
 
-        auto databaseDirectory = FileSystem::directoryName(path);
+        auto databaseDirectory = FileSystem::parentPath(path);
         FileSystem::makeAllDirectories(databaseDirectory);
         if (!m_db.open(path)) {
             LOG_ERROR("Unable to open favicon database at path %s - %s", path.utf8().data(), m_db.lastErrorMsg());

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp (277448 => 277449)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -633,7 +633,7 @@
 
     if (!priv->diskCacheDirectory) {
         // The default directory already has the subdirectory.
-        priv->diskCacheDirectory.reset(g_strdup(FileSystem::directoryName(WebKit::WebsiteDataStore::defaultNetworkCacheDirectory()).utf8().data()));
+        priv->diskCacheDirectory.reset(g_strdup(FileSystem::parentPath(WebKit::WebsiteDataStore::defaultNetworkCacheDirectory()).utf8().data()));
     }
     return priv->diskCacheDirectory.get();
 }

Modified: trunk/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp (277448 => 277449)


--- trunk/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -900,7 +900,7 @@
 #if ENABLE(DEVELOPER_MODE)
     const char* execDirectory = g_getenv("WEBKIT_EXEC_PATH");
     if (execDirectory) {
-        String parentDir = FileSystem::directoryName(FileSystem::stringFromFileSystemRepresentation(execDirectory));
+        String parentDir = FileSystem::parentPath(FileSystem::stringFromFileSystemRepresentation(execDirectory));
         bindIfExists(sandboxArgs, parentDir.utf8().data());
     }
 
@@ -907,7 +907,7 @@
     CString executablePath = getCurrentExecutablePath();
     if (!executablePath.isNull()) {
         // Our executable is `/foo/bar/bin/Process`, we want `/foo/bar` as a usable prefix
-        String parentDir = FileSystem::directoryName(FileSystem::directoryName(FileSystem::stringFromFileSystemRepresentation(executablePath.data())));
+        String parentDir = FileSystem::parentPath(FileSystem::parentPath(FileSystem::stringFromFileSystemRepresentation(executablePath.data())));
         bindIfExists(sandboxArgs, parentDir.utf8().data());
     }
 #endif

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (277448 => 277449)


--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2021-05-13 20:47:38 UTC (rev 277449)
@@ -192,7 +192,7 @@
     parameters.uiProcessCookieStorageIdentifier = m_uiProcessCookieStorageIdentifier;
 
     if (!cookieFile.isEmpty())
-        SandboxExtension::createHandleForReadWriteDirectory(FileSystem::directoryName(cookieFile), parameters.cookieStoragePathExtensionHandle);
+        SandboxExtension::createHandleForReadWriteDirectory(FileSystem::parentPath(cookieFile), parameters.cookieStoragePathExtensionHandle);
 }
 
 #if HAVE(CFNETWORK_ALTERNATIVE_SERVICE) || HAVE(NETWORK_LOADER)

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (277448 => 277449)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -268,7 +268,7 @@
 
     // Resolve directories for file paths.
     if (!m_configuration->cookieStorageFile().isEmpty()) {
-        m_resolvedConfiguration->setCookieStorageFile(resolveAndCreateReadWriteDirectoryForSandboxExtension(FileSystem::directoryName(m_configuration->cookieStorageFile())));
+        m_resolvedConfiguration->setCookieStorageFile(resolveAndCreateReadWriteDirectoryForSandboxExtension(FileSystem::parentPath(m_configuration->cookieStorageFile())));
         m_resolvedConfiguration->setCookieStorageFile(FileSystem::pathByAppendingComponent(m_resolvedConfiguration->cookieStorageFile(), FileSystem::pathGetFileName(m_configuration->cookieStorageFile())));
     }
 }

Modified: trunk/Source/WebKitLegacy/ChangeLog (277448 => 277449)


--- trunk/Source/WebKitLegacy/ChangeLog	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKitLegacy/ChangeLog	2021-05-13 20:47:38 UTC (rev 277449)
@@ -1,3 +1,16 @@
+2021-05-13  Chris Dumez  <[email protected]>
+
+        Rename FileSystem::directoryName() to FileSystem::parentPath()
+        https://bugs.webkit.org/show_bug.cgi?id=225768
+
+        Reviewed by Darin Adler.
+
+        Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
+        consistency with std::filesystem::parent_path() which is used internally.
+
+        * Storage/StorageTracker.cpp:
+        (WebKit::ensureDatabaseFileExists):
+
 2021-05-11  Chris Dumez  <[email protected]>
 
         Port WTF::FileSystem::listDirectory to std::filesystem

Modified: trunk/Source/WebKitLegacy/Storage/StorageTracker.cpp (277448 => 277449)


--- trunk/Source/WebKitLegacy/Storage/StorageTracker.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKitLegacy/Storage/StorageTracker.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -113,7 +113,7 @@
 static bool ensureDatabaseFileExists(const String& fileName, bool createIfDoesNotExist)
 {
     if (createIfDoesNotExist)
-        return FileSystem::makeAllDirectories(FileSystem::directoryName(fileName));
+        return FileSystem::makeAllDirectories(FileSystem::parentPath(fileName));
 
     return FileSystem::fileExists(fileName);
 }

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (277448 => 277449)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2021-05-13 20:47:38 UTC (rev 277449)
@@ -1,3 +1,16 @@
+2021-05-13  Chris Dumez  <[email protected]>
+
+        Rename FileSystem::directoryName() to FileSystem::parentPath()
+        https://bugs.webkit.org/show_bug.cgi?id=225768
+
+        Reviewed by Darin Adler.
+
+        Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
+        consistency with std::filesystem::parent_path() which is used internally.
+
+        * Plugins/PluginDatabase.cpp:
+        (WebCore::PluginDatabase::loadPersistentMetadataCache):
+
 2021-05-13  Darin Adler  <[email protected]>
 
         Remove StringBuilder::appendNumber

Modified: trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp (277448 => 277449)


--- trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -515,7 +515,7 @@
 
         // Skip metadata that points to plugins from directories that
         // are not part of plugin directory list anymore.
-        String pluginDirectoryName = FileSystem::directoryName(path);
+        String pluginDirectoryName = FileSystem::parentPath(path);
         if (m_pluginDirectories.find(pluginDirectoryName) == WTF::notFound)
             continue;
 

Modified: trunk/Tools/ChangeLog (277448 => 277449)


--- trunk/Tools/ChangeLog	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Tools/ChangeLog	2021-05-13 20:47:38 UTC (rev 277449)
@@ -1,5 +1,22 @@
 2021-05-13  Chris Dumez  <[email protected]>
 
+        Rename FileSystem::directoryName() to FileSystem::parentPath()
+        https://bugs.webkit.org/show_bug.cgi?id=225768
+
+        Reviewed by Darin Adler.
+
+        Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
+        consistency with std::filesystem::parent_path() which is used internally.
+
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (findFontFallback):
+        * TestWebKitAPI/Tests/WTF/FileSystem.cpp:
+        (TestWebKitAPI::TEST_F):
+        * TestWebKitAPI/win/PlatformUtilitiesWin.cpp:
+        (TestWebKitAPI::Util::moduleDirectory):
+
+2021-05-13  Chris Dumez  <[email protected]>
+
         Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
         https://bugs.webkit.org/show_bug.cgi?id=225772
 

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (277448 => 277449)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -1106,7 +1106,7 @@
 
 static String findFontFallback(const char* pathOrUrl)
 {
-    String pathToFontFallback = FileSystem::directoryName(pathOrUrl);
+    String pathToFontFallback = FileSystem::parentPath(pathOrUrl);
 
     wchar_t fullPath[_MAX_PATH];
     if (!_wfullpath(fullPath, pathToFontFallback.wideCharacters().data(), _MAX_PATH))

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp (277448 => 277449)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -244,7 +244,7 @@
 TEST_F(FileSystemTest, UnicodeDirectoryName)
 {
     String path = String::fromUTF8("/test/a\u0308lo/test.txt");
-    String directoryName = FileSystem::directoryName(path);
+    String directoryName = FileSystem::parentPath(path);
     String expectedDirectoryName = String::fromUTF8("/test/a\u0308lo");
     EXPECT_TRUE(expectedDirectoryName == directoryName);
 }
@@ -762,19 +762,19 @@
 #endif
 }
 
-TEST_F(FileSystemTest, directoryName)
+TEST_F(FileSystemTest, parentPath)
 {
     auto testPath = FileSystem::pathByAppendingComponents(tempEmptyFolderPath(), { "subfolder", "filename.txt" });
-    EXPECT_STREQ(FileSystem::pathByAppendingComponent(tempEmptyFolderPath(), "subfolder").utf8().data(), FileSystem::directoryName(testPath).utf8().data());
+    EXPECT_STREQ(FileSystem::pathByAppendingComponent(tempEmptyFolderPath(), "subfolder").utf8().data(), FileSystem::parentPath(testPath).utf8().data());
 #if OS(UNIX)
-    EXPECT_STREQ("/var/tmp", FileSystem::directoryName("/var/tmp/example.txt").utf8().data());
-    EXPECT_STREQ("/var/tmp", FileSystem::directoryName("/var/tmp/").utf8().data());
-    EXPECT_STREQ("/var/tmp", FileSystem::directoryName("/var/tmp/.").utf8().data());
-    EXPECT_STREQ("/", FileSystem::directoryName("/").utf8().data());
+    EXPECT_STREQ("/var/tmp", FileSystem::parentPath("/var/tmp/example.txt").utf8().data());
+    EXPECT_STREQ("/var/tmp", FileSystem::parentPath("/var/tmp/").utf8().data());
+    EXPECT_STREQ("/var/tmp", FileSystem::parentPath("/var/tmp/.").utf8().data());
+    EXPECT_STREQ("/", FileSystem::parentPath("/").utf8().data());
 #endif
 #if OS(WINDOWS)
-    EXPECT_STREQ("C:\\foo", FileSystem::directoryName("C:\\foo\\example.txt").utf8().data());
-    EXPECT_STREQ("C:\\", FileSystem::directoryName("C:\\").utf8().data());
+    EXPECT_STREQ("C:\\foo", FileSystem::parentPath("C:\\foo\\example.txt").utf8().data());
+    EXPECT_STREQ("C:\\", FileSystem::parentPath("C:\\").utf8().data());
 #endif
 }
 

Modified: trunk/Tools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp (277448 => 277449)


--- trunk/Tools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp	2021-05-13 20:08:36 UTC (rev 277448)
+++ trunk/Tools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp	2021-05-13 20:47:38 UTC (rev 277449)
@@ -39,7 +39,7 @@
     wchar_t filename[bufferLength];
     auto len = GetModuleFileName(nullptr, filename, bufferLength);
     ASSERT(len > 0);
-    return FileSystem::directoryName(String(filename, len));
+    return FileSystem::parentPath(String(filename, len));
 }
 
 WKStringRef createInjectedBundlePath()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to