Title: [224635] trunk
Revision
224635
Author
commit-qu...@webkit.org
Date
2017-11-09 10:33:34 -0800 (Thu, 09 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-09
Reviewed by Darin Adler.

Source/WebCore:

No new tests, no change in behavior.

Further cleanup to FileSystem's enum classes.
Shortening FileSystem's enum names now that they are enum classes.
Adding OptionSet<FileLockMode> to functions using the FileLockMode enum.

* 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:

Tools:

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224634 => 224635)


--- trunk/Source/WebCore/ChangeLog	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/ChangeLog	2017-11-09 18:33:34 UTC (rev 224635)
@@ -1,3 +1,30 @@
+2017-11-09  Christopher Reid  <chris.r...@sony.com>
+
+        Use enum classes within FileSystem
+        https://bugs.webkit.org/show_bug.cgi?id=175172
+
+        Reviewed by Darin Adler.
+
+        No new tests, no change in behavior.
+
+        Further cleanup to FileSystem's enum classes.
+        Shortening FileSystem's enum names now that they are enum classes.
+        Adding OptionSet<FileLockMode> to functions using the FileLockMode enum.
+
+        * 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-09  Zalan Bujtas  <za...@apple.com>
 
         [LayoutState cleanup] LayouState::m_lineGrid should be a weak pointer

Modified: trunk/Source/WebCore/Modules/webdatabase/OriginLock.cpp (224634 => 224635)


--- trunk/Source/WebCore/Modules/webdatabase/OriginLock.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/Modules/webdatabase/OriginLock.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -50,7 +50,7 @@
     m_mutex.lock();
 
 #if USE(FILE_LOCK)
-    m_lockHandle = FileSystem::openAndLockFile(m_lockFileName, FileSystem::FileOpenMode::OpenForWrite);
+    m_lockHandle = FileSystem::openAndLockFile(m_lockFileName, FileSystem::FileOpenMode::Write);
     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 (224634 => 224635)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -1304,7 +1304,7 @@
         fullPath = FileSystem::pathByAppendingComponent(directory, path);
     } while (FileSystem::directoryName(fullPath) != directory || FileSystem::fileExists(fullPath));
     
-    FileSystem::PlatformFileHandle handle = FileSystem::openFile(fullPath, FileSystem::FileOpenMode::OpenForWrite);
+    FileSystem::PlatformFileHandle handle = FileSystem::openFile(fullPath, FileSystem::FileOpenMode::Write);
     if (!handle)
         return false;
     

Modified: trunk/Source/WebCore/platform/FileHandle.h (224634 => 224635)


--- trunk/Source/WebCore/platform/FileHandle.h	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/platform/FileHandle.h	2017-11-09 18:33:34 UTC (rev 224635)
@@ -57,7 +57,7 @@
 
 private:
     String m_path;
-    FileSystem::FileOpenMode m_mode { FileSystem::FileOpenMode::OpenForRead };
+    FileSystem::FileOpenMode m_mode { FileSystem::FileOpenMode::Read };
     FileSystem::PlatformFileHandle m_fileHandle { FileSystem::invalidPlatformFileHandle };
 };
 

Modified: trunk/Source/WebCore/platform/FileStream.cpp (224634 => 224635)


--- trunk/Source/WebCore/platform/FileStream.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/platform/FileStream.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -74,13 +74,13 @@
         return true;
 
     // Open the file.
-    m_handle = FileSystem::openFile(path, FileSystem::FileOpenMode::OpenForRead);
+    m_handle = FileSystem::openFile(path, FileSystem::FileOpenMode::Read);
     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::FileSeekOrigin::SeekFromBeginning) < 0)
+        if (FileSystem::seekFile(m_handle, offset, FileSystem::FileSeekOrigin::Beginning) < 0)
             return false;
     }
 

Modified: trunk/Source/WebCore/platform/FileSystem.cpp (224634 => 224635)


--- trunk/Source/WebCore/platform/FileSystem.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/platform/FileSystem.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -207,7 +207,7 @@
 
 bool appendFileContentsToFileHandle(const String& path, PlatformFileHandle& target)
 {
-    auto source = openFile(path, FileOpenMode::OpenForRead);
+    auto source = openFile(path, FileOpenMode::Read);
 
     if (!isHandleValid(source))
         return false;
@@ -330,7 +330,7 @@
 #endif
 }
 
