Title: [224505] trunk
Revision
224505
Author
commit-qu...@webkit.org
Date
2017-11-06 12:20:28 -0800 (Mon, 06 Nov 2017)

Log Message

Use enum classes within FileSystem
https://bugs.webkit.org/show_bug.cgi?id=175172

Patch by Christopher Reid <chris.r...@sony.com> on 2017-11-06
Reviewed by Myles C. Maxfield.

Source/WebCore:

No new tests, no change in behavior.

Using enum classes in filesystem to enforce stronger type safety.

* Modules/webdatabase/OriginLock.cpp:
* loader/appcache/ApplicationCacheStorage.cpp:
* platform/FileHandle.h:
* platform/FileStream.cpp:
* platform/FileSystem.cpp:
* platform/FileSystem.h:
* platform/cocoa/FileMonitorCocoa.mm:
* platform/glib/FileSystemGlib.cpp:
* platform/network/curl/CurlCacheEntry.cpp:
* platform/network/curl/CurlCacheManager.cpp:
* platform/posix/FileSystemPOSIX.cpp:
* platform/win/FileSystemWin.cpp:
* rendering/RenderThemeWin.cpp:

Source/WebKit:

* NetworkProcess/Downloads/BlobDownloadClient.cpp:
* NetworkProcess/NetworkDataTaskBlob.cpp:
* NetworkProcess/cache/NetworkCache.cpp:
* NetworkProcess/capture/NetworkCaptureManager.cpp:
* NetworkProcess/capture/NetworkCaptureRecorder.cpp:
* Shared/WebMemorySampler.cpp:
* UIProcess/API/APIContentRuleListStore.cpp:
* UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:

Source/WebKitLegacy/win:

* Plugins/PluginDatabase.cpp:

Source/WTF:

Adding a helper function for converting enum classes to their underlying type when necessary.

* wtf/EnumTraits.h:

Tools:

* TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:
* TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (224504 => 224505)


--- trunk/Source/WTF/ChangeLog	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WTF/ChangeLog	2017-11-06 20:20:28 UTC (rev 224505)
@@ -1,3 +1,14 @@
+2017-11-06  Christopher Reid  <chris.r...@sony.com>
+
+        Use enum classes within FileSystem
+        https://bugs.webkit.org/show_bug.cgi?id=175172
+
+        Reviewed by Myles C. Maxfield.
+
+        Adding a helper function for converting enum classes to their underlying type when necessary.
+
+        * wtf/EnumTraits.h:
+
 2017-11-06  Michael Catanzaro  <mcatanz...@igalia.com>
 
         [WPE][GTK] Always use SET_AND_EXPOSE_TO_BUILD to set build variables

Modified: trunk/Source/WTF/wtf/EnumTraits.h (224504 => 224505)


--- trunk/Source/WTF/wtf/EnumTraits.h	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WTF/wtf/EnumTraits.h	2017-11-06 20:20:28 UTC (rev 224505)
@@ -59,6 +59,12 @@
     return EnumValueChecker<T, typename EnumTraits<E>::values>::isValidEnum(t);
 }
 
+template<typename E>
+constexpr auto enumToUnderlyingType(E e)
+{
+    return static_cast<std::underlying_type_t<E>>(e);
 }
 
+}
+
 using WTF::isValidEnum;

Modified: trunk/Source/WebCore/ChangeLog (224504 => 224505)


--- trunk/Source/WebCore/ChangeLog	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/ChangeLog	2017-11-06 20:20:28 UTC (rev 224505)
@@ -1,3 +1,28 @@
+2017-11-06  Christopher Reid  <chris.r...@sony.com>
+
+        Use enum classes within FileSystem
+        https://bugs.webkit.org/show_bug.cgi?id=175172
+
+        Reviewed by Myles C. Maxfield.
+
+        No new tests, no change in behavior.
+
+        Using enum classes in filesystem to enforce stronger type safety.
+
+        * Modules/webdatabase/OriginLock.cpp:
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        * platform/FileHandle.h:
+        * platform/FileStream.cpp:
+        * platform/FileSystem.cpp:
+        * platform/FileSystem.h:
+        * platform/cocoa/FileMonitorCocoa.mm:
+        * platform/glib/FileSystemGlib.cpp:
+        * platform/network/curl/CurlCacheEntry.cpp:
+        * platform/network/curl/CurlCacheManager.cpp:
+        * platform/posix/FileSystemPOSIX.cpp:
+        * platform/win/FileSystemWin.cpp:
+        * rendering/RenderThemeWin.cpp:
+
 2017-11-06  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r224497.

Modified: trunk/Source/WebCore/Modules/webdatabase/OriginLock.cpp (224504 => 224505)


--- trunk/Source/WebCore/Modules/webdatabase/OriginLock.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/Modules/webdatabase/OriginLock.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -50,7 +50,7 @@
     m_mutex.lock();
 
 #if USE(FILE_LOCK)
-    m_lockHandle = FileSystem::openAndLockFile(m_lockFileName, FileSystem::OpenForWrite);
+    m_lockHandle = FileSystem::openAndLockFile(m_lockFileName, FileSystem::FileOpenMode::OpenForWrite);
     if (m_lockHandle == FileSystem::invalidPlatformFileHandle) {
         // The only way we can get here is if the directory containing the lock
         // has been deleted or we were given a path to a non-existant directory.

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp (224504 => 224505)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -1304,7 +1304,7 @@
         fullPath = FileSystem::pathByAppendingComponent(directory, path);
     } while (FileSystem::directoryName(fullPath) != directory || FileSystem::fileExists(fullPath));
     
-    FileSystem::PlatformFileHandle handle = FileSystem::openFile(fullPath, FileSystem::OpenForWrite);
+    FileSystem::PlatformFileHandle handle = FileSystem::openFile(fullPath, FileSystem::FileOpenMode::OpenForWrite);
     if (!handle)
         return false;
     

Modified: trunk/Source/WebCore/platform/FileHandle.h (224504 => 224505)