-PlatformFileHandle openAndLockFile(const String& path, FileOpenMode openMode, FileLockMode lockMode)
+PlatformFileHandle openAndLockFile(const String& path, FileOpenMode openMode, OptionSet<FileLockMode> lockMode)
 {
     auto handle = openFile(path, openMode);
     if (handle == invalidPlatformFileHandle)

Modified: trunk/Source/WebCore/platform/FileSystem.h (224634 => 224635)


--- trunk/Source/WebCore/platform/FileSystem.h	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/platform/FileSystem.h	2017-11-09 18:33:34 UTC (rev 224635)
@@ -33,6 +33,7 @@
 #include <time.h>
 #include <utility>
 #include <wtf/Forward.h>
+#include <wtf/OptionSet.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
@@ -75,23 +76,23 @@
 #endif
 
 enum class FileOpenMode {
-    OpenForRead = 0,
-    OpenForWrite,
+    Read,
+    Write,
 #if OS(DARWIN)
-    OpenForEventsOnly
+    EventsOnly,
 #endif
 };
 
 enum class FileSeekOrigin {
-    SeekFromBeginning = 0,
-    SeekFromCurrent,
-    SeekFromEnd
+    Beginning,
+    Current,
+    End,
 };
 
 enum class FileLockMode {
-    LockShared = 1,
-    LockExclusive = 2,
-    LockNonBlocking = 4
+    Shared = 1 << 0,
+    Exclusive = 1 << 1,
+    Nonblocking = 1 << 2,
 };
 
 enum class ShouldFollowSymbolicLinks { No, Yes };
@@ -145,7 +146,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 = FileLockMode::LockExclusive);
+WEBCORE_EXPORT PlatformFileHandle openAndLockFile(const String&, FileOpenMode, OptionSet<FileLockMode> = FileLockMode::Exclusive);
 WEBCORE_EXPORT void unlockAndCloseFile(PlatformFileHandle);
 
 // Appends the contents of the file found at 'path' to the open PlatformFileHandle.
@@ -156,7 +157,7 @@
 bool hardLinkOrCopyFile(const String& source, const String& destination);
 
 #if USE(FILE_LOCK)
-WEBCORE_EXPORT bool lockFile(PlatformFileHandle, FileLockMode);
+WEBCORE_EXPORT bool lockFile(PlatformFileHandle, OptionSet<FileLockMode>);
 WEBCORE_EXPORT bool unlockFile(PlatformFileHandle);
 #endif
 

Modified: trunk/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm (224634 => 224635)


--- trunk/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm	2017-11-09 18:33:34 UTC (rev 224635)
@@ -43,7 +43,7 @@
     if (!modificationHandler)
         return;
 
-    auto handle = FileSystem::openFile(path, FileSystem::FileOpenMode::OpenForEventsOnly);
+    auto handle = FileSystem::openFile(path, FileSystem::FileOpenMode::EventsOnly);
     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 (224634 => 224635)


--- trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -363,9 +363,9 @@
 
     GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(filename.get()));
     GFileIOStream* ioStream = 0;
-    if (mode == FileOpenMode::OpenForRead)
+    if (mode == FileOpenMode::Read)
         ioStream = g_file_open_readwrite(file.get(), 0, 0);
-    else if (mode == FileOpenMode::OpenForWrite) {
+    else if (mode == FileOpenMode::Write) {
         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
@@ -389,13 +389,13 @@
 {
     GSeekType seekType = G_SEEK_SET;
     switch (origin) {
-    case FileSeekOrigin::SeekFromBeginning:
+    case FileSeekOrigin::Beginning:
         seekType = G_SEEK_SET;
         break;
-    case FileSeekOrigin::SeekFromCurrent:
+    case FileSeekOrigin::Current:
         seekType = G_SEEK_CUR;
         break;
-    case FileSeekOrigin::SeekFromEnd:
+    case FileSeekOrigin::End:
         seekType = G_SEEK_END;
         break;
     default:
@@ -481,13 +481,13 @@
 }
 
 #if USE(FILE_LOCK)
-bool lockFile(PlatformFileHandle handle, FileLockMode lockMode)
+bool lockFile(PlatformFileHandle handle, OptionSet<FileLockMode> 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);
+    COMPILE_ASSERT(LOCK_SH == WTF::enumToUnderlyingType(FileLockMode::Shared), LockSharedEncodingIsAsExpected);
+    COMPILE_ASSERT(LOCK_EX == WTF::enumToUnderlyingType(FileLockMode::Exclusive), LockExclusiveEncodingIsAsExpected);
+    COMPILE_ASSERT(LOCK_NB == WTF::enumToUnderlyingType(FileLockMode::Nonblocking), 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)), WTF::enumToUnderlyingType(lockMode));
+    int result = flock(g_file_descriptor_based_get_fd(G_FILE_DESCRIPTOR_BASED(inputStream)), lockMode.toRaw());
     return result != -1;
 }
 

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


--- trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -125,7 +125,7 @@
 
 bool CurlCacheEntry::saveResponseHeaders(const ResourceResponse& response)
 {
-    FileSystem::PlatformFileHandle headerFile = FileSystem::openFile(m_headerFilename, FileSystem::FileOpenMode::OpenForWrite);
+    FileSystem::PlatformFileHandle headerFile = FileSystem::openFile(m_headerFilename, FileSystem::FileOpenMode::Write);
     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::FileOpenMode::OpenForRead);
+    FileSystem::PlatformFileHandle inputFile = FileSystem::openFile(filepath, FileSystem::FileOpenMode::Read);
     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::FileOpenMode::OpenForWrite);
+    m_contentFile = FileSystem::openFile(m_contentFilename, FileSystem::FileOpenMode::Write);
 
     if (FileSystem::isHandleValid(m_contentFile))
         return true;

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


--- trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -103,7 +103,7 @@
     String indexFilePath(m_cacheDir);
     indexFilePath.append("index.dat");
 
-    FileSystem::PlatformFileHandle indexFile = FileSystem::openFile(indexFilePath, FileSystem::FileOpenMode::OpenForRead);
+    FileSystem::PlatformFileHandle indexFile = FileSystem::openFile(indexFilePath, FileSystem::FileOpenMode::Read);
     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::FileOpenMode::OpenForWrite);
+    FileSystem::PlatformFileHandle indexFile = FileSystem::openFile(indexFilePath, FileSystem::FileOpenMode::Write);
     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 (224634 => 224635)


--- trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -83,12 +83,12 @@
         return invalidPlatformFileHandle;
 
     int platformFlag = 0;
-    if (mode == FileOpenMode::OpenForRead)
+    if (mode == FileOpenMode::Read)
         platformFlag |= O_RDONLY;
-    else if (mode == FileOpenMode::OpenForWrite)
+    else if (mode == FileOpenMode::Write)
         platformFlag |= (O_WRONLY | O_CREAT | O_TRUNC);
 #if OS(DARWIN)
-    else if (mode == FileOpenMode::OpenForEventsOnly)
+    else if (mode == FileOpenMode::EventsOnly)
         platformFlag |= O_EVTONLY;
 #endif
 
@@ -107,13 +107,13 @@
 {
     int whence = SEEK_SET;
     switch (origin) {
-    case FileSeekOrigin::SeekFromBeginning:
+    case FileSeekOrigin::Beginning:
         whence = SEEK_SET;
         break;
-    case FileSeekOrigin::SeekFromCurrent:
+    case FileSeekOrigin::Current:
         whence = SEEK_CUR;
         break;
-    case FileSeekOrigin::SeekFromEnd:
+    case FileSeekOrigin::End:
         whence = SEEK_END;
         break;
     default:
@@ -149,12 +149,12 @@
 }
 
 #if USE(FILE_LOCK)
-bool lockFile(PlatformFileHandle handle, FileLockMode lockMode)
+bool lockFile(PlatformFileHandle handle, OptionSet<FileLockMode> 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));
+    COMPILE_ASSERT(LOCK_SH == WTF::enumToUnderlyingType(FileLockMode::Shared), LockSharedEncodingIsAsExpected);
+    COMPILE_ASSERT(LOCK_EX == WTF::enumToUnderlyingType(FileLockMode::Exclusive), LockExclusiveEncodingIsAsExpected);
+    COMPILE_ASSERT(LOCK_NB == WTF::enumToUnderlyingType(FileLockMode::Nonblocking), LockNonblockingEncodingIsAsExpected);
+    int result = flock(handle, lockMode.toRaw());
     return (result != -1);
 }
 