--- trunk/Source/WebCore/platform/FileHandle.h	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/platform/FileHandle.h	2017-11-06 20:20:28 UTC (rev 224505)
@@ -57,7 +57,7 @@
 
 private:
     String m_path;
-    FileSystem::FileOpenMode m_mode { FileSystem::OpenForRead };
+    FileSystem::FileOpenMode m_mode { FileSystem::FileOpenMode::OpenForRead };
     FileSystem::PlatformFileHandle m_fileHandle { FileSystem::invalidPlatformFileHandle };
 };
 

Modified: trunk/Source/WebCore/platform/FileStream.cpp (224504 => 224505)


--- trunk/Source/WebCore/platform/FileStream.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/platform/FileStream.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -74,13 +74,13 @@
         return true;
 
     // Open the file.
-    m_handle = FileSystem::openFile(path, FileSystem::OpenForRead);
+    m_handle = FileSystem::openFile(path, FileSystem::FileOpenMode::OpenForRead);
     if (!FileSystem::isHandleValid(m_handle))
         return false;
 
     // Jump to the beginning position if the file has been sliced.
     if (offset > 0) {
-        if (FileSystem::seekFile(m_handle, offset, FileSystem::SeekFromBeginning) < 0)
+        if (FileSystem::seekFile(m_handle, offset, FileSystem::FileSeekOrigin::SeekFromBeginning) < 0)
             return false;
     }
 

Modified: trunk/Source/WebCore/platform/FileSystem.cpp (224504 => 224505)