Modified: trunk/Source/WebCore/platform/win/FileSystemWin.cpp (224634 => 224635)


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

Modified: trunk/Source/WebCore/rendering/RenderThemeWin.cpp (224634 => 224635)


--- trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -1058,7 +1058,7 @@
     if (!CFURLGetFileSystemRepresentation(requestedURLRef.get(), false, requestedFilePath, MAX_PATH))
         return String();
 
-    FileSystem::PlatformFileHandle requestedFileHandle = FileSystem::openFile(requestedFilePath, FileSystem::FileOpenMode::OpenForRead);
+    FileSystem::PlatformFileHandle requestedFileHandle = FileSystem::openFile(requestedFilePath, FileSystem::FileOpenMode::Read);
     if (!FileSystem::isHandleValid(requestedFileHandle))
         return String();
 

Modified: trunk/Source/WebKit/ChangeLog (224634 => 224635)


--- trunk/Source/WebKit/ChangeLog	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebKit/ChangeLog	2017-11-09 18:33:34 UTC (rev 224635)
@@ -1,3 +1,19 @@
+2017-11-09  Christopher Reid  <chris.r...@sony.com>
+
+        Use enum classes within FileSystem
+        https://bugs.webkit.org/show_bug.cgi?id=175172
+
+        Reviewed by Darin Adler.
+
+        * 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-09  Youenn Fablet  <you...@apple.com>
 
         ServiceWorkerClientFetch should create not null ResourceError

Modified: trunk/Source/WebKit/NetworkProcess/Downloads/BlobDownloadClient.cpp (224634 => 224635)


--- trunk/Source/WebKit/NetworkProcess/Downloads/BlobDownloadClient.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebKit/NetworkProcess/Downloads/BlobDownloadClient.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -66,7 +66,7 @@
     }
 
     m_destinationPath = destinationPath;
-    m_destinationFile = FileSystem::openFile(m_destinationPath, FileSystem::FileOpenMode::OpenForWrite);
+    m_destinationFile = FileSystem::openFile(m_destinationPath, FileSystem::FileOpenMode::Write);
     m_download.didCreateDestination(m_destinationPath);
 
     m_download.continueDidReceiveResponse();

Modified: trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp (224634 => 224635)


--- trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -467,7 +467,7 @@
 
     LOG(NetworkSession, "%p - NetworkDataTaskBlob::download to %s", this, m_pendingDownloadLocation.utf8().data());
 