--- trunk/Source/WebCore/platform/FileSystem.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/platform/FileSystem.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -207,7 +207,7 @@
 
 bool appendFileContentsToFileHandle(const String& path, PlatformFileHandle& target)
 {
-    auto source = openFile(path, OpenForRead);
+    auto source = openFile(path, FileOpenMode::OpenForRead);
 
     if (!isHandleValid(source))
         return false;

Modified: trunk/Source/WebCore/platform/FileSystem.h (224504 => 224505)


--- trunk/Source/WebCore/platform/FileSystem.h	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/platform/FileSystem.h	2017-11-06 20:20:28 UTC (rev 224505)
@@ -74,7 +74,7 @@
 const PlatformFileHandle invalidPlatformFileHandle = -1;
 #endif
 
-enum FileOpenMode {
+enum class FileOpenMode {
     OpenForRead = 0,
     OpenForWrite,
 #if OS(DARWIN)
@@ -82,13 +82,13 @@
 #endif
 };
 
-enum FileSeekOrigin {
+enum class FileSeekOrigin {
     SeekFromBeginning = 0,
     SeekFromCurrent,
     SeekFromEnd
 };
 
-enum FileLockMode {
+enum class FileLockMode {
     LockShared = 1,
     LockExclusive = 2,
     LockNonBlocking = 4
@@ -145,7 +145,7 @@
 // Returns number of bytes actually written if successful, -1 otherwise.
 WEBCORE_EXPORT int readFromFile(PlatformFileHandle, char* data, int length);
 
-WEBCORE_EXPORT PlatformFileHandle openAndLockFile(const String&, FileOpenMode, FileLockMode = LockExclusive);
+WEBCORE_EXPORT PlatformFileHandle openAndLockFile(const String&, FileOpenMode, FileLockMode = FileLockMode::LockExclusive);
 WEBCORE_EXPORT void unlockAndCloseFile(PlatformFileHandle);
 
 // Appends the contents of the file found at 'path' to the open PlatformFileHandle.

Modified: trunk/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm (224504 => 224505)


--- trunk/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm	2017-11-06 20:20:28 UTC (rev 224505)
@@ -43,7 +43,7 @@
     if (!modificationHandler)
         return;
 
-    auto handle = FileSystem::openFile(path, FileSystem::OpenForEventsOnly);
+    auto handle = FileSystem::openFile(path, FileSystem::FileOpenMode::OpenForEventsOnly);
     if (handle == FileSystem::invalidPlatformFileHandle) {
         RELEASE_LOG_ERROR(ResourceLoadStatistics, "Failed to open statistics file for monitoring: %s", path.utf8().data());
         return;

Modified: trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp (224504 => 224505)


--- trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -30,6 +30,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <sys/file.h>
+#include <wtf/EnumTraits.h>
 #include <wtf/UUID.h>
 #include <wtf/glib/GLibUtilities.h>
 #include <wtf/glib/GRefPtr.h>
@@ -362,9 +363,9 @@
 
     GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(filename.get()));
     GFileIOStream* ioStream = 0;
-    if (mode == OpenForRead)
+    if (mode == FileOpenMode::OpenForRead)
         ioStream = g_file_open_readwrite(file.get(), 0, 0);
-    else if (mode == OpenForWrite) {
+    else if (mode == FileOpenMode::OpenForWrite) {
         if (g_file_test(filename.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)))
             ioStream = g_file_open_readwrite(file.get(), 0, 0);
         else
@@ -388,13 +389,13 @@
 {
     GSeekType seekType = G_SEEK_SET;
     switch (origin) {
-    case SeekFromBeginning:
+    case FileSeekOrigin::SeekFromBeginning:
         seekType = G_SEEK_SET;
         break;
-    case SeekFromCurrent:
+    case FileSeekOrigin::SeekFromCurrent:
         seekType = G_SEEK_CUR;
         break;
-    case SeekFromEnd:
+    case FileSeekOrigin::SeekFromEnd:
         seekType = G_SEEK_END;
         break;
     default:
@@ -482,11 +483,11 @@
 #if USE(FILE_LOCK)
 bool lockFile(PlatformFileHandle handle, FileLockMode lockMode)
 {
-    COMPILE_ASSERT(LOCK_SH == LockShared, LockSharedEncodingIsAsExpected);
-    COMPILE_ASSERT(LOCK_EX == LockExclusive, LockExclusiveEncodingIsAsExpected);
-    COMPILE_ASSERT(LOCK_NB == LockNonBlocking, LockNonBlockingEncodingIsAsExpected);
+    COMPILE_ASSERT(LOCK_SH == WTF::enumToUnderlyingType(FileLockMode::LockShared), LockSharedEncodingIsAsExpected);
+    COMPILE_ASSERT(LOCK_EX == WTF::enumToUnderlyingType(FileLockMode::LockExclusive), LockExclusiveEncodingIsAsExpected);
+    COMPILE_ASSERT(LOCK_NB == WTF::enumToUnderlyingType(FileLockMode::LockNonBlocking), LockNonBlockingEncodingIsAsExpected);
     auto* inputStream = g_io_stream_get_input_stream(G_IO_STREAM(handle));
-    int result = flock(g_file_descriptor_based_get_fd(G_FILE_DESCRIPTOR_BASED(inputStream)), lockMode);
+    int result = flock(g_file_descriptor_based_get_fd(G_FILE_DESCRIPTOR_BASED(inputStream)), WTF::enumToUnderlyingType(lockMode));
     return result != -1;
 }
 

Modified: trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp (224504 => 224505)


--- trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -125,7 +125,7 @@
 
 bool CurlCacheEntry::saveResponseHeaders(const ResourceResponse& response)
 {
-    FileSystem::PlatformFileHandle headerFile = FileSystem::openFile(m_headerFilename, FileSystem::OpenForWrite);
+    FileSystem::PlatformFileHandle headerFile = FileSystem::openFile(m_headerFilename, FileSystem::FileOpenMode::OpenForWrite);
     if (!FileSystem::isHandleValid(headerFile)) {
         LOG(Network, "Cache Error: Could not open %s for write\n", m_headerFilename.latin1().data());
         return false;
@@ -227,7 +227,7 @@
 bool CurlCacheEntry::loadFileToBuffer(const String& filepath, Vector<char>& buffer)
 {
     // Open the file
-    FileSystem::PlatformFileHandle inputFile = FileSystem::openFile(filepath, FileSystem::OpenForRead);
+    FileSystem::PlatformFileHandle inputFile = FileSystem::openFile(filepath, FileSystem::FileOpenMode::OpenForRead);
     if (!FileSystem::isHandleValid(inputFile)) {
         LOG(Network, "Cache Error: Could not open %s for read\n", filepath.latin1().data());
         return false;
@@ -363,7 +363,7 @@
     if (FileSystem::isHandleValid(m_contentFile))
         return true;
     
-    m_contentFile = FileSystem::openFile(m_contentFilename, FileSystem::OpenForWrite);
+    m_contentFile = FileSystem::openFile(m_contentFilename, FileSystem::FileOpenMode::OpenForWrite);
 
     if (FileSystem::isHandleValid(m_contentFile))
         return true;

Modified: trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp (224504 => 224505)


--- trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -103,7 +103,7 @@
     String indexFilePath(m_cacheDir);
     indexFilePath.append("index.dat");
 
-    FileSystem::PlatformFileHandle indexFile = FileSystem::openFile(indexFilePath, FileSystem::OpenForRead);
+    FileSystem::PlatformFileHandle indexFile = FileSystem::openFile(indexFilePath, FileSystem::FileOpenMode::OpenForRead);
     if (!FileSystem::isHandleValid(indexFile)) {
         LOG(Network, "Cache Warning: Could not open %s for read\n", indexFilePath.latin1().data());
         return;
@@ -165,7 +165,7 @@
     indexFilePath.append("index.dat");
 
     FileSystem::deleteFile(indexFilePath);
-    FileSystem::PlatformFileHandle indexFile = FileSystem::openFile(indexFilePath, FileSystem::OpenForWrite);
+    FileSystem::PlatformFileHandle indexFile = FileSystem::openFile(indexFilePath, FileSystem::FileOpenMode::OpenForWrite);
     if (!FileSystem::isHandleValid(indexFile)) {
         LOG(Network, "Cache Error: Could not open %s for write\n", indexFilePath.latin1().data());
         return;

Modified: trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp (224504 => 224505)


--- trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -39,6 +39,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
+#include <wtf/EnumTraits.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/WTFString.h>
@@ -82,12 +83,12 @@
         return invalidPlatformFileHandle;
 
     int platformFlag = 0;
-    if (mode == OpenForRead)
+    if (mode == FileOpenMode::OpenForRead)
         platformFlag |= O_RDONLY;
-    else if (mode == OpenForWrite)
+    else if (mode == FileOpenMode::OpenForWrite)
         platformFlag |= (O_WRONLY | O_CREAT | O_TRUNC);
 #if OS(DARWIN)
-    else if (mode == OpenForEventsOnly)
+    else if (mode == FileOpenMode::OpenForEventsOnly)
         platformFlag |= O_EVTONLY;
 #endif
 
@@ -106,13 +107,13 @@
 {
     int whence = SEEK_SET;
     switch (origin) {
-    case SeekFromBeginning:
+    case FileSeekOrigin::SeekFromBeginning:
         whence = SEEK_SET;
         break;
-    case SeekFromCurrent:
+    case FileSeekOrigin::SeekFromCurrent:
         whence = SEEK_CUR;
         break;
-    case SeekFromEnd:
+    case FileSeekOrigin::SeekFromEnd:
         whence = SEEK_END;
         break;
     default:
@@ -150,10 +151,10 @@
 #if USE(FILE_LOCK)
 bool lockFile(PlatformFileHandle handle, FileLockMode lockMode)
 {
-    COMPILE_ASSERT(LOCK_SH == LockShared, LockSharedEncodingIsAsExpected);
-    COMPILE_ASSERT(LOCK_EX == LockExclusive, LockExclusiveEncodingIsAsExpected);
-    COMPILE_ASSERT(LOCK_NB == LockNonBlocking, LockNonBlockingEncodingIsAsExpected);
-    int result = flock(handle, lockMode);
+    COMPILE_ASSERT(LOCK_SH == WTF::enumToUnderlyingType(FileLockMode::LockShared), LockSharedEncodingIsAsExpected);
+    COMPILE_ASSERT(LOCK_EX == WTF::enumToUnderlyingType(FileLockMode::LockExclusive), LockExclusiveEncodingIsAsExpected);
+    COMPILE_ASSERT(LOCK_NB == WTF::enumToUnderlyingType(FileLockMode::LockNonBlocking), LockNonBlockingEncodingIsAsExpected);
+    int result = flock(handle, WTF::enumToUnderlyingType(lockMode));
     return (result != -1);
 }
 

Modified: trunk/Source/WebCore/platform/win/FileSystemWin.cpp (224504 => 224505)


--- trunk/Source/WebCore/platform/win/FileSystemWin.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/platform/win/FileSystemWin.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -145,7 +145,7 @@
 
 static String getFinalPathName(const String& path)
 {
-    auto handle = openFile(path, OpenForRead);
+    auto handle = openFile(path, FileOpenMode::OpenForRead);
     if (!isHandleValid(handle))
         return String();
 
@@ -418,12 +418,12 @@
     DWORD creationDisposition = 0;
     DWORD shareMode = 0;
     switch (mode) {
-    case OpenForRead:
+    case FileOpenMode::OpenForRead:
         desiredAccess = GENERIC_READ;
         creationDisposition = OPEN_EXISTING;
         shareMode = FILE_SHARE_READ;
         break;
-    case OpenForWrite:
+    case FileOpenMode::OpenForWrite:
         desiredAccess = GENERIC_WRITE;
         creationDisposition = CREATE_ALWAYS;
         break;
@@ -447,9 +447,9 @@
 {
     DWORD moveMethod = FILE_BEGIN;
 
-    if (origin == SeekFromCurrent)
+    if (origin == FileSeekOrigin::SeekFromCurrent)
         moveMethod = FILE_CURRENT;
-    else if (origin == SeekFromEnd)
+    else if (origin == FileSeekOrigin::SeekFromEnd)
         moveMethod = FILE_END;
 
     LARGE_INTEGER largeOffset;
@@ -530,7 +530,7 @@
 
 std::optional<int32_t> getFileDeviceId(const CString& fsFile)
 {
-    auto handle = openFile(fsFile.data(), OpenForRead);
+    auto handle = openFile(fsFile.data(), FileOpenMode::OpenForRead);
     if (!isHandleValid(handle))
         return std::nullopt;
 

Modified: trunk/Source/WebCore/rendering/RenderThemeWin.cpp (224504 => 224505)


--- trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -1058,7 +1058,7 @@
     if (!CFURLGetFileSystemRepresentation(requestedURLRef.get(), false, requestedFilePath, MAX_PATH))
         return String();
 
-    FileSystem::PlatformFileHandle requestedFileHandle = FileSystem::openFile(requestedFilePath, FileSystem::OpenForRead);
+    FileSystem::PlatformFileHandle requestedFileHandle = FileSystem::openFile(requestedFilePath, FileSystem::FileOpenMode::OpenForRead);
     if (!FileSystem::isHandleValid(requestedFileHandle))
         return String();
 

Modified: trunk/Source/WebKit/ChangeLog (224504 => 224505)


--- trunk/Source/WebKit/ChangeLog	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebKit/ChangeLog	2017-11-06 20:20:28 UTC (rev 224505)
@@ -1,3 +1,19 @@
+2017-11-06  Christopher Reid  <chris.r...@sony.com>
+
+        Use enum classes within FileSystem
+        https://bugs.webkit.org/show_bug.cgi?id=175172
+
+        Reviewed by Myles C. Maxfield.
+
+        * NetworkProcess/Downloads/BlobDownloadClient.cpp:
+        * NetworkProcess/NetworkDataTaskBlob.cpp:
+        * NetworkProcess/cache/NetworkCache.cpp:
+        * NetworkProcess/capture/NetworkCaptureManager.cpp:
+        * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
+        * Shared/WebMemorySampler.cpp:
+        * UIProcess/API/APIContentRuleListStore.cpp:
+        * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
+
 2017-11-06  Michael Catanzaro  <mcatanz...@igalia.com>
 
         [WPE] Properly use SYSTEM_INCLUDE_DIRECTORIES for WebKit build target

Modified: trunk/Source/WebKit/NetworkProcess/Downloads/BlobDownloadClient.cpp (224504 => 224505)


--- trunk/Source/WebKit/NetworkProcess/Downloads/BlobDownloadClient.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebKit/NetworkProcess/Downloads/BlobDownloadClient.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -66,7 +66,7 @@
     }
 
     m_destinationPath = destinationPath;
-    m_destinationFile = FileSystem::openFile(m_destinationPath, FileSystem::OpenForWrite);
+    m_destinationFile = FileSystem::openFile(m_destinationPath, FileSystem::FileOpenMode::OpenForWrite);
     m_download.didCreateDestination(m_destinationPath);
 
     m_download.continueDidReceiveResponse();

Modified: trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp (224504 => 224505)


--- trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -467,7 +467,7 @@
 
     LOG(NetworkSession, "%p - NetworkDataTaskBlob::download to %s", this, m_pendingDownloadLocation.utf8().data());
 
-    m_downloadFile = FileSystem::openFile(m_pendingDownloadLocation, FileSystem::OpenForWrite);
+    m_downloadFile = FileSystem::openFile(m_pendingDownloadLocation, FileSystem::FileOpenMode::OpenForWrite);
     if (m_downloadFile == FileSystem::invalidPlatformFileHandle) {
         didFailDownload(cancelledError(m_firstRequest));
         return;

Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp (224504 => 224505)


--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -49,6 +49,7 @@
 #endif
 
 using namespace std::literals::chrono_literals;
+using namespace WebCore::FileSystem;
 
 namespace WebKit {
 namespace NetworkCache {
@@ -111,7 +112,7 @@
 #endif
 #if PLATFORM(GTK)
         // Triggers with "touch $cachePath/dump".
-        CString dumpFilePath = WebCore::FileSystem::fileSystemRepresentation(WebCore::FileSystem::pathByAppendingComponent(m_storage->basePath(), "dump"));
+        CString dumpFilePath = fileSystemRepresentation(pathByAppendingComponent(m_storage->basePath(), "dump"));
         GRefPtr<GFile> dumpFile = adoptGRef(g_file_new_for_path(dumpFilePath.data()));
         GFileMonitor* monitor = g_file_monitor_file(dumpFile.get(), G_FILE_MONITOR_NONE, nullptr, nullptr);
         g_signal_connect_swapped(monitor, "changed", G_CALLBACK(dumpFileChanged), this);
@@ -537,16 +538,16 @@
 
 String Cache::dumpFilePath() const
 {
-    return WebCore::FileSystem::pathByAppendingComponent(m_storage->versionPath(), "dump.json");
+    return pathByAppendingComponent(m_storage->versionPath(), "dump.json");
 }
 
 void Cache::dumpContentsToFile()
 {
-    auto fd = WebCore::FileSystem::openFile(dumpFilePath(), WebCore::FileSystem::OpenForWrite);
-    if (!WebCore::FileSystem::isHandleValid(fd))
+    auto fd = openFile(dumpFilePath(), FileOpenMode::OpenForWrite);
+    if (!isHandleValid(fd))
         return;
     auto prologue = String("{\n\"entries\": [\n").utf8();
-    WebCore::FileSystem::writeToFile(fd, prologue.data(), prologue.length());
+    writeToFile(fd, prologue.data(), prologue.length());
 
     struct Totals {
         unsigned count { 0 };
@@ -575,8 +576,8 @@
             epilogue.appendLiteral("\n");
             epilogue.appendLiteral("}\n}\n");
             auto writeData = epilogue.toString().utf8();
-            WebCore::FileSystem::writeToFile(fd, writeData.data(), writeData.length());
-            WebCore::FileSystem::closeFile(fd);
+            writeToFile(fd, writeData.data(), writeData.length());
+            closeFile(fd);
             return;
         }
         auto entry = Entry::decodeStorageRecord(*record);
@@ -590,7 +591,7 @@
         entry->asJSON(json, info);
         json.appendLiteral(",\n");
         auto writeData = json.toString().utf8();
-        WebCore::FileSystem::writeToFile(fd, writeData.data(), writeData.length());
+        writeToFile(fd, writeData.data(), writeData.length());
     });
 }
 
@@ -597,7 +598,7 @@
 void Cache::deleteDumpFile()
 {
     WorkQueue::create("com.apple.WebKit.Cache.delete")->dispatch([path = dumpFilePath().isolatedCopy()] {
-        WebCore::FileSystem::deleteFile(path);
+        deleteFile(path);
     });
 }
 

Modified: trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureManager.cpp (224504 => 224505)


--- trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureManager.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureManager.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -42,6 +42,8 @@
 
 #define DEBUG_CLASS Manager
 
+using namespace WebCore::FileSystem;
+
 namespace WebKit {
 namespace NetworkCapture {
 
@@ -73,15 +75,15 @@
         m_recordReplayMode = Disabled;
     }
 
-    m_recordReplayCacheLocation = WebCore::FileSystem::pathByAppendingComponent(recordReplayCacheLocation, kDirNameRecordReplay);
+    m_recordReplayCacheLocation = pathByAppendingComponent(recordReplayCacheLocation, kDirNameRecordReplay);
     DEBUG_LOG("Cache location = " STRING_SPECIFIER, DEBUG_STR(m_recordReplayCacheLocation));
 
     if (isRecording()) {
-        m_recordFileHandle = WebCore::FileHandle(reportRecordPath(), WebCore::FileSystem::OpenForWrite);
+        m_recordFileHandle = WebCore::FileHandle(reportRecordPath(), FileOpenMode::OpenForWrite);
     } else if (isReplaying()) {
-        m_recordFileHandle = WebCore::FileHandle(reportRecordPath(), WebCore::FileSystem::OpenForRead);
-        m_loadFileHandle = WebCore::FileHandle(reportLoadPath(), WebCore::FileSystem::OpenForWrite);
-        m_replayFileHandle = WebCore::FileHandle(reportReplayPath(), WebCore::FileSystem::OpenForWrite);
+        m_recordFileHandle = WebCore::FileHandle(reportRecordPath(), FileOpenMode::OpenForRead);
+        m_loadFileHandle = WebCore::FileHandle(reportLoadPath(), FileOpenMode::OpenForWrite);
+        m_replayFileHandle = WebCore::FileHandle(reportReplayPath(), FileOpenMode::OpenForWrite);
         loadResources();
     }
 }
@@ -365,17 +367,17 @@
 
 String Manager::reportLoadPath()
 {
-    return WebCore::FileSystem::pathByAppendingComponent(m_recordReplayCacheLocation, kFileNameReportLoad);
+    return pathByAppendingComponent(m_recordReplayCacheLocation, kFileNameReportLoad);
 }
 
 String Manager::reportRecordPath()
 {
-    return WebCore::FileSystem::pathByAppendingComponent(m_recordReplayCacheLocation, kFileNameReportRecord);
+    return pathByAppendingComponent(m_recordReplayCacheLocation, kFileNameReportRecord);
 }
 
 String Manager::reportReplayPath()
 {
-    return WebCore::FileSystem::pathByAppendingComponent(m_recordReplayCacheLocation, kFileNameReportReplay);
+    return pathByAppendingComponent(m_recordReplayCacheLocation, kFileNameReportReplay);
 }
 
 String Manager::requestToPath(const WebCore::ResourceRequest& request)
@@ -411,9 +413,9 @@
     fileName.append(hashTail);
     fileName.appendLiteral(".data");
 
-    auto path = WebCore::FileSystem::pathByAppendingComponent(m_recordReplayCacheLocation, kDirNameResources);
-    path = WebCore::FileSystem::pathByAppendingComponent(path, hashHead);
-    path = WebCore::FileSystem::pathByAppendingComponent(path, fileName.toString());
+    auto path = pathByAppendingComponent(m_recordReplayCacheLocation, kDirNameResources);
+    path = pathByAppendingComponent(path, hashHead);
+    path = pathByAppendingComponent(path, fileName.toString());
 
     return path;
 }
@@ -452,7 +454,7 @@
     m_replayFileHandle.printf("%s %s\n", wasCacheMiss ? "miss" : "hit ", DEBUG_STR(url.string()));
 }
 
-WebCore::FileHandle Manager::openCacheFile(const String& filePath, WebCore::FileSystem::FileOpenMode mode)
+WebCore::FileHandle Manager::openCacheFile(const String& filePath, FileOpenMode mode)
 {
     // If we can trivially open the file, then do that and return the new file
     // handle.
@@ -464,9 +466,9 @@
     // If we're opening the file for writing (including appending), then try
     // again after making sure all intermediate directories have been created.
 
-    if (mode != WebCore::FileSystem::OpenForRead) {
-        const auto& parentDir = WebCore::FileSystem::directoryName(filePath);
-        if (!WebCore::FileSystem::makeAllDirectories(parentDir)) {
+    if (mode != FileOpenMode::OpenForRead) {
+        const auto& parentDir = directoryName(filePath);
+        if (!makeAllDirectories(parentDir)) {
             DEBUG_LOG_ERROR("Error %d trying to create intermediate directories: " STRING_SPECIFIER, errno, DEBUG_STR(parentDir));
             return fileHandle;
         }
@@ -479,7 +481,7 @@
     // Could not open the file. Log the error and leave, returning the invalid
     // file handle.
 
-    if (mode == WebCore::FileSystem::OpenForRead)
+    if (mode == FileOpenMode::OpenForRead)
         DEBUG_LOG_ERROR("Error %d trying to open " STRING_SPECIFIER " for reading", errno, DEBUG_STR(filePath));
     else
         DEBUG_LOG_ERROR("Error %d trying to open " STRING_SPECIFIER " for writing", errno, DEBUG_STR(filePath));
@@ -490,7 +492,7 @@
 std::optional<Vector<Vector<String>>> Manager::readFile(const String& filePath)
 {
     bool success = false;
-    WebCore::FileSystem::MappedFileData file(filePath, success);
+    MappedFileData file(filePath, success);
     if (!success)
         return std::nullopt;
 

Modified: trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureRecorder.cpp (224504 => 224505)


--- trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureRecorder.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureRecorder.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -131,7 +131,7 @@
 void Recorder::writeEvents()
 {
     auto path = Manager::singleton().requestToPath(m_initialRequest);
-    auto handle = Manager::singleton().openCacheFile(path, WebCore::FileSystem::OpenForWrite);
+    auto handle = Manager::singleton().openCacheFile(path, WebCore::FileSystem::FileOpenMode::OpenForWrite);
     if (!handle)
         return;
 

Modified: trunk/Source/WebKit/Shared/WebMemorySampler.cpp (224504 => 224505)


--- trunk/Source/WebKit/Shared/WebMemorySampler.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebKit/Shared/WebMemorySampler.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -137,7 +137,7 @@
     if (m_sampleLogSandboxExtension)
         m_sampleLogSandboxExtension->consume();
     m_sampleLogFilePath = sampleLogFilePath;
-    m_sampleLogFile = FileSystem::openFile(m_sampleLogFilePath, FileSystem::OpenForWrite);
+    m_sampleLogFile = FileSystem::openFile(m_sampleLogFilePath, FileSystem::FileOpenMode::OpenForWrite);
     writeHeaders();
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp (224504 => 224505)


--- trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -44,6 +44,7 @@
 #include <wtf/persistence/PersistentEncoder.h>
 
 using namespace WebKit::NetworkCache;
+using namespace WebCore::FileSystem;
 
 namespace API {
     
@@ -85,7 +86,7 @@
     , m_removeQueue(WorkQueue::create("ContentRuleListStore Remove Queue"))
     , m_legacyFilename(legacyFilename)
 {
-    WebCore::FileSystem::makeAllDirectories(storePath);
+    makeAllDirectories(storePath);
 }
 
 ContentRuleListStore::~ContentRuleListStore()
@@ -108,7 +109,7 @@
 
 static String constructedPath(const String& base, const String& identifier, bool legacyFilename)
 {
-    return WebCore::FileSystem::pathByAppendingComponent(base, makeString(constructedPathPrefix(legacyFilename), WebCore::FileSystem::encodeForFileName(identifier)));
+    return pathByAppendingComponent(base, makeString(constructedPathPrefix(legacyFilename), encodeForFileName(identifier)));
 }
 
 // The size and offset of the densely packed bytes in the file, not sizeof and offsetof, which would
@@ -184,7 +185,7 @@
 
 static bool openAndMapContentRuleList(const String& path, ContentRuleListMetaData& metaData, Data& fileData)
 {
-    fileData = mapFile(WebCore::FileSystem::fileSystemRepresentation(path).data());
+    fileData = mapFile(fileSystemRepresentation(path).data());
     if (fileData.isNull())
         return false;
 
@@ -194,11 +195,11 @@
     return true;
 }
 
-static bool writeDataToFile(const Data& fileData, WebCore::FileSystem::PlatformFileHandle fd)
+static bool writeDataToFile(const Data& fileData, PlatformFileHandle fd)
 {
     bool success = true;
     fileData.apply([fd, &success](const uint8_t* data, size_t size) {
-        if (WebCore::FileSystem::writeToFile(fd, (const char*)data, size) == -1) {
+        if (writeToFile(fd, (const char*)data, size) == -1) {
             success = false;
             return false;
         }
@@ -214,7 +215,7 @@
 
     class CompilationClient final : public ContentExtensionCompilationClient {
     public:
-        CompilationClient(WebCore::FileSystem::PlatformFileHandle fileHandle, ContentRuleListMetaData& metaData)
+        CompilationClient(PlatformFileHandle fileHandle, ContentRuleListMetaData& metaData)
             : m_fileHandle(fileHandle)
             , m_metaData(metaData)
         {
@@ -287,8 +288,8 @@
             m_metaData.conditionsApplyOnlyToDomain = m_conditionsApplyOnlyToDomain;
             
             Data header = encodeContentRuleListMetaData(m_metaData);
-            if (!m_fileError && WebCore::FileSystem::seekFile(m_fileHandle, 0ll, WebCore::FileSystem::FileSeekOrigin::SeekFromBeginning) == -1) {
-                WebCore::FileSystem::closeFile(m_fileHandle);
+            if (!m_fileError && seekFile(m_fileHandle, 0ll, FileSeekOrigin::SeekFromBeginning) == -1) {
+                closeFile(m_fileHandle);
                 m_fileError = true;
             }
             writeToFile(header);
@@ -304,12 +305,12 @@
         void writeToFile(const Data& data)
         {
             if (!m_fileError && !writeDataToFile(data, m_fileHandle)) {
-                WebCore::FileSystem::closeFile(m_fileHandle);
+                closeFile(m_fileHandle);
                 m_fileError = true;
             }
         }
         
-        WebCore::FileSystem::PlatformFileHandle m_fileHandle;
+        PlatformFileHandle m_fileHandle;
         ContentRuleListMetaData& m_metaData;
         size_t m_filtersWithoutConditionsBytecodeWritten { 0 };
         size_t m_filtersWithConditionBytecodeWritten { 0 };
@@ -320,16 +321,16 @@
         bool m_fileError { false };
     };
 
-    auto temporaryFileHandle = WebCore::FileSystem::invalidPlatformFileHandle;
-    String temporaryFilePath = WebCore::FileSystem::openTemporaryFile("ContentRuleList", temporaryFileHandle);
-    if (temporaryFileHandle == WebCore::FileSystem::invalidPlatformFileHandle)
+    auto temporaryFileHandle = invalidPlatformFileHandle;
+    String temporaryFilePath = openTemporaryFile("ContentRuleList", temporaryFileHandle);
+    if (temporaryFileHandle == invalidPlatformFileHandle)
         return ContentRuleListStore::Error::CompileFailed;
     
     char invalidHeader[ContentRuleListFileHeaderSize];
     memset(invalidHeader, 0xFF, sizeof(invalidHeader));
     // This header will be rewritten in CompilationClient::finalize.
-    if (WebCore::FileSystem::writeToFile(temporaryFileHandle, invalidHeader, sizeof(invalidHeader)) == -1) {
-        WebCore::FileSystem::closeFile(temporaryFileHandle);
+    if (writeToFile(temporaryFileHandle, invalidHeader, sizeof(invalidHeader)) == -1) {
+        closeFile(temporaryFileHandle);
         return ContentRuleListStore::Error::CompileFailed;
     }
 
@@ -336,11 +337,11 @@
     CompilationClient compilationClient(temporaryFileHandle, metaData);
     
     if (auto compilerError = compileRuleList(compilationClient, WTFMove(json))) {
-        WebCore::FileSystem::closeFile(temporaryFileHandle);
+        closeFile(temporaryFileHandle);
         return compilerError;
     }
     if (compilationClient.hadErrorWhileWritingToFile()) {
-        WebCore::FileSystem::closeFile(temporaryFileHandle);
+        closeFile(temporaryFileHandle);
         return ContentRuleListStore::Error::CompileFailed;
     }
     
@@ -348,7 +349,7 @@
     if (mappedData.isNull())
         return ContentRuleListStore::Error::CompileFailed;
 
-    if (!WebCore::FileSystem::moveFile(temporaryFilePath, finalFilePath))
+    if (!moveFile(temporaryFilePath, finalFilePath))
         return ContentRuleListStore::Error::CompileFailed;
 
     return { };
@@ -412,12 +413,12 @@
 {
     m_readQueue->dispatch([protectedThis = makeRef(*this), storePath = m_storePath.isolatedCopy(), legacyFilename = m_legacyFilename, completionHandler = WTFMove(completionHandler)]() mutable {
 
-        Vector<String> fullPaths = WebCore::FileSystem::listDirectory(storePath, constructedPathFilter(legacyFilename));
+        Vector<String> fullPaths = listDirectory(storePath, constructedPathFilter(legacyFilename));
         Vector<String> identifiers;
         identifiers.reserveInitialCapacity(fullPaths.size());
         const auto prefixLength = constructedPathPrefix(legacyFilename).length();
         for (const auto& path : fullPaths)
-            identifiers.uncheckedAppend(WebCore::FileSystem::decodeFromFilename(path.substring(path.reverseFind('/') + 1 + prefixLength)));
+            identifiers.uncheckedAppend(decodeFromFilename(path.substring(path.reverseFind('/') + 1 + prefixLength)));
 
         RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler), identifiers = WTFMove(identifiers)]() mutable {
             completionHandler(WTFMove(identifiers));
@@ -454,7 +455,7 @@
     m_removeQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), legacyFilename = m_legacyFilename, completionHandler = WTFMove(completionHandler)]() mutable {
         auto path = constructedPath(storePath, identifier, legacyFilename);
 
-        if (!WebCore::FileSystem::deleteFile(path)) {
+        if (!deleteFile(path)) {
             RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] {
                 completionHandler(Error::RemoveFailed);
             });
@@ -469,19 +470,19 @@
 
 void ContentRuleListStore::synchronousRemoveAllContentRuleLists()
 {
-    for (const auto& path : WebCore::FileSystem::listDirectory(m_storePath, "*"))
-        WebCore::FileSystem::deleteFile(path);
+    for (const auto& path : listDirectory(m_storePath, "*"))
+        deleteFile(path);
 }
 
 void ContentRuleListStore::invalidateContentRuleListVersion(const WTF::String& identifier)
 {
-    auto file = WebCore::FileSystem::openFile(constructedPath(m_storePath, identifier, m_legacyFilename), WebCore::FileSystem::OpenForWrite);
-    if (file == WebCore::FileSystem::invalidPlatformFileHandle)
+    auto file = openFile(constructedPath(m_storePath, identifier, m_legacyFilename), FileOpenMode::OpenForWrite);
+    if (file == invalidPlatformFileHandle)
         return;
     ContentRuleListMetaData invalidHeader = {0, 0, 0, 0, 0, 0};
-    auto bytesWritten = WebCore::FileSystem::writeToFile(file, reinterpret_cast<const char*>(&invalidHeader), sizeof(invalidHeader));
+    auto bytesWritten = writeToFile(file, reinterpret_cast<const char*>(&invalidHeader), sizeof(invalidHeader));
     ASSERT_UNUSED(bytesWritten, bytesWritten == sizeof(invalidHeader));
-    WebCore::FileSystem::closeFile(file);
+    closeFile(file);
 }
 
 void ContentRuleListStore::getContentRuleListSource(const WTF::String& identifier, Function<void(WTF::String)> completionHandler)

Modified: trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp (224504 => 224505)


--- trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -55,7 +55,7 @@
 static std::unique_ptr<KeyedDecoder> createDecoderForFile(const String& path)
 {
     ASSERT(!RunLoop::isMain());
-    auto handle = FileSystem::openAndLockFile(path, FileSystem::OpenForRead);
+    auto handle = FileSystem::openAndLockFile(path, FileSystem::FileOpenMode::OpenForRead);
     if (handle == FileSystem::invalidPlatformFileHandle)
         return nullptr;
 
@@ -262,7 +262,7 @@
         excludeFromBackup();
     }
 
-    auto handle = FileSystem::openAndLockFile(resourceLogFilePath(), FileSystem::OpenForWrite);
+    auto handle = FileSystem::openAndLockFile(resourceLogFilePath(), FileSystem::FileOpenMode::OpenForWrite);
     if (handle == FileSystem::invalidPlatformFileHandle)
         return;
 

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (224504 => 224505)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2017-11-06 20:20:28 UTC (rev 224505)
@@ -1,3 +1,12 @@
+2017-11-06  Christopher Reid  <chris.r...@sony.com>
+
+        Use enum classes within FileSystem
+        https://bugs.webkit.org/show_bug.cgi?id=175172
+
+        Reviewed by Myles C. Maxfield.
+
+        * Plugins/PluginDatabase.cpp:
+
 2017-11-02  Maciej Stachowiak  <m...@apple.com>
 
         Don't try to guess plugin MIME type from a file extension in a URL (no observable effect)

Modified: trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp (224504 => 224505)


--- trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -480,7 +480,7 @@
 
     FileSystem::PlatformFileHandle file;
     String absoluteCachePath = FileSystem::pathByAppendingComponent(persistentMetadataCachePath(), persistentPluginMetadataCacheFilename);
-    file = FileSystem::openFile(absoluteCachePath, FileSystem::OpenForRead);
+    file = FileSystem::openFile(absoluteCachePath, FileSystem::FileOpenMode::OpenForRead);
 
     if (!FileSystem::isHandleValid(file))
         return;
@@ -566,7 +566,7 @@
         return;
 
     FileSystem::PlatformFileHandle file;
-    file = FileSystem::openFile(absoluteCachePath, FileSystem::OpenForWrite);
+    file = FileSystem::openFile(absoluteCachePath, FileSystem::FileOpenMode::OpenForWrite);
 
     if (!FileSystem::isHandleValid(file)) {
         LOG_ERROR("Unable to open plugin metadata cache for saving");

Modified: trunk/Tools/ChangeLog (224504 => 224505)


--- trunk/Tools/ChangeLog	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Tools/ChangeLog	2017-11-06 20:20:28 UTC (rev 224505)
@@ -1,3 +1,13 @@
+2017-11-06  Christopher Reid  <chris.r...@sony.com>
+
+        Use enum classes within FileSystem
+        https://bugs.webkit.org/show_bug.cgi?id=175172
+
+        Reviewed by Myles C. Maxfield.
+
+        * TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:
+        * TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm:
+
 2017-11-06  Michael Catanzaro  <mcatanz...@igalia.com>
 
         [WPE] -Wsign-compare warning in EventSenderProxyWPE.cpp

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp (224504 => 224505)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp	2017-11-06 20:20:28 UTC (rev 224505)
@@ -114,7 +114,7 @@
 {
     constexpr int bufferSize = 1024;
 
-    auto source = FileSystem::openFile(path, FileSystem::OpenForRead);
+    auto source = FileSystem::openFile(path, FileSystem::FileOpenMode::OpenForRead);
     if (!FileSystem::isHandleValid(source))
         return emptyString();
 
@@ -379,7 +379,7 @@
     testQueue->dispatch([this] () mutable {
         EXPECT_FALSE(FileSystem::fileExists(tempFilePath()));
 
-        auto handle = FileSystem::openFile(tempFilePath(), FileSystem::OpenForWrite);
+        auto handle = FileSystem::openFile(tempFilePath(), FileSystem::FileOpenMode::OpenForWrite);
         ASSERT_NE(handle, FileSystem::invalidPlatformFileHandle);
 
         int rc = FileSystem::writeToFile(handle, FileMonitorTestData.utf8().data(), FileMonitorTestData.length());

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm (224504 => 224505)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm	2017-11-06 20:03:02 UTC (rev 224504)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm	2017-11-06 20:20:28 UTC (rev 224505)
@@ -87,7 +87,7 @@
 
 static void createFileAtPath(const String& path)
 {
-    FileSystem::PlatformFileHandle fileHandle = FileSystem::openFile(path, FileSystem::OpenForWrite);
+    FileSystem::PlatformFileHandle fileHandle = FileSystem::openFile(path, FileSystem::FileOpenMode::OpenForWrite);
     EXPECT_NE(-1, fileHandle);
     FileSystem::closeFile(fileHandle);
     EXPECT_TRUE(FileSystem::fileExists(path));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to