-    m_downloadFile = FileSystem::openFile(m_pendingDownloadLocation, FileSystem::FileOpenMode::OpenForWrite);
+    m_downloadFile = FileSystem::openFile(m_pendingDownloadLocation, FileSystem::FileOpenMode::Write);
     if (m_downloadFile == FileSystem::invalidPlatformFileHandle) {
         didFailDownload(cancelledError(m_firstRequest));
         return;

Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp (224634 => 224635)


--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -543,7 +543,7 @@
 
 void Cache::dumpContentsToFile()
 {
-    auto fd = openFile(dumpFilePath(), FileOpenMode::OpenForWrite);
+    auto fd = openFile(dumpFilePath(), FileOpenMode::Write);
     if (!isHandleValid(fd))
         return;
     auto prologue = String("{\n\"entries\": [\n").utf8();

Modified: trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureManager.cpp (224634 => 224635)


--- trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureManager.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureManager.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -79,11 +79,11 @@
     DEBUG_LOG("Cache location = " STRING_SPECIFIER, DEBUG_STR(m_recordReplayCacheLocation));
 
     if (isRecording()) {
-        m_recordFileHandle = WebCore::FileHandle(reportRecordPath(), FileOpenMode::OpenForWrite);
+        m_recordFileHandle = WebCore::FileHandle(reportRecordPath(), FileOpenMode::Write);
     } else if (isReplaying()) {
-        m_recordFileHandle = WebCore::FileHandle(reportRecordPath(), FileOpenMode::OpenForRead);
-        m_loadFileHandle = WebCore::FileHandle(reportLoadPath(), FileOpenMode::OpenForWrite);
-        m_replayFileHandle = WebCore::FileHandle(reportReplayPath(), FileOpenMode::OpenForWrite);
+        m_recordFileHandle = WebCore::FileHandle(reportRecordPath(), FileOpenMode::Read);
+        m_loadFileHandle = WebCore::FileHandle(reportLoadPath(), FileOpenMode::Write);
+        m_replayFileHandle = WebCore::FileHandle(reportReplayPath(), FileOpenMode::Write);
         loadResources();
     }
 }
@@ -466,7 +466,7 @@
     // If we're opening the file for writing (including appending), then try
     // again after making sure all intermediate directories have been created.
 
-    if (mode != FileOpenMode::OpenForRead) {
+    if (mode != FileOpenMode::Read) {
         const auto& parentDir = directoryName(filePath);
         if (!makeAllDirectories(parentDir)) {
             DEBUG_LOG_ERROR("Error %d trying to create intermediate directories: " STRING_SPECIFIER, errno, DEBUG_STR(parentDir));
@@ -481,7 +481,7 @@
     // Could not open the file. Log the error and leave, returning the invalid
     // file handle.
 
-    if (mode == FileOpenMode::OpenForRead)
+    if (mode == FileOpenMode::Read)
         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));

Modified: trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureRecorder.cpp (224634 => 224635)


--- trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureRecorder.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebKit/NetworkProcess/capture/NetworkCaptureRecorder.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -131,7 +131,7 @@
 void Recorder::writeEvents()
 {
     auto path = Manager::singleton().requestToPath(m_initialRequest);
-    auto handle = Manager::singleton().openCacheFile(path, WebCore::FileSystem::FileOpenMode::OpenForWrite);
+    auto handle = Manager::singleton().openCacheFile(path, WebCore::FileSystem::FileOpenMode::Write);
     if (!handle)
         return;
 

Modified: trunk/Source/WebKit/Shared/WebMemorySampler.cpp (224634 => 224635)


--- trunk/Source/WebKit/Shared/WebMemorySampler.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebKit/Shared/WebMemorySampler.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -137,7 +137,7 @@
     if (m_sampleLogSandboxExtension)
         m_sampleLogSandboxExtension->consume();
     m_sampleLogFilePath = sampleLogFilePath;
-    m_sampleLogFile = FileSystem::openFile(m_sampleLogFilePath, FileSystem::FileOpenMode::OpenForWrite);
+    m_sampleLogFile = FileSystem::openFile(m_sampleLogFilePath, FileSystem::FileOpenMode::Write);
     writeHeaders();
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp (224634 => 224635)


--- trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -288,7 +288,7 @@
             m_metaData.conditionsApplyOnlyToDomain = m_conditionsApplyOnlyToDomain;
             
             Data header = encodeContentRuleListMetaData(m_metaData);
-            if (!m_fileError && seekFile(m_fileHandle, 0ll, FileSeekOrigin::SeekFromBeginning) == -1) {
+            if (!m_fileError && seekFile(m_fileHandle, 0ll, FileSeekOrigin::Beginning) == -1) {
                 closeFile(m_fileHandle);
                 m_fileError = true;
             }
@@ -476,7 +476,7 @@
 
 void ContentRuleListStore::invalidateContentRuleListVersion(const WTF::String& identifier)
 {
-    auto file = openFile(constructedPath(m_storePath, identifier, m_legacyFilename), FileOpenMode::OpenForWrite);
+    auto file = openFile(constructedPath(m_storePath, identifier, m_legacyFilename), FileOpenMode::Write);
     if (file == invalidPlatformFileHandle)
         return;
     ContentRuleListMetaData invalidHeader = {0, 0, 0, 0, 0, 0};

Modified: trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp (224634 => 224635)


--- trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -55,7 +55,7 @@
 static std::unique_ptr<KeyedDecoder> createDecoderForFile(const String& path)
 {
     ASSERT(!RunLoop::isMain());
-    auto handle = FileSystem::openAndLockFile(path, FileSystem::FileOpenMode::OpenForRead);
+    auto handle = FileSystem::openAndLockFile(path, FileSystem::FileOpenMode::Read);
     if (handle == FileSystem::invalidPlatformFileHandle)
         return nullptr;
 
@@ -262,7 +262,7 @@
         excludeFromBackup();
     }
 
-    auto handle = FileSystem::openAndLockFile(resourceLogFilePath(), FileSystem::FileOpenMode::OpenForWrite);
+    auto handle = FileSystem::openAndLockFile(resourceLogFilePath(), FileSystem::FileOpenMode::Write);
     if (handle == FileSystem::invalidPlatformFileHandle)
         return;
 

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (224634 => 224635)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2017-11-09 18:33:34 UTC (rev 224635)
@@ -1,3 +1,12 @@
+2017-11-09  Christopher Reid  <chris.r...@sony.com>
+
+        Use enum classes within FileSystem
+        https://bugs.webkit.org/show_bug.cgi?id=175172
+
+        Reviewed by Darin Adler.
+
+        * Plugins/PluginDatabase.cpp:
+
 2017-11-06  Per Arne Vollan  <pvol...@apple.com>
 
         [Win] Add WebKitQuartzCoreAdditions library.

Modified: trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp (224634 => 224635)


--- trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -480,7 +480,7 @@
 
     FileSystem::PlatformFileHandle file;
     String absoluteCachePath = FileSystem::pathByAppendingComponent(persistentMetadataCachePath(), persistentPluginMetadataCacheFilename);
-    file = FileSystem::openFile(absoluteCachePath, FileSystem::FileOpenMode::OpenForRead);
+    file = FileSystem::openFile(absoluteCachePath, FileSystem::FileOpenMode::Read);
 
     if (!FileSystem::isHandleValid(file))
         return;
@@ -566,7 +566,7 @@
         return;
 
     FileSystem::PlatformFileHandle file;
-    file = FileSystem::openFile(absoluteCachePath, FileSystem::FileOpenMode::OpenForWrite);
+    file = FileSystem::openFile(absoluteCachePath, FileSystem::FileOpenMode::Write);
 
     if (!FileSystem::isHandleValid(file)) {
         LOG_ERROR("Unable to open plugin metadata cache for saving");

Modified: trunk/Tools/ChangeLog (224634 => 224635)


--- trunk/Tools/ChangeLog	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Tools/ChangeLog	2017-11-09 18:33:34 UTC (rev 224635)
@@ -1,3 +1,13 @@
+2017-11-09  Christopher Reid  <chris.r...@sony.com>
+
+        Use enum classes within FileSystem
+        https://bugs.webkit.org/show_bug.cgi?id=175172
+
+        Reviewed by Darin Adler.
+
+        * TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:
+        * TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm:
+
 2017-11-09  Brent Fulgham  <bfulg...@apple.com>
 
         Test fix after r224609

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp (224634 => 224635)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp	2017-11-09 18:33:34 UTC (rev 224635)
@@ -114,7 +114,7 @@
 {
     constexpr int bufferSize = 1024;
 
-    auto source = FileSystem::openFile(path, FileSystem::FileOpenMode::OpenForRead);
+    auto source = FileSystem::openFile(path, FileSystem::FileOpenMode::Read);
     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::FileOpenMode::OpenForWrite);
+        auto handle = FileSystem::openFile(tempFilePath(), FileSystem::FileOpenMode::Write);
         ASSERT_NE(handle, FileSystem::invalidPlatformFileHandle);
 
         int rc = FileSystem::writeToFile(handle, FileMonitorTestData.utf8().data(), FileMonitorTestData.length());

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


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm	2017-11-09 18:32:26 UTC (rev 224634)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm	2017-11-09 18:33:34 UTC (rev 224635)
@@ -87,7 +87,7 @@
 
 static void createFileAtPath(const String& path)
 {
-    FileSystem::PlatformFileHandle fileHandle = FileSystem::openFile(path, FileSystem::FileOpenMode::OpenForWrite);
+    FileSystem::PlatformFileHandle fileHandle = FileSystem::openFile(path, FileSystem::FileOpenMode::Write);
     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