WebKit Bugzilla
Attachment 359827 Details for
Bug 193602
: Move FileSystem to WTF
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193602-20190122180305.patch (text/plain), 427.03 KB, created by
Ross Kirsling
on 2019-01-22 18:03:06 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Ross Kirsling
Created:
2019-01-22 18:03:06 PST
Size:
427.03 KB
patch
obsolete
>Subversion Revision: 240311 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 17b2f9dfcaf4360bf9fe246d48fadbcf522a50f7..9e8796c40d4ddc4601e2eb4875d5ce07e51118f6 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,30 @@ >+2019-01-22 Ross Kirsling <ross.kirsling@sony.com> >+ >+ Move FileSystem to WTF >+ https://bugs.webkit.org/show_bug.cgi?id=193602 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WTF.xcodeproj/project.pbxproj: >+ * wtf/CMakeLists.txt: >+ * wtf/FileMetadata.h: Renamed from Source/WebCore/platform/FileMetadata.h. >+ * wtf/FileSystem.cpp: Renamed from Source/WebCore/platform/FileSystem.cpp. >+ * wtf/FileSystem.h: Renamed from Source/WebCore/platform/FileSystem.h. >+ * wtf/PlatformGTK.cmake: >+ * wtf/PlatformMac.cmake: >+ * wtf/PlatformPlayStation.cmake: >+ * wtf/PlatformWPE.cmake: >+ * wtf/PlatformWin.cmake: >+ * wtf/cf/FileSystemCF.cpp: Renamed from Source/WebCore/platform/cf/FileSystemCF.cpp. >+ * wtf/cocoa/FileSystemCocoa.mm: Renamed from Source/WebCore/platform/cocoa/FileSystemCocoa.mm. >+ * wtf/glib/FileSystemGlib.cpp: Renamed from Source/WebCore/platform/glib/FileSystemGlib.cpp. >+ * wtf/mac/FileSystemMac.mm: Renamed from Source/WebCore/platform/mac/FileSystemMac.mm. >+ * wtf/posix/FileSystemPOSIX.cpp: Renamed from Source/WebCore/platform/posix/FileSystemPOSIX.cpp. >+ * wtf/spi/mac/MetadataSPI.h: Renamed from Source/WebCore/PAL/pal/spi/mac/MetadataSPI.h. >+ * wtf/win/FileSystemWin.cpp: Renamed from Source/WebCore/platform/win/FileSystemWin.cpp. >+ * wtf/win/PathWalker.cpp: Renamed from Source/WebCore/platform/win/PathWalker.cpp. >+ * wtf/win/PathWalker.h: Renamed from Source/WebCore/platform/win/PathWalker.h. >+ > 2019-01-22 Tadeu Zagallo <tzagallo@apple.com> > > Cache bytecode to disk >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2a25fc98f233c5b33e65478dceb80125c5fbe45a..7d9d0f020d1aa90e3b3bb84272da23ad03c6f168 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,81 @@ >+2019-01-22 Ross Kirsling <ross.kirsling@sony.com> >+ >+ Move FileSystem to WTF >+ https://bugs.webkit.org/show_bug.cgi?id=193602 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Modules/encryptedmedia/CDM.cpp: >+ * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: >+ * Modules/entriesapi/DOMFileSystem.cpp: >+ * Modules/entriesapi/FileSystemEntry.cpp: >+ * Modules/indexeddb/IDBDatabaseIdentifier.cpp: >+ * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: >+ * Modules/indexeddb/server/SQLiteIDBTransaction.cpp: >+ * Modules/indexeddb/shared/InProcessIDBServer.cpp: >+ * Modules/webdatabase/DatabaseTracker.cpp: >+ * Modules/webdatabase/OriginLock.cpp: >+ * Modules/webdatabase/OriginLock.h: >+ * Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm: >+ * PlatformMac.cmake: >+ * PlatformPlayStation.cmake: >+ * PlatformWin.cmake: >+ * Sources.txt: >+ * SourcesCocoa.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * bindings/js/GCController.cpp: >+ * dom/DataTransferItem.cpp: >+ * editing/cocoa/WebContentReaderCocoa.mm: >+ * fileapi/File.cpp: >+ * fileapi/FileCocoa.mm: >+ * html/FileInputType.cpp: >+ * html/FileListCreator.cpp: >+ * loader/appcache/ApplicationCacheHost.cpp: >+ * loader/appcache/ApplicationCacheStorage.cpp: >+ * page/Page.cpp: >+ * page/SecurityOrigin.cpp: >+ * page/SecurityOriginData.cpp: >+ * platform/FileHandle.h: >+ * platform/FileStream.cpp: >+ * platform/FileStream.h: >+ * platform/SharedBuffer.h: >+ * platform/SourcesGLib.txt: >+ * platform/cocoa/FileMonitorCocoa.mm: >+ * platform/glib/FileMonitorGLib.cpp: >+ * platform/glib/SharedBufferGlib.cpp: >+ * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: >+ * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: >+ * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm: >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: >+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: >+ * platform/ios/QuickLook.mm: >+ * platform/ios/WebItemProviderPasteboard.mm: >+ * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: >+ * platform/network/BlobDataFileReference.cpp: >+ * platform/network/BlobRegistryImpl.cpp: >+ * platform/network/BlobResourceHandle.cpp: >+ * platform/network/FormData.cpp: >+ * platform/network/cf/FormDataStreamCFNet.cpp: >+ * platform/network/cocoa/ResourceRequestCocoa.mm: >+ * platform/network/curl/CookieJarDB.cpp: >+ * platform/network/curl/CurlCacheEntry.h: >+ * platform/network/curl/CurlCacheManager.cpp: >+ * platform/network/curl/CurlFormDataStream.h: >+ * platform/network/curl/CurlRequest.h: >+ * platform/network/curl/NetworkStorageSessionCurl.cpp: >+ * platform/network/curl/ResourceHandleCurl.cpp: >+ * platform/network/mac/BlobDataFileReferenceMac.mm: >+ * platform/network/soup/ResourceHandleSoup.cpp: >+ * platform/network/soup/SoupNetworkSession.cpp: >+ * platform/posix/SharedBufferPOSIX.cpp: >+ * platform/sql/SQLiteFileSystem.cpp: >+ * platform/text/hyphen/HyphenationLibHyphen.cpp: >+ * platform/win/SearchPopupMenuDB.cpp: >+ * rendering/RenderTheme.cpp: >+ * rendering/RenderThemeGtk.cpp: >+ * rendering/RenderThemeWin.cpp: >+ * workers/service/server/RegistrationDatabase.cpp: >+ > 2019-01-22 Michael Catanzaro <mcatanzaro@igalia.com> > > Unreviewed, fix -Wsign-compare warning >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index 39d84cfb72b4e425bd973c97b46889af5aad5925..41a5fd8fdf841d37a199974a5fc231b097e86dc1 100644 >--- a/Source/WebCore/PAL/ChangeLog >+++ b/Source/WebCore/PAL/ChangeLog >@@ -1,3 +1,13 @@ >+2019-01-22 Ross Kirsling <ross.kirsling@sony.com> >+ >+ Move FileSystem to WTF >+ https://bugs.webkit.org/show_bug.cgi?id=193602 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * PAL.xcodeproj/project.pbxproj: >+ * pal/PlatformMac.cmake: >+ > 2019-01-22 David Kilzer <ddkilzer@apple.com> > > Switch remaining QuickLook soft-linking in WebCore, WebKit over to QuickLookSoftLink.{cpp,h} >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index f884697e615410ce9bf930f1392302421e4d6d4d..5d359da67c5e3da7803085718344ef131a918a42 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,82 @@ >+2019-01-22 Ross Kirsling <ross.kirsling@sony.com> >+ >+ Move FileSystem to WTF >+ https://bugs.webkit.org/show_bug.cgi?id=193602 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp: >+ * NetworkProcess/NetworkDataTaskBlob.h: >+ * NetworkProcess/NetworkProcess.cpp: >+ * NetworkProcess/cache/CacheStorageEngine.cpp: >+ * NetworkProcess/cache/CacheStorageEngineCaches.cpp: >+ * NetworkProcess/cache/NetworkCache.cpp: >+ * NetworkProcess/cache/NetworkCacheBlobStorage.cpp: >+ * NetworkProcess/cache/NetworkCacheData.cpp: >+ * NetworkProcess/cache/NetworkCacheFileSystem.cpp: >+ * NetworkProcess/cache/NetworkCacheFileSystem.h: >+ * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm: >+ * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp: >+ * NetworkProcess/cache/NetworkCacheStatistics.cpp: >+ * NetworkProcess/cache/NetworkCacheStorage.cpp: >+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: >+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm: >+ * NetworkProcess/mac/NetworkProcessMac.mm: >+ * NetworkProcess/soup/NetworkProcessSoup.cpp: >+ * PluginProcess/unix/PluginProcessMainUnix.cpp: >+ * Shared/PersistencyUtils.cpp: >+ * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp: >+ * Shared/Plugins/unix/PluginSearchPath.cpp: >+ * Shared/WebMemorySampler.h: >+ * Shared/glib/ProcessExecutablePathGLib.cpp: >+ * Shared/ios/ChildProcessIOS.mm: >+ * Shared/mac/ChildProcessMac.mm: >+ * Shared/mac/SandboxExtensionMac.mm: >+ * UIProcess/API/APIContentRuleListStore.cpp: >+ * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm: >+ * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp: >+ * UIProcess/API/glib/IconDatabase.cpp: >+ * UIProcess/API/glib/WebKitFaviconDatabase.cpp: >+ * UIProcess/API/glib/WebKitFileChooserRequest.cpp: >+ * UIProcess/API/glib/WebKitWebContext.cpp: >+ * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: >+ * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: >+ * UIProcess/Automation/WebAutomationSession.cpp: >+ * UIProcess/Cocoa/DownloadClient.mm: >+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm: >+ * UIProcess/Cocoa/WebViewImpl.mm: >+ * UIProcess/DeviceIdHashSaltStorage.cpp: >+ * UIProcess/Downloads/DownloadProxy.cpp: >+ * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: >+ * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: >+ * UIProcess/Plugins/gtk/PluginInfoCache.cpp: >+ * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: >+ * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp: >+ * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp: >+ * UIProcess/ServiceWorkerProcessProxy.cpp: >+ * UIProcess/WebStorage/LocalStorageDatabase.cpp: >+ * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp: >+ * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: >+ * UIProcess/WebsiteData/WebsiteDataStore.cpp: >+ * UIProcess/glib/WebProcessProxyGLib.cpp: >+ * UIProcess/gtk/WebInspectorProxyGtk.cpp: >+ * UIProcess/gtk/WebProcessPoolGtk.cpp: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ * UIProcess/ios/forms/WKFileUploadPanel.mm: >+ * UIProcess/mac/WebPageProxyMac.mm: >+ * UIProcess/win/WebProcessPoolWin.cpp: >+ * UIProcess/win/WebView.cpp: >+ * UIProcess/wpe/WebProcessPoolWPE.cpp: >+ * WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp: >+ * WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp: >+ * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: >+ * WebProcess/Plugins/Netscape/NetscapePluginStream.h: >+ * WebProcess/Plugins/PluginProcessConnection.cpp: >+ * WebProcess/WebCoreSupport/SessionStateConversion.cpp: >+ * WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp: >+ * WebProcess/WebPage/win/WebInspectorUIWin.cpp: >+ * WebProcess/cocoa/WebProcessCocoa.mm: >+ > 2019-01-22 Alex Christensen <achristensen@webkit.org> > > Fix an internal build failure after r240292 >diff --git a/Source/WebKitLegacy/ChangeLog b/Source/WebKitLegacy/ChangeLog >index 87fe8c3a8c616a0475d4af374694d426ec6fef84..55164a198494e60e5e73ea1a09ab969184f7f656 100644 >--- a/Source/WebKitLegacy/ChangeLog >+++ b/Source/WebKitLegacy/ChangeLog >@@ -1,3 +1,14 @@ >+2019-01-22 Ross Kirsling <ross.kirsling@sony.com> >+ >+ Move FileSystem to WTF >+ https://bugs.webkit.org/show_bug.cgi?id=193602 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Storage/StorageAreaSync.cpp: >+ * Storage/StorageSyncManager.cpp: >+ * Storage/StorageTracker.cpp: >+ > 2019-01-22 Alex Christensen <achristensen@webkit.org> > > Fix some builds after r240292 >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index c07f40f2bab5d891fff387682a54aa719957d225..4648db094150771a6555f2730296968795d68006 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,14 @@ >+2019-01-22 Ross Kirsling <ross.kirsling@sony.com> >+ >+ Move FileSystem to WTF >+ https://bugs.webkit.org/show_bug.cgi?id=193602 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Misc/WebNSFileManagerExtras.mm: >+ * Storage/WebDatabaseProvider.mm: >+ * WebView/WebView.mm: >+ > 2019-01-22 Alex Christensen <achristensen@webkit.org> > > Move NetworkStorageSession ownership to NetworkProcess >diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog >index 4a6c903baf0ee21f6d84153628cfcae586ecd15d..b1eb657462c7685fa9ef37b1a4e1801f61f40806 100644 >--- a/Source/WebKitLegacy/win/ChangeLog >+++ b/Source/WebKitLegacy/win/ChangeLog >@@ -1,3 +1,19 @@ >+2019-01-22 Ross Kirsling <ross.kirsling@sony.com> >+ >+ Move FileSystem to WTF >+ https://bugs.webkit.org/show_bug.cgi?id=193602 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Plugins/PluginDatabase.cpp: >+ * Plugins/PluginPackage.h: >+ * Plugins/PluginStream.h: >+ * WebApplicationCache.cpp: >+ * WebDatabaseManager.cpp: >+ * WebDownloadCurl.cpp: >+ * WebPreferences.cpp: >+ * WebView.cpp: >+ > 2019-01-22 Alex Christensen <achristensen@webkit.org> > > Move NetworkStorageSession ownership to NetworkProcess >diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj >index a2239490d112dca46a5aa4bcded35fdbcaaec9e9..d08c79f2b83a8e13feddb9cc119f31a1a9f9767a 100644 >--- a/Source/WTF/WTF.xcodeproj/project.pbxproj >+++ b/Source/WTF/WTF.xcodeproj/project.pbxproj >@@ -89,6 +89,11 @@ > 93934BD518A1F16900D0D6A1 /* StringViewCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */; }; > 93F1993E19D7958D00C2390B /* StringView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1993D19D7958D00C2390B /* StringView.cpp */; }; > 9BC70F05176C379D00101DEC /* AtomicStringTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BC70F04176C379D00101DEC /* AtomicStringTable.cpp */; }; >+ A331D95B21F24992009F02AA /* FileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A331D95A21F24992009F02AA /* FileSystem.cpp */; }; >+ A331D95D21F249E4009F02AA /* FileSystemCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A331D95C21F249E4009F02AA /* FileSystemCF.cpp */; }; >+ A331D95F21F249F6009F02AA /* FileSystemCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A331D95E21F249F6009F02AA /* FileSystemCocoa.mm */; }; >+ A331D96121F24A0A009F02AA /* FileSystemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A331D96021F24A0A009F02AA /* FileSystemMac.mm */; }; >+ A331D96721F24ABD009F02AA /* FileSystemPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A331D96621F24ABD009F02AA /* FileSystemPOSIX.cpp */; }; > A3B725EC987446AD93F1A440 /* RandomDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8F597CA2A57417FBAB92FD6 /* RandomDevice.cpp */; }; > A3E4DD931F3A803400DED0B4 /* TextStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3E4DD911F3A803400DED0B4 /* TextStream.cpp */; }; > A5BA15F3182433A900A82E69 /* StringCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F2182433A900A82E69 /* StringCocoa.mm */; }; >@@ -430,8 +435,16 @@ > 9C67C542589348E285B49699 /* IndexedContainerIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedContainerIterator.h; sourceTree = "<group>"; }; > A30D412C1F0DE0BA00B71954 /* SoftLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoftLinking.h; sourceTree = "<group>"; }; > A30D412D1F0DE13F00B71954 /* SoftLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoftLinking.h; sourceTree = "<group>"; }; >+ A331D95821F24978009F02AA /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMetadata.h; sourceTree = "<group>"; }; >+ A331D95921F24992009F02AA /* FileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystem.h; sourceTree = "<group>"; }; >+ A331D95A21F24992009F02AA /* FileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystem.cpp; sourceTree = "<group>"; }; >+ A331D95C21F249E4009F02AA /* FileSystemCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemCF.cpp; sourceTree = "<group>"; }; >+ A331D95E21F249F6009F02AA /* FileSystemCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileSystemCocoa.mm; sourceTree = "<group>"; }; >+ A331D96021F24A0A009F02AA /* FileSystemMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileSystemMac.mm; sourceTree = "<group>"; }; >+ A331D96621F24ABD009F02AA /* FileSystemPOSIX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemPOSIX.cpp; sourceTree = "<group>"; }; > A36E16F7216FF828008DD87E /* WTFSemaphore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFSemaphore.h; sourceTree = "<group>"; }; > A3AB6E6A1F3E1AD6009C14B1 /* ValueToString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueToString.h; sourceTree = "<group>"; }; >+ A3D273B921F2EE9100866971 /* MetadataSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MetadataSPI.h; sourceTree = "<group>"; }; > A3E4DD911F3A803400DED0B4 /* TextStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextStream.cpp; sourceTree = "<group>"; }; > A3E4DD921F3A803400DED0B4 /* TextStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextStream.h; sourceTree = "<group>"; }; > A5098AFF1C169E0700087797 /* SandboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SandboxSPI.h; sourceTree = "<group>"; }; >@@ -717,6 +730,7 @@ > children = ( > 5C1F05912164356B0039302C /* CFURLExtras.cpp */, > 5C1F05922164356B0039302C /* CFURLExtras.h */, >+ A331D95C21F249E4009F02AA /* FileSystemCF.cpp */, > C2BCFC411F61D61600C9222C /* LanguageCF.cpp */, > 2CDED0EE18115C38004DBA70 /* RunLoopCF.cpp */, > 1AFDE647195201C300C48FFA /* TypeCastsCF.h */, >@@ -774,6 +788,22 @@ > name = Source; > sourceTree = "<group>"; > }; >+ A331D96321F24A2E009F02AA /* posix */ = { >+ isa = PBXGroup; >+ children = ( >+ A331D96621F24ABD009F02AA /* FileSystemPOSIX.cpp */, >+ ); >+ path = posix; >+ sourceTree = "<group>"; >+ }; >+ A3D273B821F2EE7B00866971 /* mac */ = { >+ isa = PBXGroup; >+ children = ( >+ A3D273B921F2EE9100866971 /* MetadataSPI.h */, >+ ); >+ path = mac; >+ sourceTree = "<group>"; >+ }; > A5BA15F11824339F00A82E69 /* cocoa */ = { > isa = PBXGroup; > children = ( >@@ -807,6 +837,7 @@ > 1FA47C87152502DA00568D1B /* ios */, > A8A472C4151A825A004123FF /* mac */, > E43A46851E228B5700276B05 /* persistence */, >+ A331D96321F24A2E009F02AA /* posix */, > CEF4820C19DA347600CC04B8 /* spi */, > A8A4731B151A825B004123FF /* text */, > A8A47339151A825B004123FF /* threads */, >@@ -894,8 +925,11 @@ > A8A472A2151A825A004123FF /* FastMalloc.h */, > 0F79C7C31E73511800EB34D1 /* FastTLS.h */, > B38FD7BC168953E80065C969 /* FeatureDefines.h */, >+ A331D95821F24978009F02AA /* FileMetadata.h */, > 0F9D335B165DBA73005AD387 /* FilePrintStream.cpp */, > 0F9D335C165DBA73005AD387 /* FilePrintStream.h */, >+ A331D95A21F24992009F02AA /* FileSystem.cpp */, >+ A331D95921F24992009F02AA /* FileSystem.h */, > 0F2B66A517B6B4F700A7AE3F /* FlipBytes.h */, > FE86A8741E59440200111BBF /* ForbidHeapAllocation.h */, > A8A472A6151A825A004123FF /* Forward.h */, >@@ -1190,6 +1224,7 @@ > children = ( > 1A428B8B1C8F89DD0051E9EB /* AppKitCompatibilityDeclarations.h */, > 1ACADD821884480100D8B71D /* DeprecatedSymbolsUsedBySafari.mm */, >+ A331D96021F24A0A009F02AA /* FileSystemMac.mm */, > 53534F291EC0E10E00141B2F /* MachExceptions.defs */, > ); > path = mac; >@@ -1317,6 +1352,7 @@ > DCEE21F91CEA752F000C2396 /* cf */, > CE46516C19DB1FB4003ECA05 /* cocoa */, > CE73E02319DCB7AB00580D5C /* darwin */, >+ A3D273B821F2EE7B00866971 /* mac */, > ); > path = spi; > sourceTree = "<group>"; >@@ -1351,6 +1387,7 @@ > E38C41241EB4E04C0042957D /* CPUTimeCocoa.cpp */, > 143DDE9720C8BE99007F76FA /* Entitlements.h */, > 143DDE9520C8BC37007F76FA /* Entitlements.mm */, >+ A331D95E21F249F6009F02AA /* FileSystemCocoa.mm */, > 7A6EBA3320746C34004F9C44 /* MachSendRight.cpp */, > A8A472C5151A825A004123FF /* MainThreadCocoa.mm */, > ADF2CE651E39F106006889DB /* MemoryFootprintCocoa.cpp */, >@@ -1476,6 +1513,11 @@ > 0F7C5FB61D885CF20044F5E2 /* FastBitVector.cpp in Sources */, > A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */, > 0F9D3360165DBA73005AD387 /* FilePrintStream.cpp in Sources */, >+ A331D95B21F24992009F02AA /* FileSystem.cpp in Sources */, >+ A331D95D21F249E4009F02AA /* FileSystemCF.cpp in Sources */, >+ A331D95F21F249F6009F02AA /* FileSystemCocoa.mm in Sources */, >+ A331D96121F24A0A009F02AA /* FileSystemMac.mm in Sources */, >+ A331D96721F24ABD009F02AA /* FileSystemPOSIX.cpp in Sources */, > A8A473B5151A825B004123FF /* fixed-dtoa.cc in Sources */, > 1A1D8B9E1731879800141DA4 /* FunctionDispatcher.cpp in Sources */, > 0F5BF1761F23D49A0029D91D /* Gigacage.cpp in Sources */, >diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt >index cee1cce1e57184d13bd2cd519ef6a20dffb1a96a..7d8583320f49c610401c7b8ab446396d88c150e0 100644 >--- a/Source/WTF/wtf/CMakeLists.txt >+++ b/Source/WTF/wtf/CMakeLists.txt >@@ -61,7 +61,9 @@ set(WTF_PUBLIC_HEADERS > FastMalloc.h > FastTLS.h > FeatureDefines.h >+ FileMetadata.h > FilePrintStream.h >+ FileSystem.h > FlipBytes.h > ForbidHeapAllocation.h > Forward.h >@@ -353,6 +355,7 @@ set(WTF_SOURCES > FastBitVector.cpp > FastMalloc.cpp > FilePrintStream.cpp >+ FileSystem.cpp > FunctionDispatcher.cpp > Gigacage.cpp > GlobalVersion.cpp >diff --git a/Source/WTF/wtf/FileMetadata.h b/Source/WTF/wtf/FileMetadata.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0bb88fc84f94af4ccf1c580e0d56a2b658110f98 >--- /dev/null >+++ b/Source/WTF/wtf/FileMetadata.h >@@ -0,0 +1,52 @@ >+/* >+ * Copyright (C) 2010 Google Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions are >+ * met: >+ * >+ * * Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * * Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following disclaimer >+ * in the documentation and/or other materials provided with the >+ * distribution. >+ * * Neither the name of Google Inc. nor the names of its >+ * contributors may be used to endorse or promote products derived from >+ * this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <wtf/WallTime.h> >+ >+namespace WTF { >+ >+struct FileMetadata { >+ // The last modification time of the file, in seconds. >+ WallTime modificationTime; >+ >+ // The length of the file in bytes. >+ long long length; >+ >+ bool isHidden; >+ >+ enum class Type { File, Directory, SymbolicLink }; >+ Type type; >+}; >+ >+} // namespace WTF >+ >+using WTF::FileMetadata; >diff --git a/Source/WTF/wtf/FileSystem.cpp b/Source/WTF/wtf/FileSystem.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..15f7bb03ba017997e3c995f3885296a6f4a21703 >--- /dev/null >+++ b/Source/WTF/wtf/FileSystem.cpp >@@ -0,0 +1,367 @@ >+/* >+ * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2015 Canon Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include <wtf/FileSystem.h> >+ >+#include <wtf/FileMetadata.h> >+#include <wtf/HexNumber.h> >+#include <wtf/Scope.h> >+#include <wtf/text/CString.h> >+#include <wtf/text/StringBuilder.h> >+ >+#if !OS(WINDOWS) >+#include <fcntl.h> >+#include <sys/mman.h> >+#include <sys/stat.h> >+#include <unistd.h> >+#endif >+ >+namespace WTF { >+ >+namespace FileSystem { >+ >+// The following lower-ASCII characters need escaping to be used in a filename >+// across all systems, including Windows: >+// - Unprintable ASCII (00-1F) >+// - Space (20) >+// - Double quote (22) >+// - Percent (25) (escaped because it is our escape character) >+// - Asterisk (2A) >+// - Slash (2F) >+// - Colon (3A) >+// - Less-than (3C) >+// - Greater-than (3E) >+// - Question Mark (3F) >+// - Backslash (5C) >+// - Pipe (7C) >+// - Delete (7F) >+ >+static const bool needsEscaping[128] = { >+ true, true, true, true, true, true, true, true, /* 00-07 */ >+ true, true, true, true, true, true, true, true, /* 08-0F */ >+ >+ true, true, true, true, true, true, true, true, /* 10-17 */ >+ true, true, true, true, true, true, true, true, /* 18-1F */ >+ >+ true, false, true, false, false, true, false, false, /* 20-27 */ >+ false, false, true, false, false, false, false, true, /* 28-2F */ >+ >+ false, false, false, false, false, false, false, false, /* 30-37 */ >+ false, false, true, false, true, false, true, true, /* 38-3F */ >+ >+ false, false, false, false, false, false, false, false, /* 40-47 */ >+ false, false, false, false, false, false, false, false, /* 48-4F */ >+ >+ false, false, false, false, false, false, false, false, /* 50-57 */ >+ false, false, false, false, true, false, false, false, /* 58-5F */ >+ >+ false, false, false, false, false, false, false, false, /* 60-67 */ >+ false, false, false, false, false, false, false, false, /* 68-6F */ >+ >+ false, false, false, false, false, false, false, false, /* 70-77 */ >+ false, false, false, false, true, false, false, true, /* 78-7F */ >+}; >+ >+static inline bool shouldEscapeUChar(UChar character, UChar previousCharacter, UChar nextCharacter) >+{ >+ if (character <= 127) >+ return needsEscaping[character]; >+ >+ if (U16_IS_LEAD(character) && !U16_IS_TRAIL(nextCharacter)) >+ return true; >+ >+ if (U16_IS_TRAIL(character) && !U16_IS_LEAD(previousCharacter)) >+ return true; >+ >+ return false; >+} >+ >+String encodeForFileName(const String& inputString) >+{ >+ unsigned length = inputString.length(); >+ if (!length) >+ return inputString; >+ >+ StringBuilder result; >+ result.reserveCapacity(length); >+ >+ UChar previousCharacter; >+ UChar character = 0; >+ UChar nextCharacter = inputString[0]; >+ for (unsigned i = 0; i < length; ++i) { >+ previousCharacter = character; >+ character = nextCharacter; >+ nextCharacter = i + 1 < length ? inputString[i + 1] : 0; >+ >+ if (shouldEscapeUChar(character, previousCharacter, nextCharacter)) { >+ if (character <= 255) { >+ result.append('%'); >+ appendByteAsHex(character, result); >+ } else { >+ result.appendLiteral("%+"); >+ appendByteAsHex(character >> 8, result); >+ appendByteAsHex(character, result); >+ } >+ } else >+ result.append(character); >+ } >+ >+ return result.toString(); >+} >+ >+String decodeFromFilename(const String& inputString) >+{ >+ unsigned length = inputString.length(); >+ if (!length) >+ return inputString; >+ >+ StringBuilder result; >+ result.reserveCapacity(length); >+ >+ for (unsigned i = 0; i < length; ++i) { >+ if (inputString[i] != '%') { >+ result.append(inputString[i]); >+ continue; >+ } >+ >+ // If the input string is a valid encoded filename, it must be at least 2 characters longer >+ // than the current index to account for this percent encoded value. >+ if (i + 2 >= length) >+ return { }; >+ >+ if (inputString[i+1] != '+') { >+ if (!isASCIIHexDigit(inputString[i + 1])) >+ return { }; >+ if (!isASCIIHexDigit(inputString[i + 2])) >+ return { }; >+ result.append(toASCIIHexValue(inputString[i + 1], inputString[i + 2])); >+ i += 2; >+ continue; >+ } >+ >+ // If the input string is a valid encoded filename, it must be at least 5 characters longer >+ // than the current index to account for this percent encoded value. >+ if (i + 5 >= length) >+ return { }; >+ >+ if (!isASCIIHexDigit(inputString[i + 2])) >+ return { }; >+ if (!isASCIIHexDigit(inputString[i + 3])) >+ return { }; >+ if (!isASCIIHexDigit(inputString[i + 4])) >+ return { }; >+ if (!isASCIIHexDigit(inputString[i + 5])) >+ return { }; >+ >+ result.append(toASCIIHexValue(inputString[i + 2], inputString[i + 3]) << 8 | toASCIIHexValue(inputString[i + 4], inputString[i + 5])); >+ i += 5; >+ } >+ >+ return result.toString(); >+} >+ >+String lastComponentOfPathIgnoringTrailingSlash(const String& path) >+{ >+#if OS(WINDOWS) >+ char pathSeparator = '\\'; >+#else >+ char pathSeparator = '/'; >+#endif >+ >+ auto position = path.reverseFind(pathSeparator); >+ if (position == notFound) >+ return path; >+ >+ size_t endOfSubstring = path.length() - 1; >+ if (position == endOfSubstring) { >+ --endOfSubstring; >+ position = path.reverseFind(pathSeparator, endOfSubstring); >+ } >+ >+ return path.substring(position + 1, endOfSubstring - position); >+} >+ >+bool appendFileContentsToFileHandle(const String& path, PlatformFileHandle& target) >+{ >+ auto source = openFile(path, FileOpenMode::Read); >+ >+ if (!isHandleValid(source)) >+ return false; >+ >+ static int bufferSize = 1 << 19; >+ Vector<char> buffer(bufferSize); >+ >+ auto fileCloser = WTF::makeScopeExit([source]() { >+ PlatformFileHandle handle = source; >+ closeFile(handle); >+ }); >+ >+ do { >+ int readBytes = readFromFile(source, buffer.data(), bufferSize); >+ >+ if (readBytes < 0) >+ return false; >+ >+ if (writeToFile(target, buffer.data(), readBytes) != readBytes) >+ return false; >+ >+ if (readBytes < bufferSize) >+ return true; >+ } while (true); >+ >+ ASSERT_NOT_REACHED(); >+} >+ >+ >+bool filesHaveSameVolume(const String& fileA, const String& fileB) >+{ >+ auto fsRepFileA = fileSystemRepresentation(fileA); >+ auto fsRepFileB = fileSystemRepresentation(fileB); >+ >+ if (fsRepFileA.isNull() || fsRepFileB.isNull()) >+ return false; >+ >+ bool result = false; >+ >+ auto fileADev = getFileDeviceId(fsRepFileA); >+ auto fileBDev = getFileDeviceId(fsRepFileB); >+ >+ if (fileADev && fileBDev) >+ result = (fileADev == fileBDev); >+ >+ return result; >+} >+ >+#if !PLATFORM(MAC) >+ >+void setMetadataURL(const String&, const String&, const String&) >+{ >+} >+ >+bool canExcludeFromBackup() >+{ >+ return false; >+} >+ >+bool excludeFromBackup(const String&) >+{ >+ return false; >+} >+ >+#endif >+ >+MappedFileData::~MappedFileData() >+{ >+#if !OS(WINDOWS) >+ if (!m_fileData) >+ return; >+ munmap(m_fileData, m_fileSize); >+#endif >+} >+ >+MappedFileData::MappedFileData(const String& filePath, bool& success) >+{ >+#if OS(WINDOWS) >+ // FIXME: Implement mapping >+ success = false; >+#else >+ CString fsRep = fileSystemRepresentation(filePath); >+ int fd = !fsRep.isNull() ? open(fsRep.data(), O_RDONLY) : -1; >+ if (fd < 0) { >+ success = false; >+ return; >+ } >+ >+ struct stat fileStat; >+ if (fstat(fd, &fileStat)) { >+ close(fd); >+ success = false; >+ return; >+ } >+ >+ unsigned size; >+ if (!WTF::convertSafely(fileStat.st_size, size)) { >+ close(fd); >+ success = false; >+ return; >+ } >+ >+ if (!size) { >+ close(fd); >+ success = true; >+ return; >+ } >+ >+ void* data = mmap(0, size, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0); >+ close(fd); >+ >+ if (data == MAP_FAILED) { >+ success = false; >+ return; >+ } >+ >+ success = true; >+ m_fileData = data; >+ m_fileSize = size; >+#endif >+} >+ >+PlatformFileHandle openAndLockFile(const String& path, FileOpenMode openMode, OptionSet<FileLockMode> lockMode) >+{ >+ auto handle = openFile(path, openMode); >+ if (handle == invalidPlatformFileHandle) >+ return invalidPlatformFileHandle; >+ >+#if USE(FILE_LOCK) >+ bool locked = lockFile(handle, lockMode); >+ ASSERT_UNUSED(locked, locked); >+#else >+ UNUSED_PARAM(lockMode); >+#endif >+ >+ return handle; >+} >+ >+void unlockAndCloseFile(PlatformFileHandle handle) >+{ >+#if USE(FILE_LOCK) >+ bool unlocked = unlockFile(handle); >+ ASSERT_UNUSED(unlocked, unlocked); >+#endif >+ closeFile(handle); >+} >+ >+bool fileIsDirectory(const String& path, ShouldFollowSymbolicLinks shouldFollowSymbolicLinks) >+{ >+ auto metadata = shouldFollowSymbolicLinks == ShouldFollowSymbolicLinks::Yes ? fileMetadataFollowingSymlinks(path) : fileMetadata(path); >+ if (!metadata) >+ return false; >+ return metadata.value().type == FileMetadata::Type::Directory; >+} >+ >+} // namespace FileSystem >+} // namespace WTF >diff --git a/Source/WTF/wtf/FileSystem.h b/Source/WTF/wtf/FileSystem.h >new file mode 100644 >index 0000000000000000000000000000000000000000..fa4b1f883b97560188d2fdf11b27e401c2166665 >--- /dev/null >+++ b/Source/WTF/wtf/FileSystem.h >@@ -0,0 +1,226 @@ >+/* >+ * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2008 Collabora, Ltd. All rights reserved. >+ * Copyright (C) 2015 Canon Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of >+ * its contributors may be used to endorse or promote products derived >+ * from this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <time.h> >+#include <utility> >+#include <wtf/Forward.h> >+#include <wtf/OptionSet.h> >+#include <wtf/Vector.h> >+#include <wtf/WallTime.h> >+#include <wtf/text/WTFString.h> >+ >+#if USE(CF) >+#include <wtf/RetainPtr.h> >+#endif >+ >+#if USE(CF) >+typedef const struct __CFData* CFDataRef; >+#endif >+ >+OBJC_CLASS NSString; >+ >+#if PLATFORM(WIN) >+typedef void *HANDLE; >+#endif >+ >+#if USE(GLIB) >+typedef struct _GFileIOStream GFileIOStream; >+#endif >+ >+namespace WTF { >+ >+struct FileMetadata; >+ >+namespace FileSystem { >+ >+// PlatformFileHandle >+#if USE(GLIB) && !PLATFORM(WIN) >+typedef GFileIOStream* PlatformFileHandle; >+const PlatformFileHandle invalidPlatformFileHandle = 0; >+#elif PLATFORM(WIN) >+typedef HANDLE PlatformFileHandle; >+// FIXME: -1 is INVALID_HANDLE_VALUE, defined in <winbase.h>. Chromium tries to >+// avoid using Windows headers in headers. We'd rather move this into the .cpp. >+const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast<HANDLE>(-1); >+#else >+typedef int PlatformFileHandle; >+const PlatformFileHandle invalidPlatformFileHandle = -1; >+#endif >+ >+enum class FileOpenMode { >+ Read, >+ Write, >+#if OS(DARWIN) >+ EventsOnly, >+#endif >+}; >+ >+enum class FileSeekOrigin { >+ Beginning, >+ Current, >+ End, >+}; >+ >+enum class FileLockMode { >+ Shared = 1 << 0, >+ Exclusive = 1 << 1, >+ Nonblocking = 1 << 2, >+}; >+ >+enum class ShouldFollowSymbolicLinks { No, Yes }; >+ >+WTF_EXPORT_PRIVATE bool fileExists(const String&); >+WTF_EXPORT_PRIVATE bool deleteFile(const String&); >+WTF_EXPORT_PRIVATE bool deleteEmptyDirectory(const String&); >+WTF_EXPORT_PRIVATE bool moveFile(const String& oldPath, const String& newPath); >+WTF_EXPORT_PRIVATE bool getFileSize(const String&, long long& result); >+WTF_EXPORT_PRIVATE bool getFileSize(PlatformFileHandle, long long& result); >+WTF_EXPORT_PRIVATE Optional<WallTime> getFileModificationTime(const String&); >+WTF_EXPORT_PRIVATE Optional<WallTime> getFileCreationTime(const String&); // Not all platforms store file creation time. >+WTF_EXPORT_PRIVATE Optional<FileMetadata> fileMetadata(const String& path); >+WTF_EXPORT_PRIVATE Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path); >+WTF_EXPORT_PRIVATE bool fileIsDirectory(const String&, ShouldFollowSymbolicLinks); >+WTF_EXPORT_PRIVATE String pathByAppendingComponent(const String& path, const String& component); >+WTF_EXPORT_PRIVATE String pathByAppendingComponents(StringView path, const Vector<StringView>& components); >+WTF_EXPORT_PRIVATE String lastComponentOfPathIgnoringTrailingSlash(const String& path); >+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 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); >+ >+WTF_EXPORT_PRIVATE void setMetadataURL(const String& path, const String& urlString, const String& referrer = { }); >+ >+bool canExcludeFromBackup(); // Returns true if any file can ever be excluded from backup. >+bool excludeFromBackup(const String&); // Returns true if successful. >+ >+WTF_EXPORT_PRIVATE Vector<String> listDirectory(const String& path, const String& filter = String()); >+ >+WTF_EXPORT_PRIVATE CString fileSystemRepresentation(const String&); >+String stringFromFileSystemRepresentation(const char*); >+ >+inline bool isHandleValid(const PlatformFileHandle& handle) { return handle != invalidPlatformFileHandle; } >+ >+// Prefix is what the filename should be prefixed with, not the full path. >+WTF_EXPORT_PRIVATE String openTemporaryFile(const String& prefix, PlatformFileHandle&); >+WTF_EXPORT_PRIVATE PlatformFileHandle openFile(const String& path, FileOpenMode); >+WTF_EXPORT_PRIVATE void closeFile(PlatformFileHandle&); >+// Returns the resulting offset from the beginning of the file if successful, -1 otherwise. >+WTF_EXPORT_PRIVATE long long seekFile(PlatformFileHandle, long long offset, FileSeekOrigin); >+bool truncateFile(PlatformFileHandle, long long offset); >+// Returns number of bytes actually read if successful, -1 otherwise. >+WTF_EXPORT_PRIVATE int writeToFile(PlatformFileHandle, const char* data, int length); >+// Returns number of bytes actually written if successful, -1 otherwise. >+WTF_EXPORT_PRIVATE int readFromFile(PlatformFileHandle, char* data, int length); >+ >+WTF_EXPORT_PRIVATE PlatformFileHandle openAndLockFile(const String&, FileOpenMode, OptionSet<FileLockMode> = FileLockMode::Exclusive); >+WTF_EXPORT_PRIVATE void unlockAndCloseFile(PlatformFileHandle); >+ >+// Appends the contents of the file found at 'path' to the open PlatformFileHandle. >+// Returns true if the write was successful, false if it was not. >+WTF_EXPORT_PRIVATE bool appendFileContentsToFileHandle(const String& path, PlatformFileHandle&); >+ >+// Hard links a file if possible, copies it if not. >+WTF_EXPORT_PRIVATE bool hardLinkOrCopyFile(const String& source, const String& destination); >+ >+#if USE(FILE_LOCK) >+WTF_EXPORT_PRIVATE bool lockFile(PlatformFileHandle, OptionSet<FileLockMode>); >+WTF_EXPORT_PRIVATE bool unlockFile(PlatformFileHandle); >+#endif >+ >+// Encode a string for use within a file name. >+WTF_EXPORT_PRIVATE String encodeForFileName(const String&); >+WTF_EXPORT_PRIVATE String decodeFromFilename(const String&); >+ >+WTF_EXPORT_PRIVATE bool filesHaveSameVolume(const String&, const String&); >+ >+#if USE(CF) >+WTF_EXPORT_PRIVATE RetainPtr<CFURLRef> pathAsURL(const String&); >+#endif >+ >+#if PLATFORM(GTK) || PLATFORM(WPE) >+String filenameForDisplay(const String&); >+#endif >+ >+#if PLATFORM(WIN) >+WTF_EXPORT_PRIVATE String localUserSpecificStorageDirectory(); >+WTF_EXPORT_PRIVATE String roamingUserSpecificStorageDirectory(); >+#endif >+ >+#if PLATFORM(COCOA) >+WTF_EXPORT_PRIVATE NSString *createTemporaryDirectory(NSString *directoryPrefix); >+WTF_EXPORT_PRIVATE bool deleteNonEmptyDirectory(const String&); >+#endif >+ >+#if PLATFORM(WIN_CAIRO) >+WTF_EXPORT_PRIVATE String createTemporaryDirectory(); >+WTF_EXPORT_PRIVATE bool deleteNonEmptyDirectory(const String&); >+#endif >+ >+WTF_EXPORT_PRIVATE String realPath(const String&); >+ >+class MappedFileData { >+public: >+ MappedFileData() { } >+ MappedFileData(MappedFileData&&); >+ WTF_EXPORT_PRIVATE MappedFileData(const String& filePath, bool& success); >+ WTF_EXPORT_PRIVATE ~MappedFileData(); >+ MappedFileData& operator=(MappedFileData&&); >+ >+ explicit operator bool() const { return !!m_fileData; } >+ const void* data() const { return m_fileData; } >+ unsigned size() const { return m_fileSize; } >+ >+private: >+ void* m_fileData { nullptr }; >+ unsigned m_fileSize { 0 }; >+}; >+ >+inline MappedFileData::MappedFileData(MappedFileData&& other) >+ : m_fileData(std::exchange(other.m_fileData, nullptr)) >+ , m_fileSize(std::exchange(other.m_fileSize, 0)) >+{ >+} >+ >+inline MappedFileData& MappedFileData::operator=(MappedFileData&& other) >+{ >+ m_fileData = std::exchange(other.m_fileData, nullptr); >+ m_fileSize = std::exchange(other.m_fileSize, 0); >+ return *this; >+} >+ >+} // namespace FileSystem >+} // namespace WTF >+ >+namespace FileSystem = WTF::FileSystem; >diff --git a/Source/WTF/wtf/PlatformGTK.cmake b/Source/WTF/wtf/PlatformGTK.cmake >index 673f02d0d5968545ac87a8a8e57b27734d73989c..7fec12dc2fc315bc5168f02b3bf76470c0d9cbad 100644 >--- a/Source/WTF/wtf/PlatformGTK.cmake >+++ b/Source/WTF/wtf/PlatformGTK.cmake >@@ -22,6 +22,7 @@ list(APPEND WTF_SOURCES > generic/MainThreadGeneric.cpp > generic/WorkQueueGeneric.cpp > >+ glib/FileSystemGlib.cpp > glib/GLibUtilities.cpp > glib/GRefPtr.cpp > glib/RunLoopGLib.cpp >@@ -55,5 +56,6 @@ list(APPEND WTF_LIBRARIES > ) > > list(APPEND WTF_SYSTEM_INCLUDE_DIRECTORIES >+ ${GIO_UNIX_INCLUDE_DIRS} > ${GLIB_INCLUDE_DIRS} > ) >diff --git a/Source/WTF/wtf/PlatformMac.cmake b/Source/WTF/wtf/PlatformMac.cmake >index fc1e57b9cb26b6f2b6aba6143bd18aebbb16b534..0e3e14160912b78617734350a925d99dba2cda01 100644 >--- a/Source/WTF/wtf/PlatformMac.cmake >+++ b/Source/WTF/wtf/PlatformMac.cmake >@@ -32,6 +32,8 @@ list(APPEND WTF_PUBLIC_HEADERS > spi/darwin/XPCSPI.h > spi/darwin/dyldSPI.h > >+ spi/mac/MetadataSPI.h >+ > text/cf/TextBreakIteratorCF.h > ) > >@@ -42,6 +44,7 @@ list(APPEND WTF_SOURCES > SchedulePairMac.mm > > cf/CFURLExtras.cpp >+ cf/FileSystemCF.cpp > cf/LanguageCF.cpp > cf/RunLoopCF.cpp > cf/URLCF.cpp >@@ -49,6 +52,7 @@ list(APPEND WTF_SOURCES > cocoa/AutodrainedPool.cpp > cocoa/CPUTimeCocoa.cpp > cocoa/Entitlements.mm >+ cocoa/FileSystemCocoa.mm > cocoa/MachSendRight.cpp > cocoa/MainThreadCocoa.mm > cocoa/MemoryFootprintCocoa.cpp >@@ -58,6 +62,9 @@ list(APPEND WTF_SOURCES > cocoa/WorkQueueCocoa.cpp > > mac/DeprecatedSymbolsUsedBySafari.mm >+ mac/FileSystemMac.mm >+ >+ posix/FileSystemPOSIX.cpp > > text/cf/AtomicStringImplCF.cpp > text/cf/StringCF.cpp >diff --git a/Source/WTF/wtf/PlatformPlayStation.cmake b/Source/WTF/wtf/PlatformPlayStation.cmake >index b97fec40ed30b177b2f535b62160ef1eee2de56e..3e9e75c928a6c94605b4bfcaa7fbb2b9f42f8390 100644 >--- a/Source/WTF/wtf/PlatformPlayStation.cmake >+++ b/Source/WTF/wtf/PlatformPlayStation.cmake >@@ -5,6 +5,8 @@ list(APPEND WTF_SOURCES > generic/RunLoopGeneric.cpp > generic/WorkQueueGeneric.cpp > >+ posix/FileSystemPOSIX.cpp >+ > text/unix/TextBreakIteratorInternalICUUnix.cpp > > unix/CPUTimeUnix.cpp >diff --git a/Source/WTF/wtf/PlatformWPE.cmake b/Source/WTF/wtf/PlatformWPE.cmake >index 473cfd6026b0652c2f02d2b285392b1d802f0bbc..086add3aa919fc49239d71c1cc8685c5fc739bd4 100644 >--- a/Source/WTF/wtf/PlatformWPE.cmake >+++ b/Source/WTF/wtf/PlatformWPE.cmake >@@ -16,6 +16,7 @@ list(APPEND WTF_SOURCES > generic/MainThreadGeneric.cpp > generic/WorkQueueGeneric.cpp > >+ glib/FileSystemGlib.cpp > glib/GLibUtilities.cpp > glib/GRefPtr.cpp > glib/RunLoopGLib.cpp >@@ -40,5 +41,6 @@ list(APPEND WTF_LIBRARIES > ) > > list(APPEND WTF_SYSTEM_INCLUDE_DIRECTORIES >+ ${GIO_UNIX_INCLUDE_DIRS} > ${GLIB_INCLUDE_DIRS} > ) >diff --git a/Source/WTF/wtf/PlatformWin.cmake b/Source/WTF/wtf/PlatformWin.cmake >index 2b8b5f8270eb5f24676072dd124576da9301f0ea..b6c0ac6f4de5e05f27d4d9ac0ffbd5cc4097a6e3 100644 >--- a/Source/WTF/wtf/PlatformWin.cmake >+++ b/Source/WTF/wtf/PlatformWin.cmake >@@ -12,14 +12,20 @@ list(APPEND WTF_SOURCES > > win/CPUTimeWin.cpp > win/DbgHelperWin.cpp >+ win/FileSystemWin.cpp > win/LanguageWin.cpp > win/MainThreadWin.cpp > win/MemoryFootprintWin.cpp > win/MemoryPressureHandlerWin.cpp >+ win/PathWalker.cpp > win/RunLoopWin.cpp > win/WorkQueueWin.cpp > ) > >+list(APPEND WTF_LIBRARIES >+ shlwapi >+) >+ > if (USE_CF) > list(APPEND WTF_PUBLIC_HEADERS > cf/CFURLExtras.h >@@ -29,6 +35,7 @@ if (USE_CF) > ) > list(APPEND WTF_SOURCES > cf/CFURLExtras.cpp >+ cf/FileSystemCF.cpp > cf/URLCF.cpp > > text/cf/AtomicStringImplCF.cpp >diff --git a/Source/WTF/wtf/cf/FileSystemCF.cpp b/Source/WTF/wtf/cf/FileSystemCF.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..712d65fcad296b3963f60a4494b6d7e92d4ac50c >--- /dev/null >+++ b/Source/WTF/wtf/cf/FileSystemCF.cpp >@@ -0,0 +1,74 @@ >+/* >+ * Copyright (C) 2007, 2011 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of >+ * its contributors may be used to endorse or promote products derived >+ * from this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include <wtf/FileSystem.h> >+ >+#include <CoreFoundation/CFString.h> >+#include <wtf/RetainPtr.h> >+#include <wtf/text/CString.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WTF { >+ >+CString FileSystem::fileSystemRepresentation(const String& path) >+{ >+ RetainPtr<CFStringRef> cfString = path.createCFString(); >+ >+ if (!cfString) >+ return CString(); >+ >+ CFIndex size = CFStringGetMaximumSizeOfFileSystemRepresentation(cfString.get()); >+ >+ Vector<char> buffer(size); >+ >+ if (!CFStringGetFileSystemRepresentation(cfString.get(), buffer.data(), buffer.size())) { >+ LOG_ERROR("Failed to get filesystem representation to create CString from cfString"); >+ return CString(); >+ } >+ >+ return CString(buffer.data(), strlen(buffer.data())); >+} >+ >+String FileSystem::stringFromFileSystemRepresentation(const char* fileSystemRepresentation) >+{ >+ return adoptCF(CFStringCreateWithFileSystemRepresentation(kCFAllocatorDefault, fileSystemRepresentation)).get(); >+} >+ >+RetainPtr<CFURLRef> FileSystem::pathAsURL(const String& path) >+{ >+ CFURLPathStyle pathStyle; >+#if PLATFORM(WIN) >+ pathStyle = kCFURLWindowsPathStyle; >+#else >+ pathStyle = kCFURLPOSIXPathStyle; >+#endif >+ return adoptCF(CFURLCreateWithFileSystemPath(0, path.createCFString().get(), pathStyle, FALSE)); >+} >+ >+} // namespace WTF >diff --git a/Source/WTF/wtf/cocoa/FileSystemCocoa.mm b/Source/WTF/wtf/cocoa/FileSystemCocoa.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..b3857469ce04696baaa32637438d13166bf04ff8 >--- /dev/null >+++ b/Source/WTF/wtf/cocoa/FileSystemCocoa.mm >@@ -0,0 +1,143 @@ >+/* >+ * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of >+ * its contributors may be used to endorse or promote products derived >+ * from this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#import "config.h" >+#import <wtf/FileSystem.h> >+ >+@interface WTFWebFileManagerDelegate : NSObject <NSFileManagerDelegate> >+@end >+ >+@implementation WTFWebFileManagerDelegate >+ >+- (BOOL)fileManager:(NSFileManager *)fileManager shouldProceedAfterError:(NSError *)error movingItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL >+{ >+ UNUSED_PARAM(fileManager); >+ UNUSED_PARAM(srcURL); >+ UNUSED_PARAM(dstURL); >+ return error.code == NSFileWriteFileExistsError; >+} >+ >+@end >+ >+namespace WTF { >+ >+namespace FileSystem { >+ >+String homeDirectoryPath() >+{ >+ return NSHomeDirectory(); >+} >+ >+String openTemporaryFile(const String& prefix, PlatformFileHandle& platformFileHandle) >+{ >+ platformFileHandle = invalidPlatformFileHandle; >+ >+ Vector<char> temporaryFilePath(PATH_MAX); >+ if (!confstr(_CS_DARWIN_USER_TEMP_DIR, temporaryFilePath.data(), temporaryFilePath.size())) >+ return String(); >+ >+ // Shrink the vector. >+ temporaryFilePath.shrink(strlen(temporaryFilePath.data())); >+ >+ // FIXME: Change to a runtime assertion that the path ends with a slash once <rdar://problem/23579077> is >+ // fixed in all iOS Simulator versions that we use. >+ if (temporaryFilePath.last() != '/') >+ temporaryFilePath.append('/'); >+ >+ // Append the file name. >+ CString prefixUtf8 = prefix.utf8(); >+ temporaryFilePath.append(prefixUtf8.data(), prefixUtf8.length()); >+ temporaryFilePath.append("XXXXXX", 6); >+ temporaryFilePath.append('\0'); >+ >+ platformFileHandle = mkstemp(temporaryFilePath.data()); >+ if (platformFileHandle == invalidPlatformFileHandle) >+ return String(); >+ >+ return String::fromUTF8(temporaryFilePath.data()); >+} >+ >+bool moveFile(const String& oldPath, const String& newPath) >+{ >+ // Overwrite existing files. >+ auto manager = adoptNS([[NSFileManager alloc] init]); >+ auto delegate = adoptNS([[WTFWebFileManagerDelegate alloc] init]); >+ [manager setDelegate:delegate.get()]; >+ >+ NSError *error = nil; >+ bool success = [manager moveItemAtURL:[NSURL fileURLWithPath:oldPath] toURL:[NSURL fileURLWithPath:newPath] error:&error]; >+ if (!success) >+ NSLog(@"Error in moveFile: %@", error); >+ return success; >+} >+ >+bool getVolumeFreeSpace(const String& path, uint64_t& freeSpace) >+{ >+ NSDictionary *fileSystemAttributesDictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:(NSString *)path error:NULL]; >+ if (!fileSystemAttributesDictionary) >+ return false; >+ freeSpace = [[fileSystemAttributesDictionary objectForKey:NSFileSystemFreeSize] unsignedLongLongValue]; >+ return true; >+} >+ >+NSString *createTemporaryDirectory(NSString *directoryPrefix) >+{ >+ NSString *tempDirectory = NSTemporaryDirectory(); >+ if (!tempDirectory || ![tempDirectory length]) >+ return nil; >+ >+ if (!directoryPrefix || ![directoryPrefix length]) >+ return nil; >+ >+ NSString *tempDirectoryComponent = [directoryPrefix stringByAppendingString:@"-XXXXXXXX"]; >+ const char* tempDirectoryCString = [[tempDirectory stringByAppendingPathComponent:tempDirectoryComponent] fileSystemRepresentation]; >+ if (!tempDirectoryCString) >+ return nil; >+ >+ const size_t length = strlen(tempDirectoryCString); >+ ASSERT(length <= MAXPATHLEN); >+ if (length > MAXPATHLEN) >+ return nil; >+ >+ const size_t lengthPlusNullTerminator = length + 1; >+ Vector<char, MAXPATHLEN + 1> path(lengthPlusNullTerminator); >+ memcpy(path.data(), tempDirectoryCString, lengthPlusNullTerminator); >+ >+ if (!mkdtemp(path.data())) >+ return nil; >+ >+ return [[NSFileManager defaultManager] stringWithFileSystemRepresentation:path.data() length:length]; >+} >+ >+bool deleteNonEmptyDirectory(const String& path) >+{ >+ return [[NSFileManager defaultManager] removeItemAtPath:path error:nil]; >+} >+ >+} // namespace FileSystem >+} // namespace WTF >diff --git a/Source/WTF/wtf/glib/FileSystemGlib.cpp b/Source/WTF/wtf/glib/FileSystemGlib.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..2ff6bd3fa5482a5a0f840c967842c45b8ae122cf >--- /dev/null >+++ b/Source/WTF/wtf/glib/FileSystemGlib.cpp >@@ -0,0 +1,469 @@ >+/* >+ * Copyright (C) 2007, 2009 Holger Hans Peter Freyther >+ * Copyright (C) 2008 Collabora, Ltd. >+ * Copyright (C) 2008 Apple Inc. All rights reserved. >+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+#include <wtf/FileSystem.h> >+ >+#include <gio/gfiledescriptorbased.h> >+#include <gio/gio.h> >+#include <glib.h> >+#include <glib/gstdio.h> >+#include <sys/file.h> >+#include <wtf/EnumTraits.h> >+#include <wtf/FileMetadata.h> >+#include <wtf/UUID.h> >+#include <wtf/glib/GLibUtilities.h> >+#include <wtf/glib/GRefPtr.h> >+#include <wtf/glib/GUniquePtr.h> >+#include <wtf/text/CString.h> >+#include <wtf/text/StringBuilder.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WTF { >+ >+namespace FileSystem { >+ >+/* On linux file names are just raw bytes, so also strings that cannot be encoded in any way >+ * are valid file names. This mean that we cannot just store a file name as-is in a String >+ * but we have to escape it. >+ * On Windows the GLib file name encoding is always UTF-8 so we can optimize this case. */ >+String stringFromFileSystemRepresentation(const char* fileSystemRepresentation) >+{ >+ if (!fileSystemRepresentation) >+ return String(); >+ >+#if OS(WINDOWS) >+ return String::fromUTF8(fileSystemRepresentation); >+#else >+ GUniquePtr<gchar> escapedString(g_uri_escape_string(fileSystemRepresentation, "/:", FALSE)); >+ return escapedString.get(); >+#endif >+} >+ >+static GUniquePtr<char> unescapedFilename(const String& path) >+{ >+ if (path.isEmpty()) >+ return nullptr; >+#if OS(WINDOWS) >+ return GUniquePtr<char>(g_strdup(path.utf8().data())); >+#else >+ return GUniquePtr<char>(g_uri_unescape_string(path.utf8().data(), nullptr)); >+#endif >+} >+ >+CString fileSystemRepresentation(const String& path) >+{ >+#if OS(WINDOWS) >+ return path.utf8(); >+#else >+ GUniquePtr<gchar> filename = unescapedFilename(path); >+ return filename.get(); >+#endif >+} >+ >+// Converts a string to something suitable to be displayed to the user. >+String filenameForDisplay(const String& string) >+{ >+#if OS(WINDOWS) >+ return string; >+#else >+ GUniquePtr<gchar> filename = unescapedFilename(string); >+ if (!filename) >+ return string; >+ >+ GUniquePtr<gchar> display(g_filename_to_utf8(filename.get(), -1, nullptr, nullptr, nullptr)); >+ if (!display) >+ return string; >+ >+ return String::fromUTF8(display.get()); >+#endif >+} >+ >+bool fileExists(const String& path) >+{ >+ GUniquePtr<gchar> filename = unescapedFilename(path); >+ return filename ? g_file_test(filename.get(), G_FILE_TEST_EXISTS) : false; >+} >+ >+bool deleteFile(const String& path) >+{ >+ GUniquePtr<gchar> filename = unescapedFilename(path); >+ return filename ? g_remove(filename.get()) != -1 : false; >+} >+ >+bool deleteEmptyDirectory(const String& path) >+{ >+ GUniquePtr<gchar> filename = unescapedFilename(path); >+ return filename ? g_rmdir(filename.get()) != -1 : false; >+} >+ >+static bool getFileStat(const String& path, GStatBuf* statBuffer) >+{ >+ GUniquePtr<gchar> filename = unescapedFilename(path); >+ if (!filename) >+ return false; >+ >+ return g_stat(filename.get(), statBuffer) != -1; >+} >+ >+static bool getFileLStat(const String& path, GStatBuf* statBuffer) >+{ >+ GUniquePtr<gchar> filename = unescapedFilename(path); >+ if (!filename) >+ return false; >+ >+ return g_lstat(filename.get(), statBuffer) != -1; >+} >+ >+bool getFileSize(const String& path, long long& resultSize) >+{ >+ GStatBuf statResult; >+ if (!getFileStat(path, &statResult)) >+ return false; >+ >+ resultSize = statResult.st_size; >+ return true; >+} >+ >+bool getFileSize(PlatformFileHandle handle, long long& resultSize) >+{ >+ auto info = g_file_io_stream_query_info(handle, G_FILE_ATTRIBUTE_STANDARD_SIZE, nullptr, nullptr); >+ if (!info) >+ return false; >+ >+ resultSize = g_file_info_get_size(info); >+ return true; >+} >+ >+Optional<WallTime> getFileCreationTime(const String&) >+{ >+ // FIXME: Is there a way to retrieve file creation time with Gtk on platforms that support it? >+ return WTF::nullopt; >+} >+ >+Optional<WallTime> getFileModificationTime(const String& path) >+{ >+ GStatBuf statResult; >+ if (!getFileStat(path, &statResult)) >+ return WTF::nullopt; >+ >+ return WallTime::fromRawSeconds(statResult.st_mtime); >+} >+ >+static FileMetadata::Type toFileMetataType(GStatBuf statResult) >+{ >+ if (S_ISDIR(statResult.st_mode)) >+ return FileMetadata::Type::Directory; >+ if (S_ISLNK(statResult.st_mode)) >+ return FileMetadata::Type::SymbolicLink; >+ return FileMetadata::Type::File; >+} >+ >+static Optional<FileMetadata> fileMetadataUsingFunction(const String& path, bool (*statFunc)(const String&, GStatBuf*)) >+{ >+ GStatBuf statResult; >+ if (!statFunc(path, &statResult)) >+ return WTF::nullopt; >+ >+ String filename = pathGetFileName(path); >+ bool isHidden = !filename.isEmpty() && filename[0] == '.'; >+ >+ return FileMetadata { >+ WallTime::fromRawSeconds(statResult.st_mtime), >+ statResult.st_size, >+ isHidden, >+ toFileMetataType(statResult) >+ }; >+} >+ >+Optional<FileMetadata> fileMetadata(const String& path) >+{ >+ return fileMetadataUsingFunction(path, &getFileLStat); >+} >+ >+Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) >+{ >+ return fileMetadataUsingFunction(path, &getFileStat); >+} >+ >+String pathByAppendingComponent(const String& path, const String& component) >+{ >+ if (path.endsWith(G_DIR_SEPARATOR_S)) >+ return path + component; >+ return path + G_DIR_SEPARATOR_S + component; >+} >+ >+String pathByAppendingComponents(StringView path, const Vector<StringView>& components) >+{ >+ StringBuilder builder; >+ builder.append(path); >+ for (auto& component : components) { >+ builder.append(G_DIR_SEPARATOR_S); >+ builder.append(component); >+ } >+ return builder.toString(); >+} >+ >+bool makeAllDirectories(const String& path) >+{ >+ GUniquePtr<gchar> filename = unescapedFilename(path); >+ return filename ? g_mkdir_with_parents(filename.get(), S_IRWXU) != -1 : false; >+} >+ >+String homeDirectoryPath() >+{ >+ return stringFromFileSystemRepresentation(g_get_home_dir()); >+} >+ >+bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath) >+{ >+ CString targetPathFSRep = fileSystemRepresentation(targetPath); >+ if (!targetPathFSRep.data() || targetPathFSRep.data()[0] == '\0') >+ return false; >+ >+ CString symbolicLinkPathFSRep = fileSystemRepresentation(symbolicLinkPath); >+ if (!symbolicLinkPathFSRep.data() || symbolicLinkPathFSRep.data()[0] == '\0') >+ return false; >+ >+ return !symlink(targetPathFSRep.data(), symbolicLinkPathFSRep.data()); >+} >+ >+String pathGetFileName(const String& pathName) >+{ >+ GUniquePtr<gchar> tmpFilename = unescapedFilename(pathName); >+ if (!tmpFilename) >+ return pathName; >+ >+ GUniquePtr<gchar> baseName(g_path_get_basename(tmpFilename.get())); >+ return String::fromUTF8(baseName.get()); >+} >+ >+bool getVolumeFreeSpace(const String& path, uint64_t& freeSpace) >+{ >+ GUniquePtr<gchar> filename = unescapedFilename(path); >+ if (!filename) >+ return false; >+ >+ GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(filename.get())); >+ GRefPtr<GFileInfo> fileInfo = adoptGRef(g_file_query_filesystem_info(file.get(), G_FILE_ATTRIBUTE_FILESYSTEM_FREE, 0, 0)); >+ if (!fileInfo) >+ return false; >+ >+ freeSpace = g_file_info_get_attribute_uint64(fileInfo.get(), G_FILE_ATTRIBUTE_FILESYSTEM_FREE); >+ return !!freeSpace; >+} >+ >+String directoryName(const String& path) >+{ >+ GUniquePtr<gchar> filename = unescapedFilename(path); >+ if (!filename) >+ return String(); >+ >+ GUniquePtr<char> dirname(g_path_get_dirname(filename.get())); >+ return String::fromUTF8(dirname.get()); >+} >+ >+Vector<String> listDirectory(const String& path, const String& filter) >+{ >+ Vector<String> entries; >+ >+ GUniquePtr<gchar> filename = unescapedFilename(path); >+ if (!filename) >+ return entries; >+ >+ GUniquePtr<GDir> dir(g_dir_open(filename.get(), 0, nullptr)); >+ if (!dir) >+ return entries; >+ >+ GUniquePtr<GPatternSpec> pspec(g_pattern_spec_new((filter.utf8()).data())); >+ while (const char* name = g_dir_read_name(dir.get())) { >+ if (!g_pattern_match_string(pspec.get(), name)) >+ continue; >+ >+ GUniquePtr<gchar> entry(g_build_filename(filename.get(), name, nullptr)); >+ entries.append(stringFromFileSystemRepresentation(entry.get())); >+ } >+ >+ return entries; >+} >+ >+String openTemporaryFile(const String& prefix, PlatformFileHandle& handle) >+{ >+ GUniquePtr<gchar> filename(g_strdup_printf("%s%s", prefix.utf8().data(), createCanonicalUUIDString().utf8().data())); >+ GUniquePtr<gchar> tempPath(g_build_filename(g_get_tmp_dir(), filename.get(), NULL)); >+ GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(tempPath.get())); >+ >+ handle = g_file_create_readwrite(file.get(), G_FILE_CREATE_NONE, 0, 0); >+ if (!isHandleValid(handle)) >+ return String(); >+ return String::fromUTF8(tempPath.get()); >+} >+ >+PlatformFileHandle openFile(const String& path, FileOpenMode mode) >+{ >+ GUniquePtr<gchar> filename = unescapedFilename(path); >+ if (!filename) >+ return invalidPlatformFileHandle; >+ >+ GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(filename.get())); >+ GFileIOStream* ioStream = 0; >+ if (mode == FileOpenMode::Read) >+ ioStream = g_file_open_readwrite(file.get(), 0, 0); >+ 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 >+ ioStream = g_file_create_readwrite(file.get(), G_FILE_CREATE_NONE, 0, 0); >+ } >+ >+ return ioStream; >+} >+ >+void closeFile(PlatformFileHandle& handle) >+{ >+ if (!isHandleValid(handle)) >+ return; >+ >+ g_io_stream_close(G_IO_STREAM(handle), 0, 0); >+ g_object_unref(handle); >+ handle = invalidPlatformFileHandle; >+} >+ >+long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) >+{ >+ GSeekType seekType = G_SEEK_SET; >+ switch (origin) { >+ case FileSeekOrigin::Beginning: >+ seekType = G_SEEK_SET; >+ break; >+ case FileSeekOrigin::Current: >+ seekType = G_SEEK_CUR; >+ break; >+ case FileSeekOrigin::End: >+ seekType = G_SEEK_END; >+ break; >+ default: >+ ASSERT_NOT_REACHED(); >+ } >+ >+ if (!g_seekable_seek(G_SEEKABLE(g_io_stream_get_input_stream(G_IO_STREAM(handle))), >+ offset, seekType, 0, 0)) >+ { >+ return -1; >+ } >+ return g_seekable_tell(G_SEEKABLE(g_io_stream_get_input_stream(G_IO_STREAM(handle)))); >+} >+ >+int writeToFile(PlatformFileHandle handle, const char* data, int length) >+{ >+ gsize bytesWritten; >+ g_output_stream_write_all(g_io_stream_get_output_stream(G_IO_STREAM(handle)), >+ data, length, &bytesWritten, 0, 0); >+ return bytesWritten; >+} >+ >+int readFromFile(PlatformFileHandle handle, char* data, int length) >+{ >+ GUniqueOutPtr<GError> error; >+ do { >+ gssize bytesRead = g_input_stream_read(g_io_stream_get_input_stream(G_IO_STREAM(handle)), >+ data, length, 0, &error.outPtr()); >+ if (bytesRead >= 0) >+ return bytesRead; >+ } while (error && error->code == G_FILE_ERROR_INTR); >+ return -1; >+} >+ >+bool moveFile(const String& oldPath, const String& newPath) >+{ >+ GUniquePtr<gchar> oldFilename = unescapedFilename(oldPath); >+ if (!oldFilename) >+ return false; >+ >+ GUniquePtr<gchar> newFilename = unescapedFilename(newPath); >+ if (!newFilename) >+ return false; >+ >+ GRefPtr<GFile> oldFile = adoptGRef(g_file_new_for_path(oldFilename.get())); >+ GRefPtr<GFile> newFile = adoptGRef(g_file_new_for_path(newFilename.get())); >+ >+ return g_file_move(oldFile.get(), newFile.get(), G_FILE_COPY_OVERWRITE, nullptr, nullptr, nullptr, nullptr); >+} >+ >+bool hardLinkOrCopyFile(const String& source, const String& destination) >+{ >+#if OS(WINDOWS) >+ return !!::CopyFile(source.charactersWithNullTermination().data(), destination.charactersWithNullTermination().data(), TRUE); >+#else >+ GUniquePtr<gchar> sourceFilename = unescapedFilename(source); >+ if (!sourceFilename) >+ return false; >+ >+ GUniquePtr<gchar> destinationFilename = unescapedFilename(destination); >+ if (!destinationFilename) >+ return false; >+ >+ if (!link(sourceFilename.get(), destinationFilename.get())) >+ return true; >+ >+ // Hard link failed. Perform a copy instead. >+ GRefPtr<GFile> sourceFile = adoptGRef(g_file_new_for_path(sourceFilename.get())); >+ GRefPtr<GFile> destinationFile = adoptGRef(g_file_new_for_path(destinationFilename.get())); >+ return g_file_copy(sourceFile.get(), destinationFile.get(), G_FILE_COPY_NONE, nullptr, nullptr, nullptr, nullptr); >+#endif >+} >+ >+Optional<int32_t> getFileDeviceId(const CString& fsFile) >+{ >+ GUniquePtr<gchar> filename = unescapedFilename(fsFile.data()); >+ if (!filename) >+ return WTF::nullopt; >+ >+ GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(filename.get())); >+ GRefPtr<GFileInfo> fileInfo = adoptGRef(g_file_query_filesystem_info(file.get(), G_FILE_ATTRIBUTE_UNIX_DEVICE, nullptr, nullptr)); >+ if (!fileInfo) >+ return WTF::nullopt; >+ >+ return g_file_info_get_attribute_uint32(fileInfo.get(), G_FILE_ATTRIBUTE_UNIX_DEVICE); >+} >+ >+#if USE(FILE_LOCK) >+bool lockFile(PlatformFileHandle handle, OptionSet<FileLockMode> 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); >+ 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.toRaw()); >+ return result != -1; >+} >+ >+bool unlockFile(PlatformFileHandle handle) >+{ >+ 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)), LOCK_UN); >+ return result != -1; >+} >+#endif // USE(FILE_LOCK) >+ >+} // namespace FileSystem >+} // namespace WTF >diff --git a/Source/WTF/wtf/mac/FileSystemMac.mm b/Source/WTF/wtf/mac/FileSystemMac.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..92692a16fba5b15278c772f756e553a110755f2b >--- /dev/null >+++ b/Source/WTF/wtf/mac/FileSystemMac.mm >@@ -0,0 +1,88 @@ >+/* >+ * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#import "config.h" >+#import <wtf/FileSystem.h> >+ >+#if PLATFORM(MAC) >+ >+#import <wtf/cocoa/NSURLExtras.h> >+#import <wtf/spi/mac/MetadataSPI.h> >+#import <wtf/text/WTFString.h> >+ >+namespace WTF { >+ >+bool FileSystem::deleteEmptyDirectory(const String& path) >+{ >+ auto fileManager = adoptNS([[NSFileManager alloc] init]); >+ >+ if (NSArray *directoryContents = [fileManager contentsOfDirectoryAtPath:path error:nullptr]) { >+ // Explicitly look for and delete .DS_Store files. >+ if (directoryContents.count == 1 && [directoryContents.firstObject isEqualToString:@".DS_Store"]) >+ [fileManager removeItemAtPath:[path stringByAppendingPathComponent:directoryContents.firstObject] error:nullptr]; >+ } >+ >+ // rmdir(...) returns 0 on successful deletion of the path and non-zero in any other case (including invalid permissions or non-existent file) >+ return !rmdir(FileSystem::fileSystemRepresentation(path).data()); >+} >+ >+void FileSystem::setMetadataURL(const String& path, const String& metadataURLString, const String& referrer) >+{ >+ String urlString; >+ if (NSURL *url = URLWithUserTypedString(metadataURLString, nil)) >+ urlString = WTF::userVisibleString(WTF::URLByRemovingUserInfo(url)); >+ else >+ urlString = metadataURLString; >+ >+ // Call Metadata API on a background queue because it can take some time. >+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), [path = path.isolatedCopy(), urlString = urlString.isolatedCopy(), referrer = referrer.isolatedCopy()] { >+ auto item = adoptCF(MDItemCreate(kCFAllocatorDefault, path.createCFString().get())); >+ if (!item) >+ return; >+ >+ auto whereFromAttribute = adoptNS([[NSMutableArray alloc] initWithObjects:urlString, nil]); >+ if (!referrer.isNull()) >+ [whereFromAttribute addObject:referrer]; >+ >+ MDItemSetAttribute(item.get(), kMDItemWhereFroms, (__bridge CFArrayRef)whereFromAttribute.get()); >+ MDItemSetAttribute(item.get(), kMDItemDownloadedDate, (__bridge CFArrayRef)@[ [NSDate date] ]); >+ }); >+} >+ >+bool FileSystem::canExcludeFromBackup() >+{ >+ return true; >+} >+ >+bool FileSystem::excludeFromBackup(const String& path) >+{ >+ // It is critical to pass FALSE for excludeByPath because excluding by path requires root privileges. >+ CSBackupSetItemExcluded(FileSystem::pathAsURL(path).get(), TRUE, FALSE); >+ return true; >+} >+ >+} // namespace WTF >+ >+#endif // PLATFORM(MAC) >diff --git a/Source/WTF/wtf/posix/FileSystemPOSIX.cpp b/Source/WTF/wtf/posix/FileSystemPOSIX.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..c60ecb15863920fa4361fc14db8ee6d3ffe2e4f0 >--- /dev/null >+++ b/Source/WTF/wtf/posix/FileSystemPOSIX.cpp >@@ -0,0 +1,496 @@ >+/* >+ * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of >+ * its contributors may be used to endorse or promote products derived >+ * from this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include <wtf/FileSystem.h> >+ >+#include <dirent.h> >+#include <errno.h> >+#include <fcntl.h> >+#include <fnmatch.h> >+#include <libgen.h> >+#include <stdio.h> >+#include <sys/stat.h> >+#include <sys/statvfs.h> >+#include <sys/types.h> >+#include <unistd.h> >+#include <wtf/EnumTraits.h> >+#include <wtf/FileMetadata.h> >+#include <wtf/text/CString.h> >+#include <wtf/text/StringBuilder.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WTF { >+ >+namespace FileSystem { >+ >+bool fileExists(const String& path) >+{ >+ if (path.isNull()) >+ return false; >+ >+ CString fsRep = fileSystemRepresentation(path); >+ >+ if (!fsRep.data() || fsRep.data()[0] == '\0') >+ return false; >+ >+ return access(fsRep.data(), F_OK) != -1; >+} >+ >+bool deleteFile(const String& path) >+{ >+ CString fsRep = fileSystemRepresentation(path); >+ >+ if (!fsRep.data() || fsRep.data()[0] == '\0') >+ return false; >+ >+ // unlink(...) returns 0 on successful deletion of the path and non-zero in any other case (including invalid permissions or non-existent file) >+ return !unlink(fsRep.data()); >+} >+ >+PlatformFileHandle openFile(const String& path, FileOpenMode mode) >+{ >+ CString fsRep = fileSystemRepresentation(path); >+ >+ if (fsRep.isNull()) >+ return invalidPlatformFileHandle; >+ >+ int platformFlag = 0; >+ if (mode == FileOpenMode::Read) >+ platformFlag |= O_RDONLY; >+ else if (mode == FileOpenMode::Write) >+ platformFlag |= (O_WRONLY | O_CREAT | O_TRUNC); >+#if OS(DARWIN) >+ else if (mode == FileOpenMode::EventsOnly) >+ platformFlag |= O_EVTONLY; >+#endif >+ >+ return open(fsRep.data(), platformFlag, 0666); >+} >+ >+void closeFile(PlatformFileHandle& handle) >+{ >+ if (isHandleValid(handle)) { >+ close(handle); >+ handle = invalidPlatformFileHandle; >+ } >+} >+ >+long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) >+{ >+ int whence = SEEK_SET; >+ switch (origin) { >+ case FileSeekOrigin::Beginning: >+ whence = SEEK_SET; >+ break; >+ case FileSeekOrigin::Current: >+ whence = SEEK_CUR; >+ break; >+ case FileSeekOrigin::End: >+ whence = SEEK_END; >+ break; >+ default: >+ ASSERT_NOT_REACHED(); >+ } >+ return static_cast<long long>(lseek(handle, offset, whence)); >+} >+ >+bool truncateFile(PlatformFileHandle handle, long long offset) >+{ >+ // ftruncate returns 0 to indicate the success. >+ return !ftruncate(handle, offset); >+} >+ >+int writeToFile(PlatformFileHandle handle, const char* data, int length) >+{ >+ do { >+ int bytesWritten = write(handle, data, static_cast<size_t>(length)); >+ if (bytesWritten >= 0) >+ return bytesWritten; >+ } while (errno == EINTR); >+ return -1; >+} >+ >+int readFromFile(PlatformFileHandle handle, char* data, int length) >+{ >+ do { >+ int bytesRead = read(handle, data, static_cast<size_t>(length)); >+ if (bytesRead >= 0) >+ return bytesRead; >+ } while (errno == EINTR); >+ return -1; >+} >+ >+#if USE(FILE_LOCK) >+bool lockFile(PlatformFileHandle handle, OptionSet<FileLockMode> 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); >+} >+ >+bool unlockFile(PlatformFileHandle handle) >+{ >+ int result = flock(handle, LOCK_UN); >+ return (result != -1); >+} >+#endif >+ >+#if !PLATFORM(MAC) >+bool deleteEmptyDirectory(const String& path) >+{ >+ CString fsRep = fileSystemRepresentation(path); >+ >+ if (!fsRep.data() || fsRep.data()[0] == '\0') >+ return false; >+ >+ // rmdir(...) returns 0 on successful deletion of the path and non-zero in any other case (including invalid permissions or non-existent file) >+ return !rmdir(fsRep.data()); >+} >+#endif >+ >+bool getFileSize(const String& path, long long& result) >+{ >+ CString fsRep = fileSystemRepresentation(path); >+ >+ if (!fsRep.data() || fsRep.data()[0] == '\0') >+ return false; >+ >+ struct stat fileInfo; >+ >+ if (stat(fsRep.data(), &fileInfo)) >+ return false; >+ >+ result = fileInfo.st_size; >+ return true; >+} >+ >+bool getFileSize(PlatformFileHandle handle, long long& result) >+{ >+ struct stat fileInfo; >+ if (fstat(handle, &fileInfo)) >+ return false; >+ >+ result = fileInfo.st_size; >+ return true; >+} >+ >+Optional<WallTime> getFileCreationTime(const String& path) >+{ >+#if OS(DARWIN) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD) >+ CString fsRep = fileSystemRepresentation(path); >+ >+ if (!fsRep.data() || fsRep.data()[0] == '\0') >+ return WTF::nullopt; >+ >+ struct stat fileInfo; >+ >+ if (stat(fsRep.data(), &fileInfo)) >+ return WTF::nullopt; >+ >+ return WallTime::fromRawSeconds(fileInfo.st_birthtime); >+#else >+ UNUSED_PARAM(path); >+ return WTF::nullopt; >+#endif >+} >+ >+Optional<WallTime> getFileModificationTime(const String& path) >+{ >+ CString fsRep = fileSystemRepresentation(path); >+ >+ if (!fsRep.data() || fsRep.data()[0] == '\0') >+ return WTF::nullopt; >+ >+ struct stat fileInfo; >+ >+ if (stat(fsRep.data(), &fileInfo)) >+ return WTF::nullopt; >+ >+ return WallTime::fromRawSeconds(fileInfo.st_mtime); >+} >+ >+static FileMetadata::Type toFileMetataType(struct stat fileInfo) >+{ >+ if (S_ISDIR(fileInfo.st_mode)) >+ return FileMetadata::Type::Directory; >+ if (S_ISLNK(fileInfo.st_mode)) >+ return FileMetadata::Type::SymbolicLink; >+ return FileMetadata::Type::File; >+} >+ >+static Optional<FileMetadata> fileMetadataUsingFunction(const String& path, int (*statFunc)(const char*, struct stat*)) >+{ >+ CString fsRep = fileSystemRepresentation(path); >+ >+ if (!fsRep.data() || fsRep.data()[0] == '\0') >+ return WTF::nullopt; >+ >+ struct stat fileInfo; >+ if (statFunc(fsRep.data(), &fileInfo)) >+ return WTF::nullopt; >+ >+ String filename = pathGetFileName(path); >+ bool isHidden = !filename.isEmpty() && filename[0] == '.'; >+ return FileMetadata { >+ WallTime::fromRawSeconds(fileInfo.st_mtime), >+ fileInfo.st_size, >+ isHidden, >+ toFileMetataType(fileInfo) >+ }; >+} >+ >+Optional<FileMetadata> fileMetadata(const String& path) >+{ >+ return fileMetadataUsingFunction(path, &lstat); >+} >+ >+Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) >+{ >+ return fileMetadataUsingFunction(path, &stat); >+} >+ >+bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath) >+{ >+ CString targetPathFSRep = fileSystemRepresentation(targetPath); >+ if (!targetPathFSRep.data() || targetPathFSRep.data()[0] == '\0') >+ return false; >+ >+ CString symbolicLinkPathFSRep = fileSystemRepresentation(symbolicLinkPath); >+ if (!symbolicLinkPathFSRep.data() || symbolicLinkPathFSRep.data()[0] == '\0') >+ return false; >+ >+ return !symlink(targetPathFSRep.data(), symbolicLinkPathFSRep.data()); >+} >+ >+String pathByAppendingComponent(const String& path, const String& component) >+{ >+ if (path.endsWith('/')) >+ return path + component; >+ return path + "/" + component; >+} >+ >+String pathByAppendingComponents(StringView path, const Vector<StringView>& components) >+{ >+ StringBuilder builder; >+ builder.append(path); >+ for (auto& component : components) { >+ builder.append('/'); >+ builder.append(component); >+ } >+ return builder.toString(); >+} >+ >+bool makeAllDirectories(const String& path) >+{ >+ CString fullPath = fileSystemRepresentation(path); >+ if (!access(fullPath.data(), F_OK)) >+ return true; >+ >+ char* p = fullPath.mutableData() + 1; >+ int length = fullPath.length(); >+ >+ if (p[length - 1] == '/') >+ p[length - 1] = '\0'; >+ for (; *p; ++p) { >+ if (*p == '/') { >+ *p = '\0'; >+ if (access(fullPath.data(), F_OK)) { >+ if (mkdir(fullPath.data(), S_IRWXU)) >+ return false; >+ } >+ *p = '/'; >+ } >+ } >+ if (access(fullPath.data(), F_OK)) { >+ if (mkdir(fullPath.data(), S_IRWXU)) >+ return false; >+ } >+ >+ return true; >+} >+ >+String pathGetFileName(const String& path) >+{ >+ return path.substring(path.reverseFind('/') + 1); >+} >+ >+String directoryName(const String& path) >+{ >+ CString fsRep = fileSystemRepresentation(path); >+ >+ if (!fsRep.data() || fsRep.data()[0] == '\0') >+ return String(); >+ >+ return String::fromUTF8(dirname(fsRep.mutableData())); >+} >+ >+Vector<String> listDirectory(const String& path, const String& filter) >+{ >+ Vector<String> entries; >+ CString cpath = fileSystemRepresentation(path); >+ CString cfilter = fileSystemRepresentation(filter); >+ DIR* dir = opendir(cpath.data()); >+ if (dir) { >+ struct dirent* dp; >+ while ((dp = readdir(dir))) { >+ const char* name = dp->d_name; >+ if (!strcmp(name, ".") || !strcmp(name, "..")) >+ continue; >+ if (fnmatch(cfilter.data(), name, 0)) >+ continue; >+ char filePath[PATH_MAX]; >+ if (static_cast<int>(sizeof(filePath) - 1) < snprintf(filePath, sizeof(filePath), "%s/%s", cpath.data(), name)) >+ continue; // buffer overflow >+ >+ auto string = stringFromFileSystemRepresentation(filePath); >+ >+ // Some file system representations cannot be represented as a UTF-16 string, >+ // so this string might be null. >+ if (!string.isNull()) >+ entries.append(WTFMove(string)); >+ } >+ closedir(dir); >+ } >+ return entries; >+} >+ >+#if !PLATFORM(COCOA) >+String stringFromFileSystemRepresentation(const char* path) >+{ >+ if (!path) >+ return String(); >+ >+ return String::fromUTF8(path); >+} >+ >+CString fileSystemRepresentation(const String& path) >+{ >+ return path.utf8(); >+} >+ >+bool moveFile(const String& oldPath, const String& newPath) >+{ >+ auto oldFilename = fileSystemRepresentation(oldPath); >+ if (oldFilename.isNull()) >+ return false; >+ >+ auto newFilename = fileSystemRepresentation(newPath); >+ if (newFilename.isNull()) >+ return false; >+ >+ return rename(oldFilename.data(), newFilename.data()) != -1; >+} >+ >+bool getVolumeFreeSpace(const String& path, uint64_t& freeSpace) >+{ >+ struct statvfs fileSystemStat; >+ if (statvfs(fileSystemRepresentation(path).data(), &fileSystemStat)) { >+ freeSpace = fileSystemStat.f_bavail * fileSystemStat.f_frsize; >+ return true; >+ } >+ return false; >+} >+#endif >+ >+#if !OS(DARWIN) >+String openTemporaryFile(const String& prefix, PlatformFileHandle& handle) >+{ >+ char buffer[PATH_MAX]; >+ const char* tmpDir = getenv("TMPDIR"); >+ >+ if (!tmpDir) >+ tmpDir = "/tmp"; >+ >+ if (snprintf(buffer, PATH_MAX, "%s/%sXXXXXX", tmpDir, prefix.utf8().data()) >= PATH_MAX) >+ goto end; >+ >+ handle = mkstemp(buffer); >+ if (handle < 0) >+ goto end; >+ >+ return String::fromUTF8(buffer); >+ >+end: >+ handle = invalidPlatformFileHandle; >+ return String(); >+} >+#endif >+ >+bool hardLinkOrCopyFile(const String& source, const String& destination) >+{ >+ if (source.isEmpty() || destination.isEmpty()) >+ return false; >+ >+ CString fsSource = fileSystemRepresentation(source); >+ if (!fsSource.data()) >+ return false; >+ >+ CString fsDestination = fileSystemRepresentation(destination); >+ if (!fsDestination.data()) >+ return false; >+ >+ if (!link(fsSource.data(), fsDestination.data())) >+ return true; >+ >+ // Hard link failed. Perform a copy instead. >+ auto handle = open(fsDestination.data(), O_WRONLY | O_CREAT | O_EXCL, 0666); >+ if (handle == -1) >+ return false; >+ >+ bool appendResult = appendFileContentsToFileHandle(source, handle); >+ close(handle); >+ >+ // If the copy failed, delete the unusable file. >+ if (!appendResult) >+ unlink(fsDestination.data()); >+ >+ return appendResult; >+} >+ >+Optional<int32_t> getFileDeviceId(const CString& fsFile) >+{ >+ struct stat fileStat; >+ if (stat(fsFile.data(), &fileStat) == -1) >+ return WTF::nullopt; >+ >+ return fileStat.st_dev; >+} >+ >+String realPath(const String& filePath) >+{ >+ CString fsRep = fileSystemRepresentation(filePath); >+ char resolvedName[PATH_MAX]; >+ const char* result = realpath(fsRep.data(), resolvedName); >+ return result ? String::fromUTF8(result) : filePath; >+} >+ >+} // namespace FileSystem >+} // namespace WTF >diff --git a/Source/WTF/wtf/spi/mac/MetadataSPI.h b/Source/WTF/wtf/spi/mac/MetadataSPI.h >new file mode 100644 >index 0000000000000000000000000000000000000000..815547c6b8510e30618e2282ad5b784016ca3721 >--- /dev/null >+++ b/Source/WTF/wtf/spi/mac/MetadataSPI.h >@@ -0,0 +1,38 @@ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if USE(APPLE_INTERNAL_SDK) >+ >+#include <CoreServices/CoreServicesPriv.h> >+ >+#endif >+ >+WTF_EXTERN_C_BEGIN >+ >+Boolean MDItemSetAttribute(MDItemRef, CFStringRef name, CFTypeRef attr); >+ >+WTF_EXTERN_C_END >diff --git a/Source/WTF/wtf/win/FileSystemWin.cpp b/Source/WTF/wtf/win/FileSystemWin.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..c16472cdd3f5ba077b972456008a4940946eede4 >--- /dev/null >+++ b/Source/WTF/wtf/win/FileSystemWin.cpp >@@ -0,0 +1,586 @@ >+/* >+ * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2008 Collabora, Ltd. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of >+ * its contributors may be used to endorse or promote products derived >+ * from this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include <wtf/FileSystem.h> >+ >+#include <io.h> >+#include <shlobj.h> >+#include <shlwapi.h> >+#include <sys/stat.h> >+#include <windows.h> >+#include <wtf/CryptographicallyRandomNumber.h> >+#include <wtf/FileMetadata.h> >+#include <wtf/HashMap.h> >+#include <wtf/text/CString.h> >+#include <wtf/text/StringBuilder.h> >+#include <wtf/text/win/WCharStringExtras.h> >+#include <wtf/win/PathWalker.h> >+ >+namespace WTF { >+ >+namespace FileSystem { >+ >+static const ULONGLONG kSecondsFromFileTimeToTimet = 11644473600; >+ >+static bool getFindData(String path, WIN32_FIND_DATAW& findData) >+{ >+ HANDLE handle = FindFirstFileW(stringToNullTerminatedWChar(path).data(), &findData); >+ if (handle == INVALID_HANDLE_VALUE) >+ return false; >+ FindClose(handle); >+ return true; >+} >+ >+static bool getFileSizeFromFindData(const WIN32_FIND_DATAW& findData, long long& size) >+{ >+ ULARGE_INTEGER fileSize; >+ fileSize.HighPart = findData.nFileSizeHigh; >+ fileSize.LowPart = findData.nFileSizeLow; >+ >+ if (fileSize.QuadPart > static_cast<ULONGLONG>(std::numeric_limits<long long>::max())) >+ return false; >+ >+ size = fileSize.QuadPart; >+ return true; >+} >+ >+static bool getFileSizeFromByHandleFileInformationStructure(const BY_HANDLE_FILE_INFORMATION& fileInformation, long long& size) >+{ >+ ULARGE_INTEGER fileSize; >+ fileSize.HighPart = fileInformation.nFileSizeHigh; >+ fileSize.LowPart = fileInformation.nFileSizeLow; >+ >+ if (fileSize.QuadPart > static_cast<ULONGLONG>(std::numeric_limits<long long>::max())) >+ return false; >+ >+ size = fileSize.QuadPart; >+ return true; >+} >+ >+static void getFileCreationTimeFromFindData(const WIN32_FIND_DATAW& findData, time_t& time) >+{ >+ ULARGE_INTEGER fileTime; >+ fileTime.HighPart = findData.ftCreationTime.dwHighDateTime; >+ fileTime.LowPart = findData.ftCreationTime.dwLowDateTime; >+ >+ // Information about converting time_t to FileTime is available at http://msdn.microsoft.com/en-us/library/ms724228%28v=vs.85%29.aspx >+ time = fileTime.QuadPart / 10000000 - kSecondsFromFileTimeToTimet; >+} >+ >+ >+static void getFileModificationTimeFromFindData(const WIN32_FIND_DATAW& findData, time_t& time) >+{ >+ ULARGE_INTEGER fileTime; >+ fileTime.HighPart = findData.ftLastWriteTime.dwHighDateTime; >+ fileTime.LowPart = findData.ftLastWriteTime.dwLowDateTime; >+ >+ // Information about converting time_t to FileTime is available at http://msdn.microsoft.com/en-us/library/ms724228%28v=vs.85%29.aspx >+ time = fileTime.QuadPart / 10000000 - kSecondsFromFileTimeToTimet; >+} >+ >+bool getFileSize(const String& path, long long& size) >+{ >+ WIN32_FIND_DATAW findData; >+ if (!getFindData(path, findData)) >+ return false; >+ >+ return getFileSizeFromFindData(findData, size); >+} >+ >+bool getFileSize(PlatformFileHandle fileHandle, long long& size) >+{ >+ BY_HANDLE_FILE_INFORMATION fileInformation; >+ if (!::GetFileInformationByHandle(fileHandle, &fileInformation)) >+ return false; >+ >+ return getFileSizeFromByHandleFileInformationStructure(fileInformation, size); >+} >+ >+Optional<WallTime> getFileModificationTime(const String& path) >+{ >+ WIN32_FIND_DATAW findData; >+ if (!getFindData(path, findData)) >+ return WTF::nullopt; >+ >+ time_t time = 0; >+ getFileModificationTimeFromFindData(findData, time); >+ return WallTime::fromRawSeconds(time); >+} >+ >+Optional<WallTime> getFileCreationTime(const String& path) >+{ >+ WIN32_FIND_DATAW findData; >+ if (!getFindData(path, findData)) >+ return WTF::nullopt; >+ >+ time_t time = 0; >+ getFileCreationTimeFromFindData(findData, time); >+ return WallTime::fromRawSeconds(time); >+} >+ >+static String getFinalPathName(const String& path) >+{ >+ auto handle = openFile(path, FileOpenMode::Read); >+ if (!isHandleValid(handle)) >+ return String(); >+ >+ Vector<UChar> buffer(MAX_PATH); >+ if (::GetFinalPathNameByHandleW(handle, buffer.data(), buffer.size(), VOLUME_NAME_NT) >= MAX_PATH) { >+ closeFile(handle); >+ return String(); >+ } >+ closeFile(handle); >+ >+ buffer.shrink(wcslen(buffer.data())); >+ return String::adopt(WTFMove(buffer)); >+} >+ >+static inline bool isSymbolicLink(WIN32_FIND_DATAW findData) >+{ >+ return findData.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT && findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK; >+} >+ >+static FileMetadata::Type toFileMetadataType(WIN32_FIND_DATAW findData) >+{ >+ if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) >+ return FileMetadata::Type::Directory; >+ if (isSymbolicLink(findData)) >+ return FileMetadata::Type::SymbolicLink; >+ return FileMetadata::Type::File; >+} >+ >+static Optional<FileMetadata> findDataToFileMetadata(WIN32_FIND_DATAW findData) >+{ >+ long long length; >+ if (!getFileSizeFromFindData(findData, length)) >+ return WTF::nullopt; >+ >+ time_t modificationTime; >+ getFileModificationTimeFromFindData(findData, modificationTime); >+ >+ return FileMetadata { >+ WallTime::fromRawSeconds(modificationTime), >+ length, >+ static_cast<bool>(findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN), >+ toFileMetadataType(findData) >+ }; >+} >+ >+Optional<FileMetadata> fileMetadata(const String& path) >+{ >+ WIN32_FIND_DATAW findData; >+ if (!getFindData(path, findData)) >+ return WTF::nullopt; >+ >+ return findDataToFileMetadata(findData); >+} >+ >+Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) >+{ >+ WIN32_FIND_DATAW findData; >+ if (!getFindData(path, findData)) >+ return WTF::nullopt; >+ >+ if (isSymbolicLink(findData)) { >+ String targetPath = getFinalPathName(path); >+ if (targetPath.isNull()) >+ return WTF::nullopt; >+ if (!getFindData(targetPath, findData)) >+ return WTF::nullopt; >+ } >+ >+ return findDataToFileMetadata(findData); >+} >+ >+bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath) >+{ >+ return !::CreateSymbolicLinkW(stringToNullTerminatedWChar(symbolicLinkPath).data(), stringToNullTerminatedWChar(targetPath).data(), 0); >+} >+ >+bool fileExists(const String& path) >+{ >+ WIN32_FIND_DATAW findData; >+ return getFindData(path, findData); >+} >+ >+bool deleteFile(const String& path) >+{ >+ String filename = path; >+ return !!DeleteFileW(stringToNullTerminatedWChar(filename).data()); >+} >+ >+bool deleteEmptyDirectory(const String& path) >+{ >+ String filename = path; >+ return !!RemoveDirectoryW(stringToNullTerminatedWChar(filename).data()); >+} >+ >+bool moveFile(const String& oldPath, const String& newPath) >+{ >+ String oldFilename = oldPath; >+ String newFilename = newPath; >+ return !!::MoveFileEx(stringToNullTerminatedWChar(oldFilename).data(), stringToNullTerminatedWChar(newFilename).data(), MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); >+} >+ >+String pathByAppendingComponent(const String& path, const String& component) >+{ >+ Vector<UChar> buffer(MAX_PATH); >+ >+ if (path.length() + 1 > buffer.size()) >+ return String(); >+ >+ StringView(path).getCharactersWithUpconvert(buffer.data()); >+ buffer[path.length()] = '\0'; >+ >+ if (!PathAppendW(buffer.data(), stringToNullTerminatedWChar(component).data())) >+ return String(); >+ >+ buffer.shrink(wcslen(buffer.data())); >+ >+ return String::adopt(WTFMove(buffer)); >+} >+ >+String pathByAppendingComponents(StringView path, const Vector<StringView>& components) >+{ >+ String result = path.toString(); >+ for (auto& component : components) >+ result = pathByAppendingComponent(result, component.toString()); >+ return result; >+} >+ >+#if !USE(CF) >+ >+CString fileSystemRepresentation(const String& path) >+{ >+ auto upconvertedCharacters = path.upconvertedCharacters(); >+ >+ const UChar* characters = upconvertedCharacters; >+ int size = WideCharToMultiByte(CP_ACP, 0, characters, path.length(), 0, 0, 0, 0) - 1; >+ >+ char* buffer; >+ CString string = CString::newUninitialized(size, buffer); >+ >+ WideCharToMultiByte(CP_ACP, 0, characters, path.length(), buffer, size, 0, 0); >+ >+ return string; >+} >+ >+#endif // !USE(CF) >+ >+bool makeAllDirectories(const String& path) >+{ >+ String fullPath = path; >+ if (SHCreateDirectoryEx(0, stringToNullTerminatedWChar(fullPath).data(), 0) != ERROR_SUCCESS) { >+ DWORD error = GetLastError(); >+ if (error != ERROR_FILE_EXISTS && error != ERROR_ALREADY_EXISTS) { >+ LOG_ERROR("Failed to create path %s", path.ascii().data()); >+ return false; >+ } >+ } >+ return true; >+} >+ >+String homeDirectoryPath() >+{ >+ return ""; >+} >+ >+String pathGetFileName(const String& path) >+{ >+ return nullTerminatedWCharToString(::PathFindFileName(stringToNullTerminatedWChar(path).data())); >+} >+ >+String directoryName(const String& path) >+{ >+ String name = path.left(path.length() - pathGetFileName(path).length()); >+ if (name.characterStartingAt(name.length() - 1) == '\\') { >+ // Remove any trailing "\". >+ name.truncate(name.length() - 1); >+ } >+ return name; >+} >+ >+static String bundleName() >+{ >+ static const NeverDestroyed<String> name = [] { >+ String name { "WebKit"_s }; >+ >+#if USE(CF) >+ if (CFBundleRef bundle = CFBundleGetMainBundle()) { >+ if (CFTypeRef bundleExecutable = CFBundleGetValueForInfoDictionaryKey(bundle, kCFBundleExecutableKey)) { >+ if (CFGetTypeID(bundleExecutable) == CFStringGetTypeID()) >+ name = reinterpret_cast<CFStringRef>(bundleExecutable); >+ } >+ } >+#endif >+ >+ return name; >+ }(); >+ >+ return name; >+} >+ >+static String storageDirectory(DWORD pathIdentifier) >+{ >+ Vector<UChar> buffer(MAX_PATH); >+ if (FAILED(SHGetFolderPathW(0, pathIdentifier | CSIDL_FLAG_CREATE, 0, 0, buffer.data()))) >+ return String(); >+ buffer.resize(wcslen(buffer.data())); >+ String directory = String::adopt(WTFMove(buffer)); >+ >+ directory = pathByAppendingComponent(directory, "Apple Computer\\" + bundleName()); >+ if (!makeAllDirectories(directory)) >+ return String(); >+ >+ return directory; >+} >+ >+static String cachedStorageDirectory(DWORD pathIdentifier) >+{ >+ static HashMap<DWORD, String> directories; >+ >+ HashMap<DWORD, String>::iterator it = directories.find(pathIdentifier); >+ if (it != directories.end()) >+ return it->value; >+ >+ String directory = storageDirectory(pathIdentifier); >+ directories.add(pathIdentifier, directory); >+ >+ return directory; >+} >+ >+static String generateTemporaryPath(const Function<bool(const String&)>& action) >+{ >+ wchar_t tempPath[MAX_PATH]; >+ int tempPathLength = ::GetTempPathW(WTF_ARRAY_LENGTH(tempPath), tempPath); >+ if (tempPathLength <= 0 || tempPathLength > WTF_ARRAY_LENGTH(tempPath)) >+ return String(); >+ >+ String proposedPath; >+ do { >+ wchar_t tempFile[] = L"XXXXXXXX.tmp"; // Use 8.3 style name (more characters aren't helpful due to 8.3 short file names) >+ const int randomPartLength = 8; >+ cryptographicallyRandomValues(tempFile, randomPartLength * sizeof(wchar_t)); >+ >+ // Limit to valid filesystem characters, also excluding others that could be problematic, like punctuation. >+ // don't include both upper and lowercase since Windows file systems are typically not case sensitive. >+ const char validChars[] = "0123456789abcdefghijklmnopqrstuvwxyz"; >+ for (int i = 0; i < randomPartLength; ++i) >+ tempFile[i] = validChars[tempFile[i] % (sizeof(validChars) - 1)]; >+ >+ ASSERT(wcslen(tempFile) == WTF_ARRAY_LENGTH(tempFile) - 1); >+ >+ proposedPath = pathByAppendingComponent(nullTerminatedWCharToString(tempPath), nullTerminatedWCharToString(tempFile)); >+ if (proposedPath.isEmpty()) >+ break; >+ } while (!action(proposedPath)); >+ >+ return proposedPath; >+} >+ >+String openTemporaryFile(const String&, PlatformFileHandle& handle) >+{ >+ handle = INVALID_HANDLE_VALUE; >+ >+ String proposedPath = generateTemporaryPath([&handle](const String& proposedPath) { >+ // use CREATE_NEW to avoid overwriting an existing file with the same name >+ handle = ::CreateFileW(stringToNullTerminatedWChar(proposedPath).data(), GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0); >+ >+ return isHandleValid(handle) || GetLastError() == ERROR_ALREADY_EXISTS; >+ }); >+ >+ if (!isHandleValid(handle)) >+ return String(); >+ >+ return proposedPath; >+} >+ >+PlatformFileHandle openFile(const String& path, FileOpenMode mode) >+{ >+ DWORD desiredAccess = 0; >+ DWORD creationDisposition = 0; >+ DWORD shareMode = 0; >+ switch (mode) { >+ case FileOpenMode::Read: >+ desiredAccess = GENERIC_READ; >+ creationDisposition = OPEN_EXISTING; >+ shareMode = FILE_SHARE_READ; >+ break; >+ case FileOpenMode::Write: >+ desiredAccess = GENERIC_WRITE; >+ creationDisposition = CREATE_ALWAYS; >+ break; >+ default: >+ ASSERT_NOT_REACHED(); >+ } >+ >+ String destination = path; >+ return CreateFile(stringToNullTerminatedWChar(destination).data(), desiredAccess, shareMode, 0, creationDisposition, FILE_ATTRIBUTE_NORMAL, 0); >+} >+ >+void closeFile(PlatformFileHandle& handle) >+{ >+ if (isHandleValid(handle)) { >+ ::CloseHandle(handle); >+ handle = invalidPlatformFileHandle; >+ } >+} >+ >+long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) >+{ >+ DWORD moveMethod = FILE_BEGIN; >+ >+ if (origin == FileSeekOrigin::Current) >+ moveMethod = FILE_CURRENT; >+ else if (origin == FileSeekOrigin::End) >+ moveMethod = FILE_END; >+ >+ LARGE_INTEGER largeOffset; >+ largeOffset.QuadPart = offset; >+ >+ largeOffset.LowPart = SetFilePointer(handle, largeOffset.LowPart, &largeOffset.HighPart, moveMethod); >+ >+ if (largeOffset.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) >+ return -1; >+ >+ return largeOffset.QuadPart; >+} >+ >+int writeToFile(PlatformFileHandle handle, const char* data, int length) >+{ >+ if (!isHandleValid(handle)) >+ return -1; >+ >+ DWORD bytesWritten; >+ bool success = WriteFile(handle, data, length, &bytesWritten, 0); >+ >+ if (!success) >+ return -1; >+ return static_cast<int>(bytesWritten); >+} >+ >+int readFromFile(PlatformFileHandle handle, char* data, int length) >+{ >+ if (!isHandleValid(handle)) >+ return -1; >+ >+ DWORD bytesRead; >+ bool success = ::ReadFile(handle, data, length, &bytesRead, 0); >+ >+ if (!success) >+ return -1; >+ return static_cast<int>(bytesRead); >+} >+ >+bool hardLinkOrCopyFile(const String& source, const String& destination) >+{ >+ return !!::CopyFile(stringToNullTerminatedWChar(source).data(), stringToNullTerminatedWChar(destination).data(), TRUE); >+} >+ >+String localUserSpecificStorageDirectory() >+{ >+ return cachedStorageDirectory(CSIDL_LOCAL_APPDATA); >+} >+ >+String roamingUserSpecificStorageDirectory() >+{ >+ return cachedStorageDirectory(CSIDL_APPDATA); >+} >+ >+Vector<String> listDirectory(const String& directory, const String& filter) >+{ >+ Vector<String> entries; >+ >+ PathWalker walker(directory, filter); >+ if (!walker.isValid()) >+ return entries; >+ >+ do { >+ if (walker.data().dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY >+ && (!wcscmp(walker.data().cFileName, L".") || !wcscmp(walker.data().cFileName, L".."))) >+ continue; >+ >+ entries.append(directory + "\\" + reinterpret_cast<const UChar*>(walker.data().cFileName)); >+ } while (walker.step()); >+ >+ return entries; >+} >+ >+bool getVolumeFreeSpace(const String&, uint64_t&) >+{ >+ return false; >+} >+ >+Optional<int32_t> getFileDeviceId(const CString& fsFile) >+{ >+ auto handle = openFile(fsFile.data(), FileOpenMode::Read); >+ if (!isHandleValid(handle)) >+ return WTF::nullopt; >+ >+ BY_HANDLE_FILE_INFORMATION fileInformation = { }; >+ if (!::GetFileInformationByHandle(handle, &fileInformation)) { >+ closeFile(handle); >+ return WTF::nullopt; >+ } >+ >+ closeFile(handle); >+ >+ return fileInformation.dwVolumeSerialNumber; >+} >+ >+String realPath(const String& filePath) >+{ >+ return getFinalPathName(filePath); >+} >+ >+String createTemporaryDirectory() >+{ >+ return generateTemporaryPath([](const String& proposedPath) { >+ return makeAllDirectories(proposedPath); >+ }); >+} >+ >+bool deleteNonEmptyDirectory(const String& directoryPath) >+{ >+ SHFILEOPSTRUCT deleteOperation = { >+ nullptr, >+ FO_DELETE, >+ stringToNullTerminatedWChar(directoryPath).data(), >+ L"", >+ FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT, >+ false, >+ 0, >+ L"" >+ }; >+ return !SHFileOperation(&deleteOperation); >+} >+ >+} // namespace FileSystem >+} // namespace WTF >diff --git a/Source/WTF/wtf/win/PathWalker.cpp b/Source/WTF/wtf/win/PathWalker.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..c6d3f9706049cb13c9ef6355ebb63a5079850221 >--- /dev/null >+++ b/Source/WTF/wtf/win/PathWalker.cpp >@@ -0,0 +1,52 @@ >+/* >+ * Copyright (C) 2011 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include <wtf/win/PathWalker.h> >+ >+#include <wtf/text/WTFString.h> >+#include <wtf/text/win/WCharStringExtras.h> >+ >+namespace WTF { >+ >+PathWalker::PathWalker(const String& directory, const String& pattern) >+{ >+ String path = directory + "\\" + pattern; >+ m_handle = ::FindFirstFileW(stringToNullTerminatedWChar(path).data(), &m_data); >+} >+ >+PathWalker::~PathWalker() >+{ >+ if (!isValid()) >+ return; >+ ::FindClose(m_handle); >+} >+ >+bool PathWalker::step() >+{ >+ return ::FindNextFileW(m_handle, &m_data); >+} >+ >+} // namespace WTF >diff --git a/Source/WTF/wtf/win/PathWalker.h b/Source/WTF/wtf/win/PathWalker.h >new file mode 100644 >index 0000000000000000000000000000000000000000..953ae2e6ae8561af3454e218388df89005ea33bc >--- /dev/null >+++ b/Source/WTF/wtf/win/PathWalker.h >@@ -0,0 +1,48 @@ >+/* >+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include <Windows.h> >+#include <wtf/Forward.h> >+#include <wtf/Noncopyable.h> >+ >+namespace WTF { >+ >+class PathWalker { >+ WTF_MAKE_NONCOPYABLE(PathWalker); >+public: >+ PathWalker(const WTF::String& directory, const WTF::String& pattern); >+ ~PathWalker(); >+ >+ bool isValid() const { return m_handle != INVALID_HANDLE_VALUE; } >+ const WIN32_FIND_DATAW& data() const { return m_data; } >+ >+ bool step(); >+ >+private: >+ HANDLE m_handle; >+ WIN32_FIND_DATAW m_data; >+}; >+ >+} // namespace WTF >diff --git a/Source/WebCore/Modules/encryptedmedia/CDM.cpp b/Source/WebCore/Modules/encryptedmedia/CDM.cpp >index 93566501a99e19888b1bd395452881c474557df6..818f224bd56483c8ad6602b302d6ae0b72ded1a6 100644 >--- a/Source/WebCore/Modules/encryptedmedia/CDM.cpp >+++ b/Source/WebCore/Modules/encryptedmedia/CDM.cpp >@@ -31,7 +31,6 @@ > #include "CDMFactory.h" > #include "CDMPrivate.h" > #include "Document.h" >-#include "FileSystem.h" > #include "InitDataRegistry.h" > #include "MediaKeysRequirement.h" > #include "MediaPlayer.h" >@@ -42,6 +41,7 @@ > #include "SecurityOrigin.h" > #include "SecurityOriginData.h" > #include "Settings.h" >+#include <wtf/FileSystem.h> > #include <wtf/NeverDestroyed.h> > > namespace WebCore { >diff --git a/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp b/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp >index e666ce97936745eda0106607978f6e9809ff0b39..65edda16f7950d249bcf7316286150854ef281d4 100644 >--- a/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp >+++ b/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp >@@ -30,13 +30,13 @@ > > #include "Document.h" > #include "EventNames.h" >-#include "FileSystem.h" > #include "Page.h" > #include "SecurityOriginData.h" > #include "Settings.h" > #include "WebKitMediaKeyError.h" > #include "WebKitMediaKeyMessageEvent.h" > #include "WebKitMediaKeys.h" >+#include <wtf/FileSystem.h> > > namespace WebCore { > >diff --git a/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp b/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp >index 6dd4171308ad467f2a4c27c9ce97729b3fad8cf9..368794ef5c1a0fe798b2a1ba50886c0b4febcb94 100644 >--- a/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp >+++ b/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp >@@ -27,12 +27,12 @@ > #include "DOMFileSystem.h" > > #include "File.h" >-#include "FileMetadata.h" >-#include "FileSystem.h" > #include "FileSystemDirectoryEntry.h" > #include "FileSystemFileEntry.h" > #include "ScriptExecutionContext.h" > #include <wtf/CrossThreadCopier.h> >+#include <wtf/FileMetadata.h> >+#include <wtf/FileSystem.h> > #include <wtf/UUID.h> > #include <wtf/text/StringBuilder.h> > >diff --git a/Source/WebCore/Modules/entriesapi/FileSystemEntry.cpp b/Source/WebCore/Modules/entriesapi/FileSystemEntry.cpp >index dccb5a11863d9bb10f287d57fdc139a0b9b1b111..424cca26cd4c7b86103fd520f1ff70f0da0351eb 100644 >--- a/Source/WebCore/Modules/entriesapi/FileSystemEntry.cpp >+++ b/Source/WebCore/Modules/entriesapi/FileSystemEntry.cpp >@@ -29,10 +29,10 @@ > #include "DOMException.h" > #include "DOMFileSystem.h" > #include "ErrorCallback.h" >-#include "FileSystem.h" > #include "FileSystemDirectoryEntry.h" > #include "FileSystemEntryCallback.h" > #include "ScriptExecutionContext.h" >+#include <wtf/FileSystem.h> > > namespace WebCore { > >diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp >index c7fdfd0dd6545f8c6fe5342fb3646fe9a84694b9..b429b3f26b9346fbb1dae7ec650e46e256dfc8c9 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp >@@ -28,8 +28,8 @@ > > #if ENABLE(INDEXED_DATABASE) > >-#include "FileSystem.h" > #include "SecurityOrigin.h" >+#include <wtf/FileSystem.h> > #include <wtf/Ref.h> > #include <wtf/text/WTFString.h> > >diff --git a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp b/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp >index 2178cc42a9b51143ce5d85f4d11f7ab260924ec7..285d502dae81a9a768aa34a1d256df5047d61bfd 100644 >--- a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp >@@ -28,7 +28,6 @@ > > #if ENABLE(INDEXED_DATABASE) > >-#include "FileSystem.h" > #include "IDBBindingUtilities.h" > #include "IDBGetAllRecordsData.h" > #include "IDBGetAllResult.h" >@@ -54,6 +53,7 @@ > #include <JavaScriptCore/JSGlobalObject.h> > #include <JavaScriptCore/StrongInlines.h> > #include <JavaScriptCore/StructureInlines.h> >+#include <wtf/FileSystem.h> > #include <wtf/NeverDestroyed.h> > > namespace WebCore { >diff --git a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp b/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp >index 781b79f63a061d58d1c92a413c21afde6564936e..beea6b1670624e5c980f316634c0365dfdebc6cb 100644 >--- a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp >@@ -27,13 +27,13 @@ > > #if ENABLE(INDEXED_DATABASE) > >-#include "FileSystem.h" > #include "IDBCursorInfo.h" > #include "IndexedDB.h" > #include "Logging.h" > #include "SQLiteIDBBackingStore.h" > #include "SQLiteIDBCursor.h" > #include "SQLiteTransaction.h" >+#include <wtf/FileSystem.h> > > namespace WebCore { > namespace IDBServer { >diff --git a/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp b/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp >index 61aeb8f7d70151b942285acdccf81bfb1ea42626..dd9f5ad29317c5cdc758832ac6a370bdf95dd898 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp >@@ -28,7 +28,6 @@ > > #if ENABLE(INDEXED_DATABASE) > >-#include "FileSystem.h" > #include "IDBConnectionToClient.h" > #include "IDBConnectionToServer.h" > #include "IDBCursorInfo.h" >@@ -40,6 +39,7 @@ > #include "IDBResultData.h" > #include "IDBValue.h" > #include "Logging.h" >+#include <wtf/FileSystem.h> > #include <wtf/RunLoop.h> > > namespace WebCore { >diff --git a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp b/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp >index d96541ed49f693824ed1dfc525088dac32bc59c5..408f62212ae2b17b38ac19098951a0f092d4b049 100644 >--- a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp >+++ b/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp >@@ -34,7 +34,6 @@ > #include "DatabaseManager.h" > #include "DatabaseManagerClient.h" > #include "DatabaseThread.h" >-#include "FileSystem.h" > #include "Logging.h" > #include "OriginLock.h" > #include "SecurityOrigin.h" >@@ -43,6 +42,7 @@ > #include "SQLiteFileSystem.h" > #include "SQLiteStatement.h" > #include "SQLiteTransaction.h" >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/StdLibExtras.h> >diff --git a/Source/WebCore/Modules/webdatabase/OriginLock.cpp b/Source/WebCore/Modules/webdatabase/OriginLock.cpp >index 423b2e66ddfa12cc340f60fce59d353df99867f4..a21bcdb78386c810ec59941c275f4efbaff23fb3 100644 >--- a/Source/WebCore/Modules/webdatabase/OriginLock.cpp >+++ b/Source/WebCore/Modules/webdatabase/OriginLock.cpp >@@ -26,8 +26,6 @@ > #include "config.h" > #include "OriginLock.h" > >-#include "FileSystem.h" >- > namespace WebCore { > > String OriginLock::lockFileNameForPath(String originPath) >diff --git a/Source/WebCore/Modules/webdatabase/OriginLock.h b/Source/WebCore/Modules/webdatabase/OriginLock.h >index a16e84f1489daf2ee8f504619d13993b8d375e10..ecc29e89025bdf629392b1059ef8870e6f8f92f2 100644 >--- a/Source/WebCore/Modules/webdatabase/OriginLock.h >+++ b/Source/WebCore/Modules/webdatabase/OriginLock.h >@@ -25,7 +25,7 @@ > > #pragma once > >-#include "FileSystem.h" >+#include <wtf/FileSystem.h> > #include <wtf/Lock.h> > #include <wtf/ThreadSafeRefCounted.h> > #include <wtf/text/WTFString.h> >diff --git a/Source/WebCore/Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm b/Source/WebCore/Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm >index 7cfe9fb063269181d44f13c383682533d4e4dfc9..8d325073b04aca1d328496e1828338dfebcabff3 100644 >--- a/Source/WebCore/Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm >+++ b/Source/WebCore/Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm >@@ -29,7 +29,7 @@ > #import "config.h" > #import "DatabaseManager.h" > >-#import "FileSystem.h" >+#import <wtf/FileSystem.h> > > namespace WebCore { > >diff --git a/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj b/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj >index 4fbdde39a4ac762280dc2977ac1fad67940dfc62..d164a4c72adb8d5dc0d604de8b6d1e555c75215f 100644 >--- a/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj >+++ b/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj >@@ -133,7 +133,6 @@ > A1175B571F6B470500C4B9F0 /* DefaultSearchProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = A1175B551F6B470500C4B9F0 /* DefaultSearchProvider.h */; }; > A1175B581F6B470500C4B9F0 /* DefaultSearchProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1175B561F6B470500C4B9F0 /* DefaultSearchProvider.cpp */; }; > A1175B5A1F6B4A8400C4B9F0 /* NSScrollViewSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A1175B591F6B4A8400C4B9F0 /* NSScrollViewSPI.h */; }; >- A1F55DCF1F5528EC00EDB75F /* MetadataSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F55DCE1F5528EC00EDB75F /* MetadataSPI.h */; }; > A1F63C9F21A4DBF7006FB43B /* PassKitSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F63C9D21A4DBF7006FB43B /* PassKitSoftLink.h */; }; > A1F63CA021A4DBF7006FB43B /* PassKitSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1F63C9E21A4DBF7006FB43B /* PassKitSoftLink.mm */; }; > A30D41211F0DD0EA00B71954 /* KillRing.h in Headers */ = {isa = PBXBuildFile; fileRef = A30D411E1F0DD0EA00B71954 /* KillRing.h */; }; >@@ -294,7 +293,6 @@ > A1175B551F6B470500C4B9F0 /* DefaultSearchProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DefaultSearchProvider.h; sourceTree = "<group>"; }; > A1175B561F6B470500C4B9F0 /* DefaultSearchProvider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DefaultSearchProvider.cpp; sourceTree = "<group>"; }; > A1175B591F6B4A8400C4B9F0 /* NSScrollViewSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSScrollViewSPI.h; sourceTree = "<group>"; }; >- A1F55DCE1F5528EC00EDB75F /* MetadataSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MetadataSPI.h; sourceTree = "<group>"; }; > A1F63C9D21A4DBF7006FB43B /* PassKitSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PassKitSoftLink.h; sourceTree = "<group>"; }; > A1F63C9E21A4DBF7006FB43B /* PassKitSoftLink.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PassKitSoftLink.mm; sourceTree = "<group>"; }; > A30D411E1F0DD0EA00B71954 /* KillRing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KillRing.h; sourceTree = "<group>"; }; >@@ -449,7 +447,6 @@ > A10265881F56747A00B4C844 /* HIToolboxSPI.h */, > 0C7785721F45130F00F4EBB6 /* LookupSPI.h */, > 0C7785731F45130F00F4EBB6 /* MediaRemoteSPI.h */, >- A1F55DCE1F5528EC00EDB75F /* MetadataSPI.h */, > 0C7785741F45130F00F4EBB6 /* NSAccessibilitySPI.h */, > 1CCEE4F620D8743F0047B097 /* NSAppearanceSPI.h */, > 0C7785751F45130F00F4EBB6 /* NSApplicationSPI.h */, >@@ -701,7 +698,6 @@ > 0C5AF91D1F43A4C7002EAC02 /* MediaPlayerSPI.h in Headers */, > 0C77858C1F45130F00F4EBB6 /* MediaRemoteSPI.h in Headers */, > 0C00CFD41F68CE4600AAC26D /* MediaTimeAVFoundation.h in Headers */, >- A1F55DCF1F5528EC00EDB75F /* MetadataSPI.h in Headers */, > 0C5AF91E1F43A4C7002EAC02 /* MobileGestaltSPI.h in Headers */, > 0C2DA1491F3BEB4900DBC317 /* NEFilterSourceSPI.h in Headers */, > 0C77858D1F45130F00F4EBB6 /* NSAccessibilitySPI.h in Headers */, >diff --git a/Source/WebCore/PAL/pal/PlatformMac.cmake b/Source/WebCore/PAL/pal/PlatformMac.cmake >index 6b1bd25926f42bd646032ad904a787e69b750ac9..f13076843f88316bc38bd80da72f489a8237628c 100644 >--- a/Source/WebCore/PAL/pal/PlatformMac.cmake >+++ b/Source/WebCore/PAL/pal/PlatformMac.cmake >@@ -58,7 +58,6 @@ list(APPEND PAL_PUBLIC_HEADERS > spi/mac/HIToolboxSPI.h > spi/mac/LookupSPI.h > spi/mac/MediaRemoteSPI.h >- spi/mac/MetadataSPI.h > spi/mac/NSAccessibilitySPI.h > spi/mac/NSAppearanceSPI.h > spi/mac/NSApplicationSPI.h >diff --git a/Source/WebCore/PAL/pal/spi/mac/MetadataSPI.h b/Source/WebCore/PAL/pal/spi/mac/MetadataSPI.h >deleted file mode 100644 >index 815547c6b8510e30618e2282ad5b784016ca3721..0000000000000000000000000000000000000000 >--- a/Source/WebCore/PAL/pal/spi/mac/MetadataSPI.h >+++ /dev/null >@@ -1,38 +0,0 @@ >-/* >- * Copyright (C) 2017 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if USE(APPLE_INTERNAL_SDK) >- >-#include <CoreServices/CoreServicesPriv.h> >- >-#endif >- >-WTF_EXTERN_C_BEGIN >- >-Boolean MDItemSetAttribute(MDItemRef, CFStringRef name, CFTypeRef attr); >- >-WTF_EXTERN_C_END >diff --git a/Source/WebCore/PlatformMac.cmake b/Source/WebCore/PlatformMac.cmake >index 866ea6a54b9a42f878d4e19b650a2c3c3ba209a9..4d72f9deef80eb6e44567973d5c6dcff69055b86 100644 >--- a/Source/WebCore/PlatformMac.cmake >+++ b/Source/WebCore/PlatformMac.cmake >@@ -189,7 +189,6 @@ list(APPEND WebCore_SOURCES > platform/audio/mac/CARingBuffer.cpp > platform/audio/mac/FFTFrameMac.cpp > >- platform/cf/FileSystemCF.cpp > platform/cf/KeyedDecoderCF.cpp > platform/cf/KeyedEncoderCF.cpp > platform/cf/MainThreadSharedTimerCF.cpp >@@ -200,7 +199,6 @@ list(APPEND WebCore_SOURCES > platform/cocoa/ContentFilterUnblockHandlerCocoa.mm > platform/cocoa/CoreVideoSoftLink.cpp > platform/cocoa/FileMonitorCocoa.mm >- platform/cocoa/FileSystemCocoa.mm > platform/cocoa/KeyEventCocoa.mm > platform/cocoa/LocalizedStringsCocoa.mm > platform/cocoa/MIMETypeRegistryCocoa.mm >@@ -347,7 +345,6 @@ list(APPEND WebCore_SOURCES > platform/mac/DragDataMac.mm > platform/mac/DragImageMac.mm > platform/mac/EventLoopMac.mm >- platform/mac/FileSystemMac.mm > platform/mac/KeyEventMac.mm > platform/mac/LocalCurrentGraphicsContext.mm > platform/mac/LoggingMac.mm >@@ -418,8 +415,6 @@ list(APPEND WebCore_SOURCES > platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm > platform/network/mac/WebCoreURLResponse.mm > >- platform/posix/FileSystemPOSIX.cpp >- > platform/text/cf/HyphenationCF.cpp > > platform/text/mac/LocaleMac.mm >diff --git a/Source/WebCore/PlatformPlayStation.cmake b/Source/WebCore/PlatformPlayStation.cmake >index 90376039b9696e13f9debc9c4730a79039979551..6d44535d95984be58833e88f971e6a72f2dbab22 100644 >--- a/Source/WebCore/PlatformPlayStation.cmake >+++ b/Source/WebCore/PlatformPlayStation.cmake >@@ -63,7 +63,6 @@ list(APPEND WebCore_SOURCES > platform/playstation/ScrollbarThemePlayStation.cpp > platform/playstation/UserAgentPlayStation.cpp > >- platform/posix/FileSystemPOSIX.cpp > platform/posix/SharedBufferPOSIX.cpp > > platform/text/Hyphenation.cpp >diff --git a/Source/WebCore/PlatformWin.cmake b/Source/WebCore/PlatformWin.cmake >index 4fab308260e09c805419c84c7ca834d81fb95c65..fcb57a45a5f41ef3bf670384fda23f3cda8614d0 100644 >--- a/Source/WebCore/PlatformWin.cmake >+++ b/Source/WebCore/PlatformWin.cmake >@@ -84,7 +84,6 @@ list(APPEND WebCore_SOURCES > platform/win/DragDataWin.cpp > platform/win/DragImageWin.cpp > platform/win/EventLoopWin.cpp >- platform/win/FileSystemWin.cpp > platform/win/GDIObjectCounter.cpp > platform/win/GDIUtilities.cpp > platform/win/KeyEventWin.cpp >@@ -93,7 +92,6 @@ list(APPEND WebCore_SOURCES > platform/win/MIMETypeRegistryWin.cpp > platform/win/MainThreadSharedTimerWin.cpp > platform/win/PasteboardWin.cpp >- platform/win/PathWalker.cpp > platform/win/PlatformMouseEventWin.cpp > platform/win/PlatformScreenWin.cpp > platform/win/PopupMenuWin.cpp >@@ -248,7 +246,6 @@ if (USE_CF) > list(APPEND WebCore_SOURCES > loader/archive/cf/LegacyWebArchive.cpp > >- platform/cf/FileSystemCF.cpp > platform/cf/KeyedDecoderCF.cpp > platform/cf/KeyedEncoderCF.cpp > platform/cf/SharedBufferCF.cpp >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index 274b08800e6bde43fa7b51afaf764ca1a9470d6c..0a1d69870c0a94669ee7ec9f1ba7d2c77813c70e 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -1600,7 +1600,6 @@ platform/FileChooser.cpp > platform/FileHandle.cpp > platform/FileMonitor.cpp > platform/FileStream.cpp >-platform/FileSystem.cpp > platform/GenericTaskQueue.cpp > platform/LayoutUnit.cpp > platform/Length.cpp >diff --git a/Source/WebCore/SourcesCocoa.txt b/Source/WebCore/SourcesCocoa.txt >index 0e15b904ead2d9d8593e50fa4200835a430b9568..c24185f14ee7af6608d2a43ce06649ca1f0552da 100644 >--- a/Source/WebCore/SourcesCocoa.txt >+++ b/Source/WebCore/SourcesCocoa.txt >@@ -181,7 +181,6 @@ platform/audio/mac/AudioSessionMac.cpp > platform/audio/mac/CARingBuffer.cpp > platform/audio/mac/FFTFrameMac.cpp > >-platform/cf/FileSystemCF.cpp > platform/cf/KeyedDecoderCF.cpp > platform/cf/KeyedEncoderCF.cpp > platform/cf/MainThreadSharedTimerCF.cpp >@@ -193,7 +192,6 @@ platform/cocoa/ContentFilterUnblockHandlerCocoa.mm @no-unify > platform/cocoa/CoreVideoSoftLink.cpp > platform/cocoa/DataDetectorsCoreSoftLink.mm > platform/cocoa/FileMonitorCocoa.mm >-platform/cocoa/FileSystemCocoa.mm > platform/cocoa/KeyEventCocoa.mm > platform/cocoa/LocalizedStringsCocoa.mm > platform/cocoa/MIMETypeRegistryCocoa.mm >@@ -446,7 +444,6 @@ platform/mac/CursorMac.mm > platform/mac/DragDataMac.mm > platform/mac/DragImageMac.mm > platform/mac/EventLoopMac.mm >-platform/mac/FileSystemMac.mm > platform/mac/KeyEventMac.mm @no-unify > platform/mac/PlaybackSessionInterfaceMac.mm @no-unify > platform/mac/LocalCurrentGraphicsContext.mm >@@ -541,8 +538,6 @@ platform/network/mac/UTIUtilities.mm > platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm > platform/network/mac/WebCoreURLResponse.mm > >-platform/posix/FileSystemPOSIX.cpp >- > platform/text/cf/HyphenationCF.cpp > > platform/text/ios/LocalizedDateCache.mm >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 2c46b3dee5748fef59b0d34d49532709a3ba6ca4..a35f02f4e4017ac62a2a1b90591e1c73ddc50808 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -1245,7 +1245,6 @@ > 467302021C4EFE7800BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h in Headers */ = {isa = PBXBuildFile; fileRef = 467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */; }; > 4682D2001F79783000C863DB /* StoredCredentialsPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4682D1FF1F79782300C863DB /* StoredCredentialsPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 468344E01EDDFAAA00B7795B /* DOMRectList.h in Headers */ = {isa = PBXBuildFile; fileRef = 468344DE1EDDFA5F00B7795B /* DOMRectList.h */; settings = {ATTRIBUTES = (Private, ); }; }; >- 4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 4689F1AE1267BAE100E8D380 /* FileMetadata.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 46B63F6C1C6E8D19002E914B /* JSEventTargetCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 46B95195207D633400A7D2DD /* AbstractDOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B9518A207D632800A7D2DD /* AbstractDOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 46B95196207D633A00A7D2DD /* AbstractFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B9518F207D632B00A7D2DD /* AbstractFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -1437,7 +1436,6 @@ > 5143B2631DDD15200014FAC6 /* LinkIcon.h in Headers */ = {isa = PBXBuildFile; fileRef = 5143B2621DDD14900014FAC6 /* LinkIcon.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5145B10A1BC48E2E00E86219 /* IDBResourceIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 5145B1081BC4890B00E86219 /* IDBResourceIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5148453F1BB9D07E006A72ED /* IDBError.h in Headers */ = {isa = PBXBuildFile; fileRef = 5148453D1BB9D076006A72ED /* IDBError.h */; settings = {ATTRIBUTES = (Private, ); }; }; >- 514B3F730C722047000530DF /* FileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 514B3F720C722047000530DF /* FileSystem.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 514C764C0CE9234E007EF3CD /* AuthenticationMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76420CE9234E007EF3CD /* AuthenticationMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 514C764E0CE9234E007EF3CD /* FormDataStreamMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76440CE9234E007EF3CD /* FormDataStreamMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 514C766E0CE923A1007EF3CD /* Credential.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76590CE923A1007EF3CD /* Credential.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -7707,7 +7705,6 @@ > 468344DC1EDDFA5F00B7795B /* DOMRectList.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMRectList.idl; sourceTree = "<group>"; }; > 468344DD1EDDFA5F00B7795B /* DOMRectList.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DOMRectList.cpp; sourceTree = "<group>"; }; > 468344DE1EDDFA5F00B7795B /* DOMRectList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMRectList.h; sourceTree = "<group>"; }; >- 4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMetadata.h; sourceTree = "<group>"; }; > 46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventTargetCustom.h; sourceTree = "<group>"; }; > 46B9518A207D632800A7D2DD /* AbstractDOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractDOMWindow.h; sourceTree = "<group>"; }; > 46B9518C207D632900A7D2DD /* RemoteFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteFrame.cpp; sourceTree = "<group>"; }; >@@ -8110,8 +8107,6 @@ > 5145B1081BC4890B00E86219 /* IDBResourceIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBResourceIdentifier.h; sourceTree = "<group>"; }; > 5148453C1BB9D076006A72ED /* IDBError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBError.cpp; sourceTree = "<group>"; }; > 5148453D1BB9D076006A72ED /* IDBError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBError.h; sourceTree = "<group>"; }; >- 514B3F720C722047000530DF /* FileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystem.h; sourceTree = "<group>"; }; >- 514B3F750C722055000530DF /* FileSystemCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileSystemCocoa.mm; sourceTree = "<group>"; }; > 514C76350CE9225E007EF3CD /* JSSQLError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLError.cpp; sourceTree = "<group>"; }; > 514C76360CE9225E007EF3CD /* JSSQLTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransaction.cpp; sourceTree = "<group>"; }; > 514C76420CE9234E007EF3CD /* AuthenticationMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationMac.h; sourceTree = "<group>"; }; >@@ -8150,8 +8145,6 @@ > 515E37F41FAA938800D7F22A /* ServiceWorkerTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerTypes.h; sourceTree = "<group>"; }; > 515F79511CFCA3C700CCED93 /* WebCoreCrossThreadCopier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreCrossThreadCopier.cpp; sourceTree = "<group>"; }; > 515F79521CFCA3C700CCED93 /* WebCoreCrossThreadCopier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreCrossThreadCopier.h; sourceTree = "<group>"; }; >- 5160300A0CC4251200C8AC25 /* FileSystemPOSIX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemPOSIX.cpp; sourceTree = "<group>"; }; >- 5160306B0CC4362300C8AC25 /* FileSystemCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemCF.cpp; sourceTree = "<group>"; }; > 5160712B1BD8305300DBC4F2 /* TransactionOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TransactionOperation.h; sourceTree = "<group>"; }; > 5160712C1BD8307200DBC4F2 /* IDBObjectStoreInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBObjectStoreInfo.cpp; sourceTree = "<group>"; }; > 5160712D1BD8307200DBC4F2 /* IDBObjectStoreInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBObjectStoreInfo.h; sourceTree = "<group>"; }; >@@ -11253,7 +11246,6 @@ > A1C2C5751FA2851600BA46FA /* PaymentSession.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentSession.cpp; sourceTree = "<group>"; }; > A1C7FAA1133A5D3500D6732D /* JSXPathResultCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXPathResultCustom.cpp; sourceTree = "<group>"; }; > A1CBEF631F9F11290028DE7C /* MockPaymentMethod.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockPaymentMethod.h; sourceTree = "<group>"; }; >- A1CC11621E493D0100EFA69C /* FileSystemMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileSystemMac.mm; sourceTree = "<group>"; }; > A1CC564C1F46145000A4555B /* JSPaymentMethodData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPaymentMethodData.h; sourceTree = "<group>"; }; > A1CC564D1F46145100A4555B /* JSPaymentMethodData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPaymentMethodData.cpp; sourceTree = "<group>"; }; > A1CC564E1F46145200A4555B /* JSPaymentComplete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPaymentComplete.h; sourceTree = "<group>"; }; >@@ -13440,7 +13432,6 @@ > C5592F771A92AA28001F8862 /* CharacterProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CharacterProperties.h; sourceTree = "<group>"; }; > C55C7BA01718AFBA001327E4 /* RenderThemeIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderThemeIOS.mm; sourceTree = "<group>"; }; > C572EE1D1201C9BC007D8F82 /* JSIDBIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBIndex.h; sourceTree = "<group>"; }; >- C57FEDE01212EE9C0097BE65 /* FileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystem.cpp; sourceTree = "<group>"; }; > C585A66011D4FAC5004C3E4B /* IDBBindingUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBBindingUtilities.cpp; sourceTree = "<group>"; }; > C585A66111D4FAC5004C3E4B /* IDBBindingUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBBindingUtilities.h; sourceTree = "<group>"; }; > C585A66B11D4FB07004C3E4B /* JSIDBDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBDatabase.h; sourceTree = "<group>"; }; >@@ -16774,7 +16765,6 @@ > 1AE42F670AA4B8CB00C8612D /* cf */ = { > isa = PBXGroup; > children = ( >- 5160306B0CC4362300C8AC25 /* FileSystemCF.cpp */, > 517A63BF1B74317E00E7DCDC /* KeyedDecoderCF.cpp */, > 517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */, > 517A63C11B74317E00E7DCDC /* KeyedEncoderCF.cpp */, >@@ -17169,10 +17159,10 @@ > 1CECB3B621F50AC700F44542 /* WHLSLMetalCodeGenerator.h */, > 1CECB3B821F50D1000F44542 /* WHLSLNativeFunctionWriter.cpp */, > 1CECB3B921F50D1000F44542 /* WHLSLNativeFunctionWriter.h */, >- 1CECB3B121F2B98500F44542 /* WHLSLTypeNamer.cpp */, >- 1CECB3B021F2B98500F44542 /* WHLSLTypeNamer.h */, > 1CECB3C621F59C8700F44542 /* WHLSLNativeTypeWriter.cpp */, > 1CECB3C721F59C8700F44542 /* WHLSLNativeTypeWriter.h */, >+ 1CECB3B121F2B98500F44542 /* WHLSLTypeNamer.cpp */, >+ 1CECB3B021F2B98500F44542 /* WHLSLTypeNamer.h */, > ); > path = Metal; > sourceTree = "<group>"; >@@ -18736,14 +18726,6 @@ > path = mac; > sourceTree = "<group>"; > }; >- 516030090CC4245400C8AC25 /* posix */ = { >- isa = PBXGroup; >- children = ( >- 5160300A0CC4251200C8AC25 /* FileSystemPOSIX.cpp */, >- ); >- path = posix; >- sourceTree = "<group>"; >- }; > 5160F4920B0AA71500C1D2AF /* mac */ = { > isa = PBXGroup; > children = ( >@@ -20104,7 +20086,6 @@ > A7CFB3D40B7ED1180070C32D /* DragImageMac.mm */, > E1BA66F01742BD8600C20251 /* DynamicLinkerInterposing.h */, > 1CA19E030DC255950065A994 /* EventLoopMac.mm */, >- A1CC11621E493D0100EFA69C /* FileSystemMac.mm */, > 935C476E09AC4D7300A6AAB4 /* KeyEventMac.mm */, > F44A5F571FED3830007F5944 /* LegacyNSPasteboardTypes.h */, > 06E81ED60AB5D5E900C87837 /* LocalCurrentGraphicsContext.h */, >@@ -22552,7 +22533,6 @@ > 7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */, > 7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */, > 7A09CEF01F01D1F700E93BDB /* FileMonitorCocoa.mm */, >- 514B3F750C722055000530DF /* FileSystemCocoa.mm */, > A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */, > A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */, > 1A4832B21A953BA6008B4DFE /* LocalizedStringsCocoa.mm */, >@@ -25395,7 +25375,6 @@ > 07221B9217CF0AD400848E51 /* mediastream */, > 59C77F101054591C00506104 /* mock */, > 656B84D70AEA1CE900A095B4 /* network */, >- 516030090CC4245400C8AC25 /* posix */, > 1A2E6E560CC551E0004A2062 /* sql */, > B2C3D9EC0D006C1D00EF6F26 /* text */, > E188235F2031F50F00B42DF3 /* vr */, >@@ -25440,14 +25419,11 @@ > 066C772A0AB603B700238CC4 /* FileChooser.h */, > 5351D4AE1DF916AC008010CD /* FileHandle.cpp */, > 5351D4AF1DF916AC008010CD /* FileHandle.h */, >- 4689F1AE1267BAE100E8D380 /* FileMetadata.h */, > 7A09CEEB1F01CC9300E93BDB /* FileMonitor.cpp */, > 7A09CEEC1F01CC9300E93BDB /* FileMonitor.h */, > 2EF1BFE8121C9F4200C27627 /* FileStream.cpp */, > 2EF1BFE9121C9F4200C27627 /* FileStream.h */, > 2EF1BFF8121CB0CE00C27627 /* FileStreamClient.h */, >- C57FEDE01212EE9C0097BE65 /* FileSystem.cpp */, >- 514B3F720C722047000530DF /* FileSystem.h */, > BC073BA90C399B1F000F5979 /* FloatConversion.h */, > CD4BE5291CE13425009D87DA /* GenericTaskQueue.cpp */, > CD62FB941AF018E70012ED7D /* GenericTaskQueue.h */, >@@ -29136,7 +29112,6 @@ > F55B3DBE1251F12D003EF269 /* FileInputType.h in Headers */, > 976D6C86122B8A3D001FD1F7 /* FileList.h in Headers */, > 835D54C51F4DE53800E60671 /* FileListCreator.h in Headers */, >- 4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */, > 7A09CEF11F02069B00E93BDB /* FileMonitor.h in Headers */, > 976D6C89122B8A3D001FD1F7 /* FileReader.h in Headers */, > 2E75841E12779ADA0062628B /* FileReaderLoader.h in Headers */, >@@ -29144,7 +29119,6 @@ > 2EDF369D122C94B4002F7D4E /* FileReaderSync.h in Headers */, > 2EF1BFEB121C9F4200C27627 /* FileStream.h in Headers */, > 2EF1BFF9121CB0CE00C27627 /* FileStreamClient.h in Headers */, >- 514B3F730C722047000530DF /* FileSystem.h in Headers */, > 83FB33711F508A5400986E54 /* FileSystemDirectoryEntry.h in Headers */, > 830335021F549057004DF707 /* FileSystemDirectoryReader.h in Headers */, > 830335031F54905A004DF707 /* FileSystemEntriesCallback.h in Headers */, >diff --git a/Source/WebCore/bindings/js/GCController.cpp b/Source/WebCore/bindings/js/GCController.cpp >index d251d2ece1f18b240a88bbfb3a22c2c24f80f6cd..8a83c4b6f6f59607dfa77048429d02b1e429733b 100644 >--- a/Source/WebCore/bindings/js/GCController.cpp >+++ b/Source/WebCore/bindings/js/GCController.cpp >@@ -27,7 +27,6 @@ > #include "GCController.h" > > #include "CommonVM.h" >-#include "FileSystem.h" > #include "JSHTMLDocument.h" > #include "Location.h" > #include <JavaScriptCore/Heap.h> >@@ -36,6 +35,7 @@ > #include <JavaScriptCore/VM.h> > #include <pal/Logging.h> > #include <wtf/FastMalloc.h> >+#include <wtf/FileSystem.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/StdLibExtras.h> > >diff --git a/Source/WebCore/dom/DataTransferItem.cpp b/Source/WebCore/dom/DataTransferItem.cpp >index a3ecc5a5c9e0f30d76032817f0d4639633ff1a8b..59f9786ed8cfa649e07ddb7d884ac9243297639c 100644 >--- a/Source/WebCore/dom/DataTransferItem.cpp >+++ b/Source/WebCore/dom/DataTransferItem.cpp >@@ -36,11 +36,11 @@ > #include "DataTransferItemList.h" > #include "Document.h" > #include "File.h" >-#include "FileSystem.h" > #include "FileSystemDirectoryEntry.h" > #include "FileSystemFileEntry.h" > #include "ScriptExecutionContext.h" > #include "StringCallback.h" >+#include <wtf/FileSystem.h> > > namespace WebCore { > >diff --git a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >index 97217f1d75d0e546fcf8431e2d4af8ba543ab61c..254a368fa774ad6372d46f153c5a95c4ee2428c5 100644 >--- a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >+++ b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >@@ -37,7 +37,6 @@ > #import "Editor.h" > #import "EditorClient.h" > #import "File.h" >-#import "FileSystem.h" > #import "Frame.h" > #import "FrameLoader.h" > #import "FrameLoaderClient.h" >@@ -65,6 +64,7 @@ > #import "WebNSAttributedStringExtras.h" > #import "markup.h" > #import <pal/spi/cocoa/NSAttributedStringSPI.h> >+#import <wtf/FileSystem.h> > #import <wtf/SoftLinking.h> > #import <wtf/URLParser.h> > >diff --git a/Source/WebCore/fileapi/File.cpp b/Source/WebCore/fileapi/File.cpp >index b73fcde79f460792c926c075fbaaf6648a724131..adb30c933ca2fb25cef5d0ca4136560bba6d8116 100644 >--- a/Source/WebCore/fileapi/File.cpp >+++ b/Source/WebCore/fileapi/File.cpp >@@ -27,11 +27,11 @@ > #include "File.h" > > #include "BlobURL.h" >-#include "FileMetadata.h" >-#include "FileSystem.h" > #include "MIMETypeRegistry.h" > #include "ThreadableBlobRegistry.h" > #include <wtf/DateMath.h> >+#include <wtf/FileMetadata.h> >+#include <wtf/FileSystem.h> > #include <wtf/text/WTFString.h> > > namespace WebCore { >diff --git a/Source/WebCore/fileapi/FileCocoa.mm b/Source/WebCore/fileapi/FileCocoa.mm >index 20be6f7aedeca753483563b1be4f9062fa438a03..664f9a53613df26ca17c707c21b50c64645204e6 100644 >--- a/Source/WebCore/fileapi/FileCocoa.mm >+++ b/Source/WebCore/fileapi/FileCocoa.mm >@@ -28,7 +28,7 @@ > > #if ENABLE(FILE_REPLACEMENT) > >-#import "FileSystem.h" >+#import <wtf/FileSystem.h> > > #if PLATFORM(IOS_FAMILY) > #import <MobileCoreServices/MobileCoreServices.h> >diff --git a/Source/WebCore/html/FileInputType.cpp b/Source/WebCore/html/FileInputType.cpp >index 03af3a963494faf0012e21a938f5191780308508..998f9efa94e2a75216bb4f39a7968649c1317dd9 100644 >--- a/Source/WebCore/html/FileInputType.cpp >+++ b/Source/WebCore/html/FileInputType.cpp >@@ -30,7 +30,6 @@ > #include "File.h" > #include "FileList.h" > #include "FileListCreator.h" >-#include "FileSystem.h" > #include "FormController.h" > #include "Frame.h" > #include "HTMLInputElement.h" >@@ -43,6 +42,7 @@ > #include "Settings.h" > #include "ShadowRoot.h" > #include "UserGestureIndicator.h" >+#include <wtf/FileSystem.h> > #include <wtf/IsoMallocInlines.h> > #include <wtf/TypeCasts.h> > #include <wtf/text/StringBuilder.h> >diff --git a/Source/WebCore/html/FileListCreator.cpp b/Source/WebCore/html/FileListCreator.cpp >index 76f565970ad1dd8d8106c25a579e4591babd49b8..1556fc299cb2373b0c5989520a72c3116ce39ea5 100644 >--- a/Source/WebCore/html/FileListCreator.cpp >+++ b/Source/WebCore/html/FileListCreator.cpp >@@ -28,9 +28,9 @@ > > #include "FileChooser.h" > #include "FileList.h" >-#include "FileMetadata.h" >-#include "FileSystem.h" > #include <wtf/CrossThreadCopier.h> >+#include <wtf/FileMetadata.h> >+#include <wtf/FileSystem.h> > > namespace WebCore { > >diff --git a/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp b/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp >index 755f1a29ad7c57ccc3bea5efa255b656bbdcc309..8a33e8870cc36bc6de2fca8d1d58c4cca6b8f3ef 100644 >--- a/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp >+++ b/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp >@@ -33,7 +33,6 @@ > #include "DocumentLoader.h" > #include "DOMApplicationCache.h" > #include "EventNames.h" >-#include "FileSystem.h" > #include "Frame.h" > #include "FrameLoader.h" > #include "FrameLoaderClient.h" >@@ -44,6 +43,7 @@ > #include "ResourceRequest.h" > #include "Settings.h" > #include "SubresourceLoader.h" >+#include <wtf/FileSystem.h> > #include <wtf/UUID.h> > > namespace WebCore { >diff --git a/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp >index e81483c3623cd034244484cd0f5fdc924955ae32..82adff30335a2e2bb9caa7b4f66884d090e79561 100644 >--- a/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp >+++ b/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp >@@ -30,12 +30,12 @@ > #include "ApplicationCacheGroup.h" > #include "ApplicationCacheHost.h" > #include "ApplicationCacheResource.h" >-#include "FileSystem.h" > #include "SQLiteDatabaseTracker.h" > #include "SQLiteStatement.h" > #include "SQLiteTransaction.h" > #include "SecurityOrigin.h" > #include "SecurityOriginData.h" >+#include <wtf/FileSystem.h> > #include <wtf/StdLibExtras.h> > #include <wtf/URL.h> > #include <wtf/UUID.h> >diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp >index db177e8dae8c60e6e718229fb3c03d36dffd5452..26a25819c1a7741d12cd964629ad15979986d0d0 100644 >--- a/Source/WebCore/page/Page.cpp >+++ b/Source/WebCore/page/Page.cpp >@@ -51,7 +51,6 @@ > #include "Event.h" > #include "EventNames.h" > #include "ExtensionStyleSheets.h" >-#include "FileSystem.h" > #include "FocusController.h" > #include "FrameLoader.h" > #include "FrameLoaderClient.h" >@@ -122,6 +121,7 @@ > #include "WebGLStateTracker.h" > #include "WheelEventDeltaFilter.h" > #include "Widget.h" >+#include <wtf/FileSystem.h> > #include <wtf/RefCountedLeakCounter.h> > #include <wtf/StdLibExtras.h> > #include <wtf/text/Base64.h> >diff --git a/Source/WebCore/page/SecurityOrigin.cpp b/Source/WebCore/page/SecurityOrigin.cpp >index b58faaa167a96726aa211fe1f0274bc66e96165b..3ad921cc54de1fefe3d1571f22e253212a8de20b 100644 >--- a/Source/WebCore/page/SecurityOrigin.cpp >+++ b/Source/WebCore/page/SecurityOrigin.cpp >@@ -30,15 +30,15 @@ > #include "SecurityOrigin.h" > > #include "BlobURL.h" >-#include "FileSystem.h" >-#include <wtf/URL.h> > #include "SchemeRegistry.h" > #include "SecurityPolicy.h" > #include "TextEncoding.h" > #include "ThreadableBlobRegistry.h" >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/StdLibExtras.h> >+#include <wtf/URL.h> > #include <wtf/text/StringBuilder.h> > > namespace WebCore { >diff --git a/Source/WebCore/page/SecurityOriginData.cpp b/Source/WebCore/page/SecurityOriginData.cpp >index 05f8b19dae5879d0cdfda7c7649eca2b44c398a6..430cb8b0b3ac36cca9611e0a1f09e35ae10b0d9c 100644 >--- a/Source/WebCore/page/SecurityOriginData.cpp >+++ b/Source/WebCore/page/SecurityOriginData.cpp >@@ -27,9 +27,9 @@ > #include "SecurityOriginData.h" > > #include "Document.h" >-#include "FileSystem.h" > #include "Frame.h" > #include "SecurityOrigin.h" >+#include <wtf/FileSystem.h> > #include <wtf/text/CString.h> > #include <wtf/text/StringBuilder.h> > #include <wtf/text/StringConcatenateNumbers.h> >diff --git a/Source/WebCore/platform/FileHandle.h b/Source/WebCore/platform/FileHandle.h >index d1183086963d21237b90b1a82585b765bbc13df2..50d824caee9ba124098435ea7215d151787dbce1 100644 >--- a/Source/WebCore/platform/FileHandle.h >+++ b/Source/WebCore/platform/FileHandle.h >@@ -28,9 +28,8 @@ > > #pragma once > >-#include "FileSystem.h" >- > #include <wtf/Assertions.h> >+#include <wtf/FileSystem.h> > > namespace WebCore { > >diff --git a/Source/WebCore/platform/FileMetadata.h b/Source/WebCore/platform/FileMetadata.h >deleted file mode 100644 >index 7d884953e7675d92c0638decad857cd41a59c561..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/FileMetadata.h >+++ /dev/null >@@ -1,50 +0,0 @@ >-/* >- * Copyright (C) 2010 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions are >- * met: >- * >- * * Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * * Redistributions in binary form must reproduce the above >- * copyright notice, this list of conditions and the following disclaimer >- * in the documentation and/or other materials provided with the >- * distribution. >- * * Neither the name of Google Inc. nor the names of its >- * contributors may be used to endorse or promote products derived from >- * this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#include <wtf/WallTime.h> >- >-namespace WebCore { >- >-struct FileMetadata { >- // The last modification time of the file, in seconds. >- WallTime modificationTime; >- >- // The length of the file in bytes. >- long long length; >- >- bool isHidden; >- >- enum class Type { File, Directory, SymbolicLink }; >- Type type; >-}; >- >-} // namespace WebCore >diff --git a/Source/WebCore/platform/FileStream.cpp b/Source/WebCore/platform/FileStream.cpp >index ea917374b4c8b4a4ea043c29abf54315922a89e2..893bb339476cefda8df10bc920c0b3582519157a 100644 >--- a/Source/WebCore/platform/FileStream.cpp >+++ b/Source/WebCore/platform/FileStream.cpp >@@ -29,10 +29,8 @@ > */ > > #include "config.h" >- > #include "FileStream.h" > >-#include "FileSystem.h" > #include <wtf/text/WTFString.h> > > namespace WebCore { >diff --git a/Source/WebCore/platform/FileStream.h b/Source/WebCore/platform/FileStream.h >index aa011ea23e1854c4b90205962537613a1ab6e12b..a2fb8e5faa254bc8e5cce9e1b4c6631b8d1a054c 100644 >--- a/Source/WebCore/platform/FileStream.h >+++ b/Source/WebCore/platform/FileStream.h >@@ -28,10 +28,9 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef FileStream_h >-#define FileStream_h >+#pragma once > >-#include "FileSystem.h" >+#include <wtf/FileSystem.h> > > namespace WebCore { > >@@ -64,5 +63,3 @@ private: > }; > > } // namespace WebCore >- >-#endif // FileStream_h >diff --git a/Source/WebCore/platform/FileSystem.cpp b/Source/WebCore/platform/FileSystem.cpp >deleted file mode 100644 >index ed9d37aaa1316283da7ef2246b3ca9410ad25d22..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/FileSystem.cpp >+++ /dev/null >@@ -1,367 +0,0 @@ >-/* >- * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >- * Copyright (C) 2015 Canon Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "FileSystem.h" >- >-#include "FileMetadata.h" >-#include <wtf/HexNumber.h> >-#include <wtf/Scope.h> >-#include <wtf/text/CString.h> >-#include <wtf/text/StringBuilder.h> >- >-#if !OS(WINDOWS) >-#include <fcntl.h> >-#include <sys/mman.h> >-#include <sys/stat.h> >-#include <unistd.h> >-#endif >- >-namespace WebCore { >- >-namespace FileSystem { >- >-// The following lower-ASCII characters need escaping to be used in a filename >-// across all systems, including Windows: >-// - Unprintable ASCII (00-1F) >-// - Space (20) >-// - Double quote (22) >-// - Percent (25) (escaped because it is our escape character) >-// - Asterisk (2A) >-// - Slash (2F) >-// - Colon (3A) >-// - Less-than (3C) >-// - Greater-than (3E) >-// - Question Mark (3F) >-// - Backslash (5C) >-// - Pipe (7C) >-// - Delete (7F) >- >-static const bool needsEscaping[128] = { >- /* 00-07 */ true, true, true, true, true, true, true, true, >- /* 08-0F */ true, true, true, true, true, true, true, true, >- >- /* 10-17 */ true, true, true, true, true, true, true, true, >- /* 18-1F */ true, true, true, true, true, true, true, true, >- >- /* 20-27 */ true, false, true, false, false, true, false, false, >- /* 28-2F */ false, false, true, false, false, false, false, true, >- >- /* 30-37 */ false, false, false, false, false, false, false, false, >- /* 38-3F */ false, false, true, false, true, false, true, true, >- >- /* 40-47 */ false, false, false, false, false, false, false, false, >- /* 48-4F */ false, false, false, false, false, false, false, false, >- >- /* 50-57 */ false, false, false, false, false, false, false, false, >- /* 58-5F */ false, false, false, false, true, false, false, false, >- >- /* 60-67 */ false, false, false, false, false, false, false, false, >- /* 68-6F */ false, false, false, false, false, false, false, false, >- >- /* 70-77 */ false, false, false, false, false, false, false, false, >- /* 78-7F */ false, false, false, false, true, false, false, true, >-}; >- >-static inline bool shouldEscapeUChar(UChar character, UChar previousCharacter, UChar nextCharacter) >-{ >- if (character <= 127) >- return needsEscaping[character]; >- >- if (U16_IS_LEAD(character) && !U16_IS_TRAIL(nextCharacter)) >- return true; >- >- if (U16_IS_TRAIL(character) && !U16_IS_LEAD(previousCharacter)) >- return true; >- >- return false; >-} >- >-String encodeForFileName(const String& inputString) >-{ >- unsigned length = inputString.length(); >- if (!length) >- return inputString; >- >- StringBuilder result; >- result.reserveCapacity(length); >- >- UChar previousCharacter; >- UChar character = 0; >- UChar nextCharacter = inputString[0]; >- for (unsigned i = 0; i < length; ++i) { >- previousCharacter = character; >- character = nextCharacter; >- nextCharacter = i + 1 < length ? inputString[i + 1] : 0; >- >- if (shouldEscapeUChar(character, previousCharacter, nextCharacter)) { >- if (character <= 255) { >- result.append('%'); >- appendByteAsHex(character, result); >- } else { >- result.appendLiteral("%+"); >- appendByteAsHex(character >> 8, result); >- appendByteAsHex(character, result); >- } >- } else >- result.append(character); >- } >- >- return result.toString(); >-} >- >-String decodeFromFilename(const String& inputString) >-{ >- unsigned length = inputString.length(); >- if (!length) >- return inputString; >- >- StringBuilder result; >- result.reserveCapacity(length); >- >- for (unsigned i = 0; i < length; ++i) { >- if (inputString[i] != '%') { >- result.append(inputString[i]); >- continue; >- } >- >- // If the input string is a valid encoded filename, it must be at least 2 characters longer >- // than the current index to account for this percent encoded value. >- if (i + 2 >= length) >- return { }; >- >- if (inputString[i+1] != '+') { >- if (!isASCIIHexDigit(inputString[i + 1])) >- return { }; >- if (!isASCIIHexDigit(inputString[i + 2])) >- return { }; >- result.append(toASCIIHexValue(inputString[i + 1], inputString[i + 2])); >- i += 2; >- continue; >- } >- >- // If the input string is a valid encoded filename, it must be at least 5 characters longer >- // than the current index to account for this percent encoded value. >- if (i + 5 >= length) >- return { }; >- >- if (!isASCIIHexDigit(inputString[i + 2])) >- return { }; >- if (!isASCIIHexDigit(inputString[i + 3])) >- return { }; >- if (!isASCIIHexDigit(inputString[i + 4])) >- return { }; >- if (!isASCIIHexDigit(inputString[i + 5])) >- return { }; >- >- result.append(toASCIIHexValue(inputString[i + 2], inputString[i + 3]) << 8 | toASCIIHexValue(inputString[i + 4], inputString[i + 5])); >- i += 5; >- } >- >- return result.toString(); >-} >- >-String lastComponentOfPathIgnoringTrailingSlash(const String& path) >-{ >-#if OS(WINDOWS) >- char pathSeparator = '\\'; >-#else >- char pathSeparator = '/'; >-#endif >- >- auto position = path.reverseFind(pathSeparator); >- if (position == notFound) >- return path; >- >- size_t endOfSubstring = path.length() - 1; >- if (position == endOfSubstring) { >- --endOfSubstring; >- position = path.reverseFind(pathSeparator, endOfSubstring); >- } >- >- return path.substring(position + 1, endOfSubstring - position); >-} >- >-bool appendFileContentsToFileHandle(const String& path, PlatformFileHandle& target) >-{ >- auto source = openFile(path, FileOpenMode::Read); >- >- if (!isHandleValid(source)) >- return false; >- >- static int bufferSize = 1 << 19; >- Vector<char> buffer(bufferSize); >- >- auto fileCloser = WTF::makeScopeExit([source]() { >- PlatformFileHandle handle = source; >- closeFile(handle); >- }); >- >- do { >- int readBytes = readFromFile(source, buffer.data(), bufferSize); >- >- if (readBytes < 0) >- return false; >- >- if (writeToFile(target, buffer.data(), readBytes) != readBytes) >- return false; >- >- if (readBytes < bufferSize) >- return true; >- } while (true); >- >- ASSERT_NOT_REACHED(); >-} >- >- >-bool filesHaveSameVolume(const String& fileA, const String& fileB) >-{ >- auto fsRepFileA = fileSystemRepresentation(fileA); >- auto fsRepFileB = fileSystemRepresentation(fileB); >- >- if (fsRepFileA.isNull() || fsRepFileB.isNull()) >- return false; >- >- bool result = false; >- >- auto fileADev = getFileDeviceId(fsRepFileA); >- auto fileBDev = getFileDeviceId(fsRepFileB); >- >- if (fileADev && fileBDev) >- result = (fileADev == fileBDev); >- >- return result; >-} >- >-#if !PLATFORM(MAC) >- >-void setMetadataURL(const String&, const String&, const String&) >-{ >-} >- >-bool canExcludeFromBackup() >-{ >- return false; >-} >- >-bool excludeFromBackup(const String&) >-{ >- return false; >-} >- >-#endif >- >-MappedFileData::~MappedFileData() >-{ >-#if !OS(WINDOWS) >- if (!m_fileData) >- return; >- munmap(m_fileData, m_fileSize); >-#endif >-} >- >-MappedFileData::MappedFileData(const String& filePath, bool& success) >-{ >-#if OS(WINDOWS) >- // FIXME: Implement mapping >- success = false; >-#else >- CString fsRep = fileSystemRepresentation(filePath); >- int fd = !fsRep.isNull() ? open(fsRep.data(), O_RDONLY) : -1; >- if (fd < 0) { >- success = false; >- return; >- } >- >- struct stat fileStat; >- if (fstat(fd, &fileStat)) { >- close(fd); >- success = false; >- return; >- } >- >- unsigned size; >- if (!WTF::convertSafely(fileStat.st_size, size)) { >- close(fd); >- success = false; >- return; >- } >- >- if (!size) { >- close(fd); >- success = true; >- return; >- } >- >- void* data = mmap(0, size, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0); >- close(fd); >- >- if (data == MAP_FAILED) { >- success = false; >- return; >- } >- >- success = true; >- m_fileData = data; >- m_fileSize = size; >-#endif >-} >- >-PlatformFileHandle openAndLockFile(const String& path, FileOpenMode openMode, OptionSet<FileLockMode> lockMode) >-{ >- auto handle = openFile(path, openMode); >- if (handle == invalidPlatformFileHandle) >- return invalidPlatformFileHandle; >- >-#if USE(FILE_LOCK) >- bool locked = lockFile(handle, lockMode); >- ASSERT_UNUSED(locked, locked); >-#else >- UNUSED_PARAM(lockMode); >-#endif >- >- return handle; >-} >- >-void unlockAndCloseFile(PlatformFileHandle handle) >-{ >-#if USE(FILE_LOCK) >- bool unlocked = unlockFile(handle); >- ASSERT_UNUSED(unlocked, unlocked); >-#endif >- closeFile(handle); >-} >- >-bool fileIsDirectory(const String& path, ShouldFollowSymbolicLinks shouldFollowSymbolicLinks) >-{ >- auto metadata = shouldFollowSymbolicLinks == ShouldFollowSymbolicLinks::Yes ? fileMetadataFollowingSymlinks(path) : fileMetadata(path); >- if (!metadata) >- return false; >- return metadata.value().type == FileMetadata::Type::Directory; >-} >- >-} // namespace FileSystem >-} // namespace WebCore >diff --git a/Source/WebCore/platform/FileSystem.h b/Source/WebCore/platform/FileSystem.h >deleted file mode 100644 >index 3cebcaa0539b59d93e72e09840b23b1dac63811b..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/FileSystem.h >+++ /dev/null >@@ -1,225 +0,0 @@ >-/* >- * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >- * Copyright (C) 2008 Collabora, Ltd. All rights reserved. >- * Copyright (C) 2015 Canon Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * 3. Neither the name of Apple Inc. ("Apple") nor the names of >- * its contributors may be used to endorse or promote products derived >- * from this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#include <time.h> >-#include <utility> >-#include <wtf/Forward.h> >-#include <wtf/OptionSet.h> >-#include <wtf/Vector.h> >-#include <wtf/WallTime.h> >-#include <wtf/text/WTFString.h> >- >-#if USE(CF) >-#include <wtf/RetainPtr.h> >-#endif >- >-#if USE(CF) >-typedef const struct __CFData* CFDataRef; >-#endif >- >-OBJC_CLASS NSString; >- >-#if PLATFORM(WIN) >-typedef void *HANDLE; >-#endif >- >-#if USE(GLIB) >-typedef struct _GFileIOStream GFileIOStream; >-#endif >- >-namespace WebCore { >- >-struct FileMetadata; >- >-namespace FileSystem { >- >-// PlatformFileHandle >-#if USE(GLIB) && !PLATFORM(WIN) >-typedef GFileIOStream* PlatformFileHandle; >-const PlatformFileHandle invalidPlatformFileHandle = 0; >-#elif PLATFORM(WIN) >-typedef HANDLE PlatformFileHandle; >-// FIXME: -1 is INVALID_HANDLE_VALUE, defined in <winbase.h>. Chromium tries to >-// avoid using Windows headers in headers. We'd rather move this into the .cpp. >-const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast<HANDLE>(-1); >-#else >-typedef int PlatformFileHandle; >-const PlatformFileHandle invalidPlatformFileHandle = -1; >-#endif >- >-enum class FileOpenMode { >- Read, >- Write, >-#if OS(DARWIN) >- EventsOnly, >-#endif >-}; >- >-enum class FileSeekOrigin { >- Beginning, >- Current, >- End, >-}; >- >-enum class FileLockMode { >- Shared = 1 << 0, >- Exclusive = 1 << 1, >- Nonblocking = 1 << 2, >-}; >- >-enum class ShouldFollowSymbolicLinks { No, Yes }; >- >-WEBCORE_EXPORT bool fileExists(const String&); >-WEBCORE_EXPORT bool deleteFile(const String&); >-WEBCORE_EXPORT bool deleteEmptyDirectory(const String&); >-WEBCORE_EXPORT bool moveFile(const String& oldPath, const String& newPath); >-WEBCORE_EXPORT bool getFileSize(const String&, long long& result); >-WEBCORE_EXPORT bool getFileSize(PlatformFileHandle, long long& result); >-WEBCORE_EXPORT Optional<WallTime> getFileModificationTime(const String&); >-WEBCORE_EXPORT Optional<WallTime> getFileCreationTime(const String&); // Not all platforms store file creation time. >-WEBCORE_EXPORT Optional<FileMetadata> fileMetadata(const String& path); >-WEBCORE_EXPORT Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path); >-WEBCORE_EXPORT bool fileIsDirectory(const String&, ShouldFollowSymbolicLinks); >-WEBCORE_EXPORT String pathByAppendingComponent(const String& path, const String& component); >-String pathByAppendingComponents(StringView path, const Vector<StringView>& components); >-String lastComponentOfPathIgnoringTrailingSlash(const String& path); >-WEBCORE_EXPORT bool makeAllDirectories(const String& path); >-String homeDirectoryPath(); >-WEBCORE_EXPORT String pathGetFileName(const String&); >-WEBCORE_EXPORT String directoryName(const String&); >-WEBCORE_EXPORT bool getVolumeFreeSpace(const String&, uint64_t&); >-WEBCORE_EXPORT Optional<int32_t> getFileDeviceId(const CString&); >-WEBCORE_EXPORT bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath); >- >-WEBCORE_EXPORT void setMetadataURL(const String& path, const String& urlString, const String& referrer = { }); >- >-bool canExcludeFromBackup(); // Returns true if any file can ever be excluded from backup. >-bool excludeFromBackup(const String&); // Returns true if successful. >- >-WEBCORE_EXPORT Vector<String> listDirectory(const String& path, const String& filter = String()); >- >-WEBCORE_EXPORT CString fileSystemRepresentation(const String&); >-String stringFromFileSystemRepresentation(const char*); >- >-inline bool isHandleValid(const PlatformFileHandle& handle) { return handle != invalidPlatformFileHandle; } >- >-// Prefix is what the filename should be prefixed with, not the full path. >-WEBCORE_EXPORT String openTemporaryFile(const String& prefix, PlatformFileHandle&); >-WEBCORE_EXPORT PlatformFileHandle openFile(const String& path, FileOpenMode); >-WEBCORE_EXPORT void closeFile(PlatformFileHandle&); >-// Returns the resulting offset from the beginning of the file if successful, -1 otherwise. >-WEBCORE_EXPORT long long seekFile(PlatformFileHandle, long long offset, FileSeekOrigin); >-bool truncateFile(PlatformFileHandle, long long offset); >-// Returns number of bytes actually read if successful, -1 otherwise. >-WEBCORE_EXPORT int writeToFile(PlatformFileHandle, const char* data, int length); >-// 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, OptionSet<FileLockMode> = FileLockMode::Exclusive); >-WEBCORE_EXPORT void unlockAndCloseFile(PlatformFileHandle); >- >-// Appends the contents of the file found at 'path' to the open PlatformFileHandle. >-// Returns true if the write was successful, false if it was not. >-bool appendFileContentsToFileHandle(const String& path, PlatformFileHandle&); >- >-// Hard links a file if possible, copies it if not. >-bool hardLinkOrCopyFile(const String& source, const String& destination); >- >-#if USE(FILE_LOCK) >-WEBCORE_EXPORT bool lockFile(PlatformFileHandle, OptionSet<FileLockMode>); >-WEBCORE_EXPORT bool unlockFile(PlatformFileHandle); >-#endif >- >-// Encode a string for use within a file name. >-WEBCORE_EXPORT String encodeForFileName(const String&); >-WEBCORE_EXPORT String decodeFromFilename(const String&); >- >-WEBCORE_EXPORT bool filesHaveSameVolume(const String&, const String&); >- >-#if USE(CF) >-RetainPtr<CFURLRef> pathAsURL(const String&); >-#endif >- >-#if PLATFORM(GTK) || PLATFORM(WPE) >-String filenameForDisplay(const String&); >-#endif >- >-#if PLATFORM(WIN) >-WEBCORE_EXPORT String localUserSpecificStorageDirectory(); >-String roamingUserSpecificStorageDirectory(); >-#endif >- >-#if PLATFORM(COCOA) >-WEBCORE_EXPORT NSString *createTemporaryDirectory(NSString *directoryPrefix); >-WEBCORE_EXPORT bool deleteNonEmptyDirectory(const String&); >-#endif >- >-#if PLATFORM(WIN_CAIRO) >-WEBCORE_EXPORT String createTemporaryDirectory(); >-WEBCORE_EXPORT bool deleteNonEmptyDirectory(const String&); >-#endif >- >-WEBCORE_EXPORT String realPath(const String&); >- >-class MappedFileData { >-public: >- MappedFileData() { } >- MappedFileData(MappedFileData&&); >- WEBCORE_EXPORT MappedFileData(const String& filePath, bool& success); >- WEBCORE_EXPORT ~MappedFileData(); >- MappedFileData& operator=(MappedFileData&&); >- >- explicit operator bool() const { return !!m_fileData; } >- const void* data() const { return m_fileData; } >- unsigned size() const { return m_fileSize; } >- >-private: >- void* m_fileData { nullptr }; >- unsigned m_fileSize { 0 }; >-}; >- >-inline MappedFileData::MappedFileData(MappedFileData&& other) >- : m_fileData(std::exchange(other.m_fileData, nullptr)) >- , m_fileSize(std::exchange(other.m_fileSize, 0)) >-{ >-} >- >-inline MappedFileData& MappedFileData::operator=(MappedFileData&& other) >-{ >- m_fileData = std::exchange(other.m_fileData, nullptr); >- m_fileSize = std::exchange(other.m_fileSize, 0); >- return *this; >-} >- >-} // namespace FileSystem >-} // namespace WebCore >- >diff --git a/Source/WebCore/platform/SharedBuffer.h b/Source/WebCore/platform/SharedBuffer.h >index 81318e8b29ae5a0f5b9603c8255791cdbc20a4e1..ec371341ab9495b7d35761351b2b09b135a3ef3b 100644 >--- a/Source/WebCore/platform/SharedBuffer.h >+++ b/Source/WebCore/platform/SharedBuffer.h >@@ -26,8 +26,8 @@ > > #pragma once > >-#include "FileSystem.h" > #include <JavaScriptCore/ArrayBuffer.h> >+#include <wtf/FileSystem.h> > #include <wtf/Forward.h> > #include <wtf/RefCounted.h> > #include <wtf/ThreadSafeRefCounted.h> >diff --git a/Source/WebCore/platform/SourcesGLib.txt b/Source/WebCore/platform/SourcesGLib.txt >index 2773c2a088b60fb139692d5f40d0befc3fec3cc4..090b84a48c103d3d593141d90e2bbb4abf2c5ba7 100644 >--- a/Source/WebCore/platform/SourcesGLib.txt >+++ b/Source/WebCore/platform/SourcesGLib.txt >@@ -25,7 +25,6 @@ platform/audio/glib/AudioBusGLib.cpp > > platform/glib/EventLoopGlib.cpp > platform/glib/FileMonitorGLib.cpp >-platform/glib/FileSystemGlib.cpp > platform/glib/KeyedDecoderGlib.cpp > platform/glib/KeyedEncoderGlib.cpp > platform/glib/LowPowerModeNotifierGLib.cpp >diff --git a/Source/WebCore/platform/cf/FileSystemCF.cpp b/Source/WebCore/platform/cf/FileSystemCF.cpp >deleted file mode 100644 >index 08470a08fa5d2f452e6c938701c6d926ca609f03..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/cf/FileSystemCF.cpp >+++ /dev/null >@@ -1,74 +0,0 @@ >-/* >- * Copyright (C) 2007, 2011 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * 3. Neither the name of Apple Inc. ("Apple") nor the names of >- * its contributors may be used to endorse or promote products derived >- * from this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "FileSystem.h" >- >-#include <CoreFoundation/CFString.h> >-#include <wtf/RetainPtr.h> >-#include <wtf/text/CString.h> >-#include <wtf/text/WTFString.h> >- >-namespace WebCore { >- >-CString FileSystem::fileSystemRepresentation(const String& path) >-{ >- RetainPtr<CFStringRef> cfString = path.createCFString(); >- >- if (!cfString) >- return CString(); >- >- CFIndex size = CFStringGetMaximumSizeOfFileSystemRepresentation(cfString.get()); >- >- Vector<char> buffer(size); >- >- if (!CFStringGetFileSystemRepresentation(cfString.get(), buffer.data(), buffer.size())) { >- LOG_ERROR("Failed to get filesystem representation to create CString from cfString"); >- return CString(); >- } >- >- return CString(buffer.data(), strlen(buffer.data())); >-} >- >-String FileSystem::stringFromFileSystemRepresentation(const char* fileSystemRepresentation) >-{ >- return adoptCF(CFStringCreateWithFileSystemRepresentation(kCFAllocatorDefault, fileSystemRepresentation)).get(); >-} >- >-RetainPtr<CFURLRef> FileSystem::pathAsURL(const String& path) >-{ >- CFURLPathStyle pathStyle; >-#if PLATFORM(WIN) >- pathStyle = kCFURLWindowsPathStyle; >-#else >- pathStyle = kCFURLPOSIXPathStyle; >-#endif >- return adoptCF(CFURLCreateWithFileSystemPath(0, path.createCFString().get(), pathStyle, FALSE)); >-} >- >-} // namespace WebCore >diff --git a/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm b/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm >index 1ab3c334c69dffa3648ab00a4558d9f27e430600..cc7fe6b6cde10ed4ca456e46be28a04f6872474a 100644 >--- a/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm >+++ b/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm >@@ -26,9 +26,9 @@ > #import "config.h" > #import "FileMonitor.h" > >-#import "FileSystem.h" > #import "Logging.h" > #import <wtf/BlockPtr.h> >+#import <wtf/FileSystem.h> > > namespace WebCore { > >diff --git a/Source/WebCore/platform/cocoa/FileSystemCocoa.mm b/Source/WebCore/platform/cocoa/FileSystemCocoa.mm >deleted file mode 100644 >index d38b0c8303e7ba10d40533cbcd15da33b0969e3c..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/cocoa/FileSystemCocoa.mm >+++ /dev/null >@@ -1,143 +0,0 @@ >-/* >- * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * 3. Neither the name of Apple Inc. ("Apple") nor the names of >- * its contributors may be used to endorse or promote products derived >- * from this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#import "config.h" >-#import "FileSystem.h" >- >-@interface WebFileManagerDelegate : NSObject <NSFileManagerDelegate> >-@end >- >-@implementation WebFileManagerDelegate >- >-- (BOOL)fileManager:(NSFileManager *)fileManager shouldProceedAfterError:(NSError *)error movingItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL >-{ >- UNUSED_PARAM(fileManager); >- UNUSED_PARAM(srcURL); >- UNUSED_PARAM(dstURL); >- return error.code == NSFileWriteFileExistsError; >-} >- >-@end >- >-namespace WebCore { >- >-namespace FileSystem { >- >-String homeDirectoryPath() >-{ >- return NSHomeDirectory(); >-} >- >-String openTemporaryFile(const String& prefix, PlatformFileHandle& platformFileHandle) >-{ >- platformFileHandle = invalidPlatformFileHandle; >- >- Vector<char> temporaryFilePath(PATH_MAX); >- if (!confstr(_CS_DARWIN_USER_TEMP_DIR, temporaryFilePath.data(), temporaryFilePath.size())) >- return String(); >- >- // Shrink the vector. >- temporaryFilePath.shrink(strlen(temporaryFilePath.data())); >- >- // FIXME: Change to a runtime assertion that the path ends with a slash once <rdar://problem/23579077> is >- // fixed in all iOS Simulator versions that we use. >- if (temporaryFilePath.last() != '/') >- temporaryFilePath.append('/'); >- >- // Append the file name. >- CString prefixUtf8 = prefix.utf8(); >- temporaryFilePath.append(prefixUtf8.data(), prefixUtf8.length()); >- temporaryFilePath.append("XXXXXX", 6); >- temporaryFilePath.append('\0'); >- >- platformFileHandle = mkstemp(temporaryFilePath.data()); >- if (platformFileHandle == invalidPlatformFileHandle) >- return String(); >- >- return String::fromUTF8(temporaryFilePath.data()); >-} >- >-bool moveFile(const String& oldPath, const String& newPath) >-{ >- // Overwrite existing files. >- auto manager = adoptNS([[NSFileManager alloc] init]); >- auto delegate = adoptNS([[WebFileManagerDelegate alloc] init]); >- [manager setDelegate:delegate.get()]; >- >- NSError *error = nil; >- bool success = [manager moveItemAtURL:[NSURL fileURLWithPath:oldPath] toURL:[NSURL fileURLWithPath:newPath] error:&error]; >- if (!success) >- NSLog(@"Error in moveFile: %@", error); >- return success; >-} >- >-bool getVolumeFreeSpace(const String& path, uint64_t& freeSpace) >-{ >- NSDictionary *fileSystemAttributesDictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:(NSString *)path error:NULL]; >- if (!fileSystemAttributesDictionary) >- return false; >- freeSpace = [[fileSystemAttributesDictionary objectForKey:NSFileSystemFreeSize] unsignedLongLongValue]; >- return true; >-} >- >-NSString *createTemporaryDirectory(NSString *directoryPrefix) >-{ >- NSString *tempDirectory = NSTemporaryDirectory(); >- if (!tempDirectory || ![tempDirectory length]) >- return nil; >- >- if (!directoryPrefix || ![directoryPrefix length]) >- return nil; >- >- NSString *tempDirectoryComponent = [directoryPrefix stringByAppendingString:@"-XXXXXXXX"]; >- const char* tempDirectoryCString = [[tempDirectory stringByAppendingPathComponent:tempDirectoryComponent] fileSystemRepresentation]; >- if (!tempDirectoryCString) >- return nil; >- >- const size_t length = strlen(tempDirectoryCString); >- ASSERT(length <= MAXPATHLEN); >- if (length > MAXPATHLEN) >- return nil; >- >- const size_t lengthPlusNullTerminator = length + 1; >- Vector<char, MAXPATHLEN + 1> path(lengthPlusNullTerminator); >- memcpy(path.data(), tempDirectoryCString, lengthPlusNullTerminator); >- >- if (!mkdtemp(path.data())) >- return nil; >- >- return [[NSFileManager defaultManager] stringWithFileSystemRepresentation:path.data() length:length]; >-} >- >-bool deleteNonEmptyDirectory(const String& path) >-{ >- return [[NSFileManager defaultManager] removeItemAtPath:path error:nil]; >-} >- >-} // namespace FileSystem >-} // namespace WebCore >diff --git a/Source/WebCore/platform/glib/FileMonitorGLib.cpp b/Source/WebCore/platform/glib/FileMonitorGLib.cpp >index 463f3276c24e251beb4aa08b0b98986e8cc96923..5a982f4949237cb20a9f54cf88e2adee48d4f96a 100644 >--- a/Source/WebCore/platform/glib/FileMonitorGLib.cpp >+++ b/Source/WebCore/platform/glib/FileMonitorGLib.cpp >@@ -26,7 +26,7 @@ > #include "config.h" > #include "FileMonitor.h" > >-#include "FileSystem.h" >+#include <wtf/FileSystem.h> > #include <wtf/glib/GUniquePtr.h> > #include <wtf/threads/BinarySemaphore.h> > >diff --git a/Source/WebCore/platform/glib/FileSystemGlib.cpp b/Source/WebCore/platform/glib/FileSystemGlib.cpp >deleted file mode 100644 >index ca6c3df94dd322134300c7bbd26bbb0890465631..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/glib/FileSystemGlib.cpp >+++ /dev/null >@@ -1,470 +0,0 @@ >-/* >- * Copyright (C) 2007, 2009 Holger Hans Peter Freyther >- * Copyright (C) 2008 Collabora, Ltd. >- * Copyright (C) 2008 Apple Inc. All rights reserved. >- * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "FileSystem.h" >- >-#include "FileMetadata.h" >-#include "NotImplemented.h" >-#include <gio/gfiledescriptorbased.h> >-#include <gio/gio.h> >-#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> >-#include <wtf/glib/GUniquePtr.h> >-#include <wtf/text/CString.h> >-#include <wtf/text/StringBuilder.h> >-#include <wtf/text/WTFString.h> >- >-namespace WebCore { >- >-namespace FileSystem { >- >-/* On linux file names are just raw bytes, so also strings that cannot be encoded in any way >- * are valid file names. This mean that we cannot just store a file name as-is in a String >- * but we have to escape it. >- * On Windows the GLib file name encoding is always UTF-8 so we can optimize this case. */ >-String stringFromFileSystemRepresentation(const char* fileSystemRepresentation) >-{ >- if (!fileSystemRepresentation) >- return String(); >- >-#if OS(WINDOWS) >- return String::fromUTF8(fileSystemRepresentation); >-#else >- GUniquePtr<gchar> escapedString(g_uri_escape_string(fileSystemRepresentation, "/:", FALSE)); >- return escapedString.get(); >-#endif >-} >- >-static GUniquePtr<char> unescapedFilename(const String& path) >-{ >- if (path.isEmpty()) >- return nullptr; >-#if OS(WINDOWS) >- return GUniquePtr<char>(g_strdup(path.utf8().data())); >-#else >- return GUniquePtr<char>(g_uri_unescape_string(path.utf8().data(), nullptr)); >-#endif >-} >- >-CString fileSystemRepresentation(const String& path) >-{ >-#if OS(WINDOWS) >- return path.utf8(); >-#else >- GUniquePtr<gchar> filename = unescapedFilename(path); >- return filename.get(); >-#endif >-} >- >-// Converts a string to something suitable to be displayed to the user. >-String filenameForDisplay(const String& string) >-{ >-#if OS(WINDOWS) >- return string; >-#else >- GUniquePtr<gchar> filename = unescapedFilename(string); >- if (!filename) >- return string; >- >- GUniquePtr<gchar> display(g_filename_to_utf8(filename.get(), -1, nullptr, nullptr, nullptr)); >- if (!display) >- return string; >- >- return String::fromUTF8(display.get()); >-#endif >-} >- >-bool fileExists(const String& path) >-{ >- GUniquePtr<gchar> filename = unescapedFilename(path); >- return filename ? g_file_test(filename.get(), G_FILE_TEST_EXISTS) : false; >-} >- >-bool deleteFile(const String& path) >-{ >- GUniquePtr<gchar> filename = unescapedFilename(path); >- return filename ? g_remove(filename.get()) != -1 : false; >-} >- >-bool deleteEmptyDirectory(const String& path) >-{ >- GUniquePtr<gchar> filename = unescapedFilename(path); >- return filename ? g_rmdir(filename.get()) != -1 : false; >-} >- >-static bool getFileStat(const String& path, GStatBuf* statBuffer) >-{ >- GUniquePtr<gchar> filename = unescapedFilename(path); >- if (!filename) >- return false; >- >- return g_stat(filename.get(), statBuffer) != -1; >-} >- >-static bool getFileLStat(const String& path, GStatBuf* statBuffer) >-{ >- GUniquePtr<gchar> filename = unescapedFilename(path); >- if (!filename) >- return false; >- >- return g_lstat(filename.get(), statBuffer) != -1; >-} >- >-bool getFileSize(const String& path, long long& resultSize) >-{ >- GStatBuf statResult; >- if (!getFileStat(path, &statResult)) >- return false; >- >- resultSize = statResult.st_size; >- return true; >-} >- >-bool getFileSize(PlatformFileHandle handle, long long& resultSize) >-{ >- auto info = g_file_io_stream_query_info(handle, G_FILE_ATTRIBUTE_STANDARD_SIZE, nullptr, nullptr); >- if (!info) >- return false; >- >- resultSize = g_file_info_get_size(info); >- return true; >-} >- >-Optional<WallTime> getFileCreationTime(const String&) >-{ >- // FIXME: Is there a way to retrieve file creation time with Gtk on platforms that support it? >- return WTF::nullopt; >-} >- >-Optional<WallTime> getFileModificationTime(const String& path) >-{ >- GStatBuf statResult; >- if (!getFileStat(path, &statResult)) >- return WTF::nullopt; >- >- return WallTime::fromRawSeconds(statResult.st_mtime); >-} >- >-static FileMetadata::Type toFileMetataType(GStatBuf statResult) >-{ >- if (S_ISDIR(statResult.st_mode)) >- return FileMetadata::Type::Directory; >- if (S_ISLNK(statResult.st_mode)) >- return FileMetadata::Type::SymbolicLink; >- return FileMetadata::Type::File; >-} >- >-static Optional<FileMetadata> fileMetadataUsingFunction(const String& path, bool (*statFunc)(const String&, GStatBuf*)) >-{ >- GStatBuf statResult; >- if (!statFunc(path, &statResult)) >- return WTF::nullopt; >- >- String filename = pathGetFileName(path); >- bool isHidden = !filename.isEmpty() && filename[0] == '.'; >- >- return FileMetadata { >- WallTime::fromRawSeconds(statResult.st_mtime), >- statResult.st_size, >- isHidden, >- toFileMetataType(statResult) >- }; >-} >- >-Optional<FileMetadata> fileMetadata(const String& path) >-{ >- return fileMetadataUsingFunction(path, &getFileLStat); >-} >- >-Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) >-{ >- return fileMetadataUsingFunction(path, &getFileStat); >-} >- >-String pathByAppendingComponent(const String& path, const String& component) >-{ >- if (path.endsWith(G_DIR_SEPARATOR_S)) >- return path + component; >- return path + G_DIR_SEPARATOR_S + component; >-} >- >-String pathByAppendingComponents(StringView path, const Vector<StringView>& components) >-{ >- StringBuilder builder; >- builder.append(path); >- for (auto& component : components) { >- builder.append(G_DIR_SEPARATOR_S); >- builder.append(component); >- } >- return builder.toString(); >-} >- >-bool makeAllDirectories(const String& path) >-{ >- GUniquePtr<gchar> filename = unescapedFilename(path); >- return filename ? g_mkdir_with_parents(filename.get(), S_IRWXU) != -1 : false; >-} >- >-String homeDirectoryPath() >-{ >- return stringFromFileSystemRepresentation(g_get_home_dir()); >-} >- >-bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath) >-{ >- CString targetPathFSRep = fileSystemRepresentation(targetPath); >- if (!targetPathFSRep.data() || targetPathFSRep.data()[0] == '\0') >- return false; >- >- CString symbolicLinkPathFSRep = fileSystemRepresentation(symbolicLinkPath); >- if (!symbolicLinkPathFSRep.data() || symbolicLinkPathFSRep.data()[0] == '\0') >- return false; >- >- return !symlink(targetPathFSRep.data(), symbolicLinkPathFSRep.data()); >-} >- >-String pathGetFileName(const String& pathName) >-{ >- GUniquePtr<gchar> tmpFilename = unescapedFilename(pathName); >- if (!tmpFilename) >- return pathName; >- >- GUniquePtr<gchar> baseName(g_path_get_basename(tmpFilename.get())); >- return String::fromUTF8(baseName.get()); >-} >- >-bool getVolumeFreeSpace(const String& path, uint64_t& freeSpace) >-{ >- GUniquePtr<gchar> filename = unescapedFilename(path); >- if (!filename) >- return false; >- >- GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(filename.get())); >- GRefPtr<GFileInfo> fileInfo = adoptGRef(g_file_query_filesystem_info(file.get(), G_FILE_ATTRIBUTE_FILESYSTEM_FREE, 0, 0)); >- if (!fileInfo) >- return false; >- >- freeSpace = g_file_info_get_attribute_uint64(fileInfo.get(), G_FILE_ATTRIBUTE_FILESYSTEM_FREE); >- return !!freeSpace; >-} >- >-String directoryName(const String& path) >-{ >- GUniquePtr<gchar> filename = unescapedFilename(path); >- if (!filename) >- return String(); >- >- GUniquePtr<char> dirname(g_path_get_dirname(filename.get())); >- return String::fromUTF8(dirname.get()); >-} >- >-Vector<String> listDirectory(const String& path, const String& filter) >-{ >- Vector<String> entries; >- >- GUniquePtr<gchar> filename = unescapedFilename(path); >- if (!filename) >- return entries; >- >- GUniquePtr<GDir> dir(g_dir_open(filename.get(), 0, nullptr)); >- if (!dir) >- return entries; >- >- GUniquePtr<GPatternSpec> pspec(g_pattern_spec_new((filter.utf8()).data())); >- while (const char* name = g_dir_read_name(dir.get())) { >- if (!g_pattern_match_string(pspec.get(), name)) >- continue; >- >- GUniquePtr<gchar> entry(g_build_filename(filename.get(), name, nullptr)); >- entries.append(stringFromFileSystemRepresentation(entry.get())); >- } >- >- return entries; >-} >- >-String openTemporaryFile(const String& prefix, PlatformFileHandle& handle) >-{ >- GUniquePtr<gchar> filename(g_strdup_printf("%s%s", prefix.utf8().data(), createCanonicalUUIDString().utf8().data())); >- GUniquePtr<gchar> tempPath(g_build_filename(g_get_tmp_dir(), filename.get(), NULL)); >- GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(tempPath.get())); >- >- handle = g_file_create_readwrite(file.get(), G_FILE_CREATE_NONE, 0, 0); >- if (!isHandleValid(handle)) >- return String(); >- return String::fromUTF8(tempPath.get()); >-} >- >-PlatformFileHandle openFile(const String& path, FileOpenMode mode) >-{ >- GUniquePtr<gchar> filename = unescapedFilename(path); >- if (!filename) >- return invalidPlatformFileHandle; >- >- GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(filename.get())); >- GFileIOStream* ioStream = 0; >- if (mode == FileOpenMode::Read) >- ioStream = g_file_open_readwrite(file.get(), 0, 0); >- 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 >- ioStream = g_file_create_readwrite(file.get(), G_FILE_CREATE_NONE, 0, 0); >- } >- >- return ioStream; >-} >- >-void closeFile(PlatformFileHandle& handle) >-{ >- if (!isHandleValid(handle)) >- return; >- >- g_io_stream_close(G_IO_STREAM(handle), 0, 0); >- g_object_unref(handle); >- handle = invalidPlatformFileHandle; >-} >- >-long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) >-{ >- GSeekType seekType = G_SEEK_SET; >- switch (origin) { >- case FileSeekOrigin::Beginning: >- seekType = G_SEEK_SET; >- break; >- case FileSeekOrigin::Current: >- seekType = G_SEEK_CUR; >- break; >- case FileSeekOrigin::End: >- seekType = G_SEEK_END; >- break; >- default: >- ASSERT_NOT_REACHED(); >- } >- >- if (!g_seekable_seek(G_SEEKABLE(g_io_stream_get_input_stream(G_IO_STREAM(handle))), >- offset, seekType, 0, 0)) >- { >- return -1; >- } >- return g_seekable_tell(G_SEEKABLE(g_io_stream_get_input_stream(G_IO_STREAM(handle)))); >-} >- >-int writeToFile(PlatformFileHandle handle, const char* data, int length) >-{ >- gsize bytesWritten; >- g_output_stream_write_all(g_io_stream_get_output_stream(G_IO_STREAM(handle)), >- data, length, &bytesWritten, 0, 0); >- return bytesWritten; >-} >- >-int readFromFile(PlatformFileHandle handle, char* data, int length) >-{ >- GUniqueOutPtr<GError> error; >- do { >- gssize bytesRead = g_input_stream_read(g_io_stream_get_input_stream(G_IO_STREAM(handle)), >- data, length, 0, &error.outPtr()); >- if (bytesRead >= 0) >- return bytesRead; >- } while (error && error->code == G_FILE_ERROR_INTR); >- return -1; >-} >- >-bool moveFile(const String& oldPath, const String& newPath) >-{ >- GUniquePtr<gchar> oldFilename = unescapedFilename(oldPath); >- if (!oldFilename) >- return false; >- >- GUniquePtr<gchar> newFilename = unescapedFilename(newPath); >- if (!newFilename) >- return false; >- >- GRefPtr<GFile> oldFile = adoptGRef(g_file_new_for_path(oldFilename.get())); >- GRefPtr<GFile> newFile = adoptGRef(g_file_new_for_path(newFilename.get())); >- >- return g_file_move(oldFile.get(), newFile.get(), G_FILE_COPY_OVERWRITE, nullptr, nullptr, nullptr, nullptr); >-} >- >-bool hardLinkOrCopyFile(const String& source, const String& destination) >-{ >-#if OS(WINDOWS) >- return !!::CopyFile(source.charactersWithNullTermination().data(), destination.charactersWithNullTermination().data(), TRUE); >-#else >- GUniquePtr<gchar> sourceFilename = unescapedFilename(source); >- if (!sourceFilename) >- return false; >- >- GUniquePtr<gchar> destinationFilename = unescapedFilename(destination); >- if (!destinationFilename) >- return false; >- >- if (!link(sourceFilename.get(), destinationFilename.get())) >- return true; >- >- // Hard link failed. Perform a copy instead. >- GRefPtr<GFile> sourceFile = adoptGRef(g_file_new_for_path(sourceFilename.get())); >- GRefPtr<GFile> destinationFile = adoptGRef(g_file_new_for_path(destinationFilename.get())); >- return g_file_copy(sourceFile.get(), destinationFile.get(), G_FILE_COPY_NONE, nullptr, nullptr, nullptr, nullptr); >-#endif >-} >- >-Optional<int32_t> getFileDeviceId(const CString& fsFile) >-{ >- GUniquePtr<gchar> filename = unescapedFilename(fsFile.data()); >- if (!filename) >- return WTF::nullopt; >- >- GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(filename.get())); >- GRefPtr<GFileInfo> fileInfo = adoptGRef(g_file_query_filesystem_info(file.get(), G_FILE_ATTRIBUTE_UNIX_DEVICE, nullptr, nullptr)); >- if (!fileInfo) >- return WTF::nullopt; >- >- return g_file_info_get_attribute_uint32(fileInfo.get(), G_FILE_ATTRIBUTE_UNIX_DEVICE); >-} >- >-#if USE(FILE_LOCK) >-bool lockFile(PlatformFileHandle handle, OptionSet<FileLockMode> 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); >- 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.toRaw()); >- return result != -1; >-} >- >-bool unlockFile(PlatformFileHandle handle) >-{ >- 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)), LOCK_UN); >- return result != -1; >-} >-#endif // USE(FILE_LOCK) >- >-} // namespace FileSystem >-} // namespace WebCore >diff --git a/Source/WebCore/platform/glib/SharedBufferGlib.cpp b/Source/WebCore/platform/glib/SharedBufferGlib.cpp >index b4896c085460e7c0be564084ec88ef22af60b844..c7473575307f6f7dd4a9f2361aef25ca36976e3a 100644 >--- a/Source/WebCore/platform/glib/SharedBufferGlib.cpp >+++ b/Source/WebCore/platform/glib/SharedBufferGlib.cpp >@@ -19,7 +19,6 @@ > #include "config.h" > #include "SharedBuffer.h" > >-#include "FileSystem.h" > #include <wtf/glib/GUniquePtr.h> > #include <wtf/text/CString.h> > >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm b/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm >index e8dd3b5aec8293cd5ed96e98f1035ee53e28c7b4..24f95e8441367e2219ca226445e86228f579482c 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm >@@ -29,7 +29,6 @@ > #if ENABLE(LEGACY_ENCRYPTED_MEDIA) && ENABLE(MEDIA_SOURCE) > > #import "CDMPrivateMediaSourceAVFObjC.h" >-#import "FileSystem.h" > #import "LegacyCDM.h" > #import "Logging.h" > #import "MediaPlayer.h" >@@ -39,6 +38,7 @@ > #import <CoreMedia/CMBase.h> > #import <JavaScriptCore/TypedArrayInlines.h> > #import <objc/objc-runtime.h> >+#import <wtf/FileSystem.h> > #import <wtf/SoftLinking.h> > > SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation) >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm b/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm >index 99294315d86241b168f28aa72edde0d97cf4a78c..c3573e5c6081c99b1404e0e41c50e049e291a22e 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm >@@ -29,7 +29,6 @@ > #if ENABLE(LEGACY_ENCRYPTED_MEDIA) && ENABLE(MEDIA_SOURCE) > > #import "CDMPrivateMediaSourceAVFObjC.h" >-#import "FileSystem.h" > #import "LegacyCDM.h" > #import "Logging.h" > #import "MediaPlayer.h" >@@ -40,6 +39,7 @@ > #import <JavaScriptCore/TypedArrayInlines.h> > #import <objc/objc-runtime.h> > #import <pal/spi/mac/AVFoundationSPI.h> >+#import <wtf/FileSystem.h> > #import <wtf/SoftLinking.h> > #import <wtf/UUID.h> > >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm >index 2cb2d6fa0cd8efa4231891a0981983c9b8c077e4..ec58378a8beb6a5753d02da49fedab66eeb597c2 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm >@@ -29,9 +29,9 @@ > #if ENABLE(LEGACY_ENCRYPTED_MEDIA) && ENABLE(MEDIA_SOURCE) > > #import "CDMPrivateMediaSourceAVFObjC.h" >-#import "FileSystem.h" > #import "WebCoreNSErrorExtras.h" > #import <AVFoundation/AVError.h> >+#import <wtf/FileSystem.h> > > namespace WebCore { > >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >index 5e36dd006930750112b713fdc4e5aea4d10a9c09..d6d5e82b23776fd6277e29b69deb6629f8c918c4 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >@@ -31,7 +31,6 @@ > #import "AVAssetTrackUtilities.h" > #import "AVFoundationMIMETypeCache.h" > #import "CDMSessionAVStreamSession.h" >-#import "FileSystem.h" > #import "GraphicsContextCG.h" > #import "Logging.h" > #import "MediaSourcePrivateAVFObjC.h" >@@ -49,6 +48,7 @@ > #import <pal/avfoundation/MediaTimeAVFoundation.h> > #import <pal/spi/mac/AVFoundationSPI.h> > #import <wtf/Deque.h> >+#import <wtf/FileSystem.h> > #import <wtf/MainThread.h> > #import <wtf/NeverDestroyed.h> > >diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp >index 0f05eb9199dbf3e49e1a12e07566eec4891de177..4140c11b0ea4798e660d649580fecaad3c26d4c7 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp >@@ -28,7 +28,6 @@ > > #if ENABLE(VIDEO) && USE(GSTREAMER) > >-#include "FileSystem.h" > #include "GStreamerCommon.h" > #include "HTTPHeaderNames.h" > #include "MIMETypeRegistry.h" >@@ -42,6 +41,7 @@ > #include <gst/gst.h> > #include <gst/pbutils/missing-plugins.h> > #include <limits> >+#include <wtf/FileSystem.h> > #include <wtf/HexNumber.h> > #include <wtf/MediaTime.h> > #include <wtf/NeverDestroyed.h> >diff --git a/Source/WebCore/platform/ios/QuickLook.mm b/Source/WebCore/platform/ios/QuickLook.mm >index 7bf91b2fadc312ab3b7e862a58350ec548d01bb7..a9d9e47105017d64d82e37c8aa31ce6469025685 100644 >--- a/Source/WebCore/platform/ios/QuickLook.mm >+++ b/Source/WebCore/platform/ios/QuickLook.mm >@@ -28,12 +28,12 @@ > > #if USE(QUICK_LOOK) > >-#import "FileSystem.h" > #import "PreviewConverter.h" > #import "ResourceRequest.h" > #import "SchemeRegistry.h" > #import <pal/ios/QuickLookSoftLink.h> > #import <pal/spi/cocoa/NSFileManagerSPI.h> >+#import <wtf/FileSystem.h> > #import <wtf/Lock.h> > #import <wtf/NeverDestroyed.h> > >diff --git a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm b/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm >index bf821839915e80d5899a948999f2f0206d8cff3a..3545d7efcac867648f49a474e8a020b51c88d4da 100644 >--- a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm >+++ b/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm >@@ -34,11 +34,11 @@ > #import <UIKit/NSItemProvider+UIKitAdditions.h> > #import <UIKit/UIColor.h> > #import <UIKit/UIImage.h> >-#import <WebCore/FileSystem.h> > #import <WebCore/Pasteboard.h> > #import <pal/ios/UIKitSoftLink.h> > #import <pal/spi/ios/UIKitSPI.h> > #import <wtf/BlockPtr.h> >+#import <wtf/FileSystem.h> > #import <wtf/OSObjectPtr.h> > #import <wtf/RetainPtr.h> > >@@ -694,7 +694,7 @@ static NSURL *linkTemporaryItemProviderFilesToDropStagingDirectory(NSURL *url, N > if (!url) > return nil; > >- NSString *temporaryDataInteractionDirectory = WebCore::FileSystem::createTemporaryDirectory(dataInteractionDirectoryPrefix); >+ NSString *temporaryDataInteractionDirectory = FileSystem::createTemporaryDirectory(dataInteractionDirectoryPrefix); > if (!temporaryDataInteractionDirectory) > return nil; > >diff --git a/Source/WebCore/platform/mac/FileSystemMac.mm b/Source/WebCore/platform/mac/FileSystemMac.mm >deleted file mode 100644 >index 8ed751a7ec0e5d0baf774f98610acb045cd2b004..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/mac/FileSystemMac.mm >+++ /dev/null >@@ -1,88 +0,0 @@ >-/* >- * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#import "config.h" >-#import "FileSystem.h" >- >-#if PLATFORM(MAC) >- >-#import <pal/spi/mac/MetadataSPI.h> >-#import <wtf/cocoa/NSURLExtras.h> >-#import <wtf/text/WTFString.h> >- >-namespace WebCore { >- >-bool FileSystem::deleteEmptyDirectory(const String& path) >-{ >- auto fileManager = adoptNS([[NSFileManager alloc] init]); >- >- if (NSArray *directoryContents = [fileManager contentsOfDirectoryAtPath:path error:nullptr]) { >- // Explicitly look for and delete .DS_Store files. >- if (directoryContents.count == 1 && [directoryContents.firstObject isEqualToString:@".DS_Store"]) >- [fileManager removeItemAtPath:[path stringByAppendingPathComponent:directoryContents.firstObject] error:nullptr]; >- } >- >- // rmdir(...) returns 0 on successful deletion of the path and non-zero in any other case (including invalid permissions or non-existent file) >- return !rmdir(FileSystem::fileSystemRepresentation(path).data()); >-} >- >-void FileSystem::setMetadataURL(const String& path, const String& metadataURLString, const String& referrer) >-{ >- String urlString; >- if (NSURL *url = URLWithUserTypedString(metadataURLString, nil)) >- urlString = WTF::userVisibleString(WTF::URLByRemovingUserInfo(url)); >- else >- urlString = metadataURLString; >- >- // Call Metadata API on a background queue because it can take some time. >- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), [path = path.isolatedCopy(), urlString = urlString.isolatedCopy(), referrer = referrer.isolatedCopy()] { >- auto item = adoptCF(MDItemCreate(kCFAllocatorDefault, path.createCFString().get())); >- if (!item) >- return; >- >- auto whereFromAttribute = adoptNS([[NSMutableArray alloc] initWithObjects:urlString, nil]); >- if (!referrer.isNull()) >- [whereFromAttribute addObject:referrer]; >- >- MDItemSetAttribute(item.get(), kMDItemWhereFroms, (__bridge CFArrayRef)whereFromAttribute.get()); >- MDItemSetAttribute(item.get(), kMDItemDownloadedDate, (__bridge CFArrayRef)@[ [NSDate date] ]); >- }); >-} >- >-bool FileSystem::canExcludeFromBackup() >-{ >- return true; >-} >- >-bool FileSystem::excludeFromBackup(const String& path) >-{ >- // It is critical to pass FALSE for excludeByPath because excluding by path requires root privileges. >- CSBackupSetItemExcluded(FileSystem::pathAsURL(path).get(), TRUE, FALSE); >- return true; >-} >- >-} // namespace WebCore >- >-#endif // PLATFORM(MAC) >diff --git a/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm b/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm >index d7e3f39a67b373b83879c8409c58b0898d3479ec..d79e2f60c609403abdfc02aebf70a26bccdf2f3f 100644 >--- a/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm >+++ b/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm >@@ -29,13 +29,13 @@ > #if ENABLE(MEDIA_STREAM) && USE(AVFOUNDATION) > > #include "AudioStreamDescription.h" >-#include "FileSystem.h" > #include "Logging.h" > #include "MediaStreamTrackPrivate.h" > #include "WebAudioBufferList.h" > #include <AVFoundation/AVAssetWriter.h> > #include <AVFoundation/AVAssetWriterInput.h> > #include <pal/cf/CoreMediaSoftLink.h> >+#include <wtf/FileSystem.h> > > typedef AVAssetWriter AVAssetWriterType; > typedef AVAssetWriterInput AVAssetWriterInputType; >diff --git a/Source/WebCore/platform/network/BlobDataFileReference.cpp b/Source/WebCore/platform/network/BlobDataFileReference.cpp >index b63f0612abfcb866da0ced0a235dc15593ff05ed..5abfd75cb49456e42d39d44d3bc2259aaffa5226 100644 >--- a/Source/WebCore/platform/network/BlobDataFileReference.cpp >+++ b/Source/WebCore/platform/network/BlobDataFileReference.cpp >@@ -27,8 +27,8 @@ > #include "BlobDataFileReference.h" > > #include "File.h" >-#include "FileMetadata.h" >-#include "FileSystem.h" >+#include <wtf/FileMetadata.h> >+#include <wtf/FileSystem.h> > > namespace WebCore { > >diff --git a/Source/WebCore/platform/network/BlobRegistryImpl.cpp b/Source/WebCore/platform/network/BlobRegistryImpl.cpp >index 80b41e975e4d6143af4c996117547bb892eda318..1c706aa346caddea39e500d80304cd494bd82681 100644 >--- a/Source/WebCore/platform/network/BlobRegistryImpl.cpp >+++ b/Source/WebCore/platform/network/BlobRegistryImpl.cpp >@@ -35,13 +35,13 @@ > #include "BlobData.h" > #include "BlobPart.h" > #include "BlobResourceHandle.h" >-#include "FileMetadata.h" >-#include "FileSystem.h" > #include "ResourceError.h" > #include "ResourceHandle.h" > #include "ResourceRequest.h" > #include "ResourceResponse.h" > #include <wtf/CompletionHandler.h> >+#include <wtf/FileMetadata.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/Scope.h> >diff --git a/Source/WebCore/platform/network/BlobResourceHandle.cpp b/Source/WebCore/platform/network/BlobResourceHandle.cpp >index c94e39494b8e326db4a12a27201a46238de18c4b..cc67ce688f3bca222690b43f105878ba9e3c28f8 100644 >--- a/Source/WebCore/platform/network/BlobResourceHandle.cpp >+++ b/Source/WebCore/platform/network/BlobResourceHandle.cpp >@@ -35,19 +35,19 @@ > #include "AsyncFileStream.h" > #include "BlobData.h" > #include "FileStream.h" >-#include "FileSystem.h" > #include "HTTPHeaderNames.h" > #include "HTTPParsers.h" > #include "ParsedContentRange.h" >-#include <wtf/URL.h> > #include "ResourceError.h" > #include "ResourceHandleClient.h" > #include "ResourceRequest.h" > #include "ResourceResponse.h" > #include "SharedBuffer.h" > #include <wtf/CompletionHandler.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/Ref.h> >+#include <wtf/URL.h> > > namespace WebCore { > >diff --git a/Source/WebCore/platform/network/FormData.cpp b/Source/WebCore/platform/network/FormData.cpp >index 54e4ac04962a221907e3b7d80a4fbacbe254b399..7b76a5eede99f949c81e69cfe1bdbb896ccc267e 100644 >--- a/Source/WebCore/platform/network/FormData.cpp >+++ b/Source/WebCore/platform/network/FormData.cpp >@@ -29,12 +29,12 @@ > #include "DOMFormData.h" > #include "Document.h" > #include "File.h" >-#include "FileSystem.h" > #include "FormDataBuilder.h" > #include "Page.h" > #include "SharedBuffer.h" > #include "TextEncoding.h" > #include "ThreadableBlobRegistry.h" >+#include <wtf/FileSystem.h> > #include <wtf/text/LineEnding.h> > > namespace WebCore { >diff --git a/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp b/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp >index 9e2d881d635491525d71af456c2d195fd13b94d6..a74ae5aac9cb2623dc9ca5a8aa40ac340212f2d6 100644 >--- a/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp >+++ b/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp >@@ -30,11 +30,11 @@ > #include "FormDataStreamCFNet.h" > > #include "BlobData.h" >-#include "FileSystem.h" > #include "FormData.h" > #include <sys/stat.h> > #include <sys/types.h> > #include <wtf/Assertions.h> >+#include <wtf/FileSystem.h> > #include <wtf/HashMap.h> > #include <wtf/MainThread.h> > #include <wtf/RetainPtr.h> >diff --git a/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm b/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm >index 27ff9d1ca8efa1fdd6edf288648647949f881a96..2fec1f3834e4116a1dd4ceb1f632898d5ece140d 100644 >--- a/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm >+++ b/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm >@@ -28,13 +28,13 @@ > > #if PLATFORM(COCOA) > >-#import "FileSystem.h" > #import "FormDataStreamMac.h" > #import "HTTPHeaderNames.h" > #import "ResourceRequestCFNet.h" > #import "RuntimeApplicationChecks.h" > #import <Foundation/Foundation.h> > #import <pal/spi/cf/CFNetworkSPI.h> >+#import <wtf/FileSystem.h> > #import <wtf/text/CString.h> > > namespace WebCore { >diff --git a/Source/WebCore/platform/network/curl/CookieJarDB.cpp b/Source/WebCore/platform/network/curl/CookieJarDB.cpp >index c23fd72f1917102082e121e44d58edd8a32d1e71..26362288b869d8c7bb3417f76f40b63cc57f7a79 100644 >--- a/Source/WebCore/platform/network/curl/CookieJarDB.cpp >+++ b/Source/WebCore/platform/network/curl/CookieJarDB.cpp >@@ -26,10 +26,9 @@ > #include "CookieJarDB.h" > > #include "CookieUtil.h" >-#include "FileSystem.h" > #include "Logging.h" > #include "SQLiteFileSystem.h" >- >+#include <wtf/FileSystem.h> > #include <wtf/MonotonicTime.h> > #include <wtf/URL.h> > >diff --git a/Source/WebCore/platform/network/curl/CurlCacheEntry.h b/Source/WebCore/platform/network/curl/CurlCacheEntry.h >index cbc45fed2b638ea62d912ec7ed2d66143b8f9d6b..11027ce3b3cf6388f9954aaf49c4903fe93fdff5 100644 >--- a/Source/WebCore/platform/network/curl/CurlCacheEntry.h >+++ b/Source/WebCore/platform/network/curl/CurlCacheEntry.h >@@ -26,11 +26,11 @@ > > #pragma once > >-#include "FileSystem.h" > #include "HTTPHeaderMap.h" > #include "ResourceHandle.h" > #include "ResourceRequest.h" > #include "ResourceResponse.h" >+#include <wtf/FileSystem.h> > #include <wtf/Forward.h> > #include <wtf/HashMap.h> > #include <wtf/ListHashSet.h> >diff --git a/Source/WebCore/platform/network/curl/CurlCacheManager.cpp b/Source/WebCore/platform/network/curl/CurlCacheManager.cpp >index 43bc2e7bfff4f9bd6f710285d6d3d8631bb7783a..fa5c8d2d21b6273815d023a4f20455016e9638af 100644 >--- a/Source/WebCore/platform/network/curl/CurlCacheManager.cpp >+++ b/Source/WebCore/platform/network/curl/CurlCacheManager.cpp >@@ -30,12 +30,12 @@ > > #include "CurlCacheManager.h" > >-#include "FileSystem.h" > #include "HTTPHeaderMap.h" > #include "Logging.h" > #include "ResourceHandleClient.h" > #include "ResourceHandleInternal.h" > #include "ResourceRequest.h" >+#include <wtf/FileSystem.h> > #include <wtf/HashMap.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/text/CString.h> >diff --git a/Source/WebCore/platform/network/curl/CurlFormDataStream.h b/Source/WebCore/platform/network/curl/CurlFormDataStream.h >index c8ef333e0d8c0e028ecd8a46d826b90671a00e0c..09e7fdbb4a2cfab4b90732f06114be08113bb51d 100644 >--- a/Source/WebCore/platform/network/curl/CurlFormDataStream.h >+++ b/Source/WebCore/platform/network/curl/CurlFormDataStream.h >@@ -26,8 +26,8 @@ > > #pragma once > >-#include "FileSystem.h" > #include "FormData.h" >+#include <wtf/FileSystem.h> > #include <wtf/Vector.h> > > namespace WebCore { >diff --git a/Source/WebCore/platform/network/curl/CurlRequest.h b/Source/WebCore/platform/network/curl/CurlRequest.h >index fdc4b590c142cf6dc98077d9f75d78656361969d..93ca6103fe63d5ff031055c825d80282764aedba 100644 >--- a/Source/WebCore/platform/network/curl/CurlRequest.h >+++ b/Source/WebCore/platform/network/curl/CurlRequest.h >@@ -32,10 +32,10 @@ > #include "CurlRequestSchedulerClient.h" > #include "CurlResponse.h" > #include "CurlSSLVerifier.h" >-#include "FileSystem.h" > #include "NetworkLoadMetrics.h" > #include "ProtectionSpace.h" > #include "ResourceRequest.h" >+#include <wtf/FileSystem.h> > #include <wtf/MessageQueue.h> > #include <wtf/MonotonicTime.h> > #include <wtf/Noncopyable.h> >diff --git a/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp b/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp >index a342ec5f0a55211ab7347e4113e31725ac40b2fd..05b567232bbd66f0bd071ddb8a0f0cdaff6efaa9 100644 >--- a/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp >+++ b/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp >@@ -33,10 +33,9 @@ > #include "CookieJarDB.h" > #include "CookieRequestHeaderFieldProxy.h" > #include "CurlContext.h" >-#include "FileSystem.h" > #include "NetworkingContext.h" > #include "ResourceHandle.h" >- >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/URL.h> >diff --git a/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp b/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp >index e51e7abf0a055a08d8f958f5b1ef1ca264a8b726..7be00ad34b8e59882de0f513b6c2ddf9011f99e1 100644 >--- a/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp >+++ b/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp >@@ -38,7 +38,6 @@ > #include "CurlCacheManager.h" > #include "CurlContext.h" > #include "CurlRequest.h" >-#include "FileSystem.h" > #include "HTTPParsers.h" > #include "Logging.h" > #include "NetworkStorageSession.h" >@@ -48,6 +47,7 @@ > #include "SynchronousLoaderClient.h" > #include "TextEncoding.h" > #include <wtf/CompletionHandler.h> >+#include <wtf/FileSystem.h> > #include <wtf/text/Base64.h> > > namespace WebCore { >diff --git a/Source/WebCore/platform/network/mac/BlobDataFileReferenceMac.mm b/Source/WebCore/platform/network/mac/BlobDataFileReferenceMac.mm >index fcf55d76ea45ebb067043ecdfc8cf08cc9246a29..b692920b21fc6639d5745d1c044e8b78782350d0 100644 >--- a/Source/WebCore/platform/network/mac/BlobDataFileReferenceMac.mm >+++ b/Source/WebCore/platform/network/mac/BlobDataFileReferenceMac.mm >@@ -28,8 +28,8 @@ > > #if ENABLE(FILE_REPLACEMENT) > >-#include "FileMetadata.h" >-#include "FileSystem.h" >+#include <wtf/FileMetadata.h> >+#include <wtf/FileSystem.h> > #include <wtf/SoftLinking.h> > #include <wtf/text/CString.h> > >diff --git a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp >index 63734c674c52ee95dc6c9e421c4660f418400baa..0815ea688e766927e663d4056149dbd368e646cb 100644 >--- a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp >+++ b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp >@@ -32,7 +32,6 @@ > #if USE(SOUP) > > #include "CredentialStorage.h" >-#include "FileSystem.h" > #include "GUniquePtrSoup.h" > #include "HTTPParsers.h" > #include "LocalizedStrings.h" >@@ -57,6 +56,7 @@ > #include <unistd.h> > #endif > #include <wtf/CompletionHandler.h> >+#include <wtf/FileSystem.h> > #include <wtf/glib/GRefPtr.h> > #include <wtf/glib/RunLoopSourcePriority.h> > #include <wtf/text/CString.h> >diff --git a/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp b/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp >index 343faeb9feb2194ccc3ef779d77d3f6b4d1edc87..b967795980ee8fa4c99500ffdf34b4202eb2a2db 100644 >--- a/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp >+++ b/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp >@@ -30,13 +30,13 @@ > #include "SoupNetworkSession.h" > > #include "AuthenticationChallenge.h" >-#include "FileSystem.h" > #include "GUniquePtrSoup.h" > #include "Logging.h" > #include "SoupNetworkProxySettings.h" > #include <glib/gstdio.h> > #include <libsoup/soup.h> > #include <pal/crypto/CryptoDigest.h> >+#include <wtf/FileSystem.h> > #include <wtf/HashSet.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/text/Base64.h> >diff --git a/Source/WebCore/platform/posix/FileSystemPOSIX.cpp b/Source/WebCore/platform/posix/FileSystemPOSIX.cpp >deleted file mode 100644 >index 94851352518d606bea25eeea336185280334cfcc..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/posix/FileSystemPOSIX.cpp >+++ /dev/null >@@ -1,493 +0,0 @@ >-/* >- * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * 3. Neither the name of Apple Inc. ("Apple") nor the names of >- * its contributors may be used to endorse or promote products derived >- * from this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "FileSystem.h" >- >-#include "FileMetadata.h" >-#include <dirent.h> >-#include <errno.h> >-#include <fcntl.h> >-#include <fnmatch.h> >-#include <libgen.h> >-#include <stdio.h> >-#include <sys/stat.h> >-#include <sys/statvfs.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> >- >-namespace WebCore { >- >-namespace FileSystem { >- >-bool fileExists(const String& path) >-{ >- if (path.isNull()) >- return false; >- >- CString fsRep = fileSystemRepresentation(path); >- >- if (!fsRep.data() || fsRep.data()[0] == '\0') >- return false; >- >- return access(fsRep.data(), F_OK) != -1; >-} >- >-bool deleteFile(const String& path) >-{ >- CString fsRep = fileSystemRepresentation(path); >- >- if (!fsRep.data() || fsRep.data()[0] == '\0') >- return false; >- >- // unlink(...) returns 0 on successful deletion of the path and non-zero in any other case (including invalid permissions or non-existent file) >- return !unlink(fsRep.data()); >-} >- >-PlatformFileHandle openFile(const String& path, FileOpenMode mode) >-{ >- CString fsRep = fileSystemRepresentation(path); >- >- if (fsRep.isNull()) >- return invalidPlatformFileHandle; >- >- int platformFlag = 0; >- if (mode == FileOpenMode::Read) >- platformFlag |= O_RDONLY; >- else if (mode == FileOpenMode::Write) >- platformFlag |= (O_WRONLY | O_CREAT | O_TRUNC); >-#if OS(DARWIN) >- else if (mode == FileOpenMode::EventsOnly) >- platformFlag |= O_EVTONLY; >-#endif >- >- return open(fsRep.data(), platformFlag, 0666); >-} >- >-void closeFile(PlatformFileHandle& handle) >-{ >- if (isHandleValid(handle)) { >- close(handle); >- handle = invalidPlatformFileHandle; >- } >-} >- >-long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) >-{ >- int whence = SEEK_SET; >- switch (origin) { >- case FileSeekOrigin::Beginning: >- whence = SEEK_SET; >- break; >- case FileSeekOrigin::Current: >- whence = SEEK_CUR; >- break; >- case FileSeekOrigin::End: >- whence = SEEK_END; >- break; >- default: >- ASSERT_NOT_REACHED(); >- } >- return static_cast<long long>(lseek(handle, offset, whence)); >-} >- >-bool truncateFile(PlatformFileHandle handle, long long offset) >-{ >- // ftruncate returns 0 to indicate the success. >- return !ftruncate(handle, offset); >-} >- >-int writeToFile(PlatformFileHandle handle, const char* data, int length) >-{ >- do { >- int bytesWritten = write(handle, data, static_cast<size_t>(length)); >- if (bytesWritten >= 0) >- return bytesWritten; >- } while (errno == EINTR); >- return -1; >-} >- >-int readFromFile(PlatformFileHandle handle, char* data, int length) >-{ >- do { >- int bytesRead = read(handle, data, static_cast<size_t>(length)); >- if (bytesRead >= 0) >- return bytesRead; >- } while (errno == EINTR); >- return -1; >-} >- >-#if USE(FILE_LOCK) >-bool lockFile(PlatformFileHandle handle, OptionSet<FileLockMode> 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); >-} >- >-bool unlockFile(PlatformFileHandle handle) >-{ >- int result = flock(handle, LOCK_UN); >- return (result != -1); >-} >-#endif >- >-#if !PLATFORM(MAC) >-bool deleteEmptyDirectory(const String& path) >-{ >- CString fsRep = fileSystemRepresentation(path); >- >- if (!fsRep.data() || fsRep.data()[0] == '\0') >- return false; >- >- // rmdir(...) returns 0 on successful deletion of the path and non-zero in any other case (including invalid permissions or non-existent file) >- return !rmdir(fsRep.data()); >-} >-#endif >- >-bool getFileSize(const String& path, long long& result) >-{ >- CString fsRep = fileSystemRepresentation(path); >- >- if (!fsRep.data() || fsRep.data()[0] == '\0') >- return false; >- >- struct stat fileInfo; >- >- if (stat(fsRep.data(), &fileInfo)) >- return false; >- >- result = fileInfo.st_size; >- return true; >-} >- >-bool getFileSize(PlatformFileHandle handle, long long& result) >-{ >- struct stat fileInfo; >- if (fstat(handle, &fileInfo)) >- return false; >- >- result = fileInfo.st_size; >- return true; >-} >- >-Optional<WallTime> getFileCreationTime(const String& path) >-{ >-#if OS(DARWIN) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD) >- CString fsRep = fileSystemRepresentation(path); >- >- if (!fsRep.data() || fsRep.data()[0] == '\0') >- return WTF::nullopt; >- >- struct stat fileInfo; >- >- if (stat(fsRep.data(), &fileInfo)) >- return WTF::nullopt; >- >- return WallTime::fromRawSeconds(fileInfo.st_birthtime); >-#else >- UNUSED_PARAM(path); >- return WTF::nullopt; >-#endif >-} >- >-Optional<WallTime> getFileModificationTime(const String& path) >-{ >- CString fsRep = fileSystemRepresentation(path); >- >- if (!fsRep.data() || fsRep.data()[0] == '\0') >- return WTF::nullopt; >- >- struct stat fileInfo; >- >- if (stat(fsRep.data(), &fileInfo)) >- return WTF::nullopt; >- >- return WallTime::fromRawSeconds(fileInfo.st_mtime); >-} >- >-static FileMetadata::Type toFileMetataType(struct stat fileInfo) >-{ >- if (S_ISDIR(fileInfo.st_mode)) >- return FileMetadata::Type::Directory; >- if (S_ISLNK(fileInfo.st_mode)) >- return FileMetadata::Type::SymbolicLink; >- return FileMetadata::Type::File; >-} >- >-static Optional<FileMetadata> fileMetadataUsingFunction(const String& path, int (*statFunc)(const char*, struct stat*)) >-{ >- CString fsRep = fileSystemRepresentation(path); >- >- if (!fsRep.data() || fsRep.data()[0] == '\0') >- return WTF::nullopt; >- >- struct stat fileInfo; >- if (statFunc(fsRep.data(), &fileInfo)) >- return WTF::nullopt; >- >- String filename = pathGetFileName(path); >- bool isHidden = !filename.isEmpty() && filename[0] == '.'; >- return FileMetadata { >- WallTime::fromRawSeconds(fileInfo.st_mtime), >- fileInfo.st_size, >- isHidden, >- toFileMetataType(fileInfo) >- }; >-} >- >-Optional<FileMetadata> fileMetadata(const String& path) >-{ >- return fileMetadataUsingFunction(path, &lstat); >-} >- >-Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) >-{ >- return fileMetadataUsingFunction(path, &stat); >-} >- >-bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath) >-{ >- CString targetPathFSRep = fileSystemRepresentation(targetPath); >- if (!targetPathFSRep.data() || targetPathFSRep.data()[0] == '\0') >- return false; >- >- CString symbolicLinkPathFSRep = fileSystemRepresentation(symbolicLinkPath); >- if (!symbolicLinkPathFSRep.data() || symbolicLinkPathFSRep.data()[0] == '\0') >- return false; >- >- return !symlink(targetPathFSRep.data(), symbolicLinkPathFSRep.data()); >-} >- >-String pathByAppendingComponent(const String& path, const String& component) >-{ >- if (path.endsWith('/')) >- return path + component; >- return path + "/" + component; >-} >- >-String pathByAppendingComponents(StringView path, const Vector<StringView>& components) >-{ >- StringBuilder builder; >- builder.append(path); >- for (auto& component : components) { >- builder.append('/'); >- builder.append(component); >- } >- return builder.toString(); >-} >- >-bool makeAllDirectories(const String& path) >-{ >- CString fullPath = fileSystemRepresentation(path); >- if (!access(fullPath.data(), F_OK)) >- return true; >- >- char* p = fullPath.mutableData() + 1; >- int length = fullPath.length(); >- >- if(p[length - 1] == '/') >- p[length - 1] = '\0'; >- for (; *p; ++p) >- if (*p == '/') { >- *p = '\0'; >- if (access(fullPath.data(), F_OK)) >- if (mkdir(fullPath.data(), S_IRWXU)) >- return false; >- *p = '/'; >- } >- if (access(fullPath.data(), F_OK)) >- if (mkdir(fullPath.data(), S_IRWXU)) >- return false; >- >- return true; >-} >- >-String pathGetFileName(const String& path) >-{ >- return path.substring(path.reverseFind('/') + 1); >-} >- >-String directoryName(const String& path) >-{ >- CString fsRep = fileSystemRepresentation(path); >- >- if (!fsRep.data() || fsRep.data()[0] == '\0') >- return String(); >- >- return String::fromUTF8(dirname(fsRep.mutableData())); >-} >- >-Vector<String> listDirectory(const String& path, const String& filter) >-{ >- Vector<String> entries; >- CString cpath = fileSystemRepresentation(path); >- CString cfilter = fileSystemRepresentation(filter); >- DIR* dir = opendir(cpath.data()); >- if (dir) { >- struct dirent* dp; >- while ((dp = readdir(dir))) { >- const char* name = dp->d_name; >- if (!strcmp(name, ".") || !strcmp(name, "..")) >- continue; >- if (fnmatch(cfilter.data(), name, 0)) >- continue; >- char filePath[PATH_MAX]; >- if (static_cast<int>(sizeof(filePath) - 1) < snprintf(filePath, sizeof(filePath), "%s/%s", cpath.data(), name)) >- continue; // buffer overflow >- >- auto string = stringFromFileSystemRepresentation(filePath); >- >- // Some file system representations cannot be represented as a UTF-16 string, >- // so this string might be null. >- if (!string.isNull()) >- entries.append(WTFMove(string)); >- } >- closedir(dir); >- } >- return entries; >-} >- >-#if !PLATFORM(COCOA) >-String stringFromFileSystemRepresentation(const char* path) >-{ >- if (!path) >- return String(); >- >- return String::fromUTF8(path); >-} >- >-CString fileSystemRepresentation(const String& path) >-{ >- return path.utf8(); >-} >- >-bool moveFile(const String& oldPath, const String& newPath) >-{ >- auto oldFilename = fileSystemRepresentation(oldPath); >- if (oldFilename.isNull()) >- return false; >- >- auto newFilename = fileSystemRepresentation(newPath); >- if (newFilename.isNull()) >- return false; >- >- return rename(oldFilename.data(), newFilename.data()) != -1; >-} >- >-bool getVolumeFreeSpace(const String& path, uint64_t& freeSpace) >-{ >- struct statvfs fileSystemStat; >- if (statvfs(fileSystemRepresentation(path).data(), &fileSystemStat)) { >- freeSpace = fileSystemStat.f_bavail * fileSystemStat.f_frsize; >- return true; >- } >- return false; >-} >-#endif >- >-#if !OS(DARWIN) >-String openTemporaryFile(const String& prefix, PlatformFileHandle& handle) >-{ >- char buffer[PATH_MAX]; >- const char* tmpDir = getenv("TMPDIR"); >- >- if (!tmpDir) >- tmpDir = "/tmp"; >- >- if (snprintf(buffer, PATH_MAX, "%s/%sXXXXXX", tmpDir, prefix.utf8().data()) >= PATH_MAX) >- goto end; >- >- handle = mkstemp(buffer); >- if (handle < 0) >- goto end; >- >- return String::fromUTF8(buffer); >- >-end: >- handle = invalidPlatformFileHandle; >- return String(); >-} >-#endif >- >-bool hardLinkOrCopyFile(const String& source, const String& destination) >-{ >- if (source.isEmpty() || destination.isEmpty()) >- return false; >- >- CString fsSource = fileSystemRepresentation(source); >- if (!fsSource.data()) >- return false; >- >- CString fsDestination = fileSystemRepresentation(destination); >- if (!fsDestination.data()) >- return false; >- >- if (!link(fsSource.data(), fsDestination.data())) >- return true; >- >- // Hard link failed. Perform a copy instead. >- auto handle = open(fsDestination.data(), O_WRONLY | O_CREAT | O_EXCL, 0666); >- if (handle == -1) >- return false; >- >- bool appendResult = appendFileContentsToFileHandle(source, handle); >- close(handle); >- >- // If the copy failed, delete the unusable file. >- if (!appendResult) >- unlink(fsDestination.data()); >- >- return appendResult; >-} >- >-Optional<int32_t> getFileDeviceId(const CString& fsFile) >-{ >- struct stat fileStat; >- if (stat(fsFile.data(), &fileStat) == -1) >- return WTF::nullopt; >- >- return fileStat.st_dev; >-} >- >-String realPath(const String& filePath) >-{ >- CString fsRep = fileSystemRepresentation(filePath); >- char resolvedName[PATH_MAX]; >- const char* result = realpath(fsRep.data(), resolvedName); >- return result ? String::fromUTF8(result) : filePath; >-} >- >-} // namespace FileSystem >-} // namespace WebCore >diff --git a/Source/WebCore/platform/posix/SharedBufferPOSIX.cpp b/Source/WebCore/platform/posix/SharedBufferPOSIX.cpp >index 513375d245ef45c196a854615ce70b78a90cecff..8ed57174778cb7bdadca36517fd79445738c52d7 100644 >--- a/Source/WebCore/platform/posix/SharedBufferPOSIX.cpp >+++ b/Source/WebCore/platform/posix/SharedBufferPOSIX.cpp >@@ -26,11 +26,10 @@ > #include "config.h" > #include "SharedBuffer.h" > >-#include "FileSystem.h" >- > #include <fcntl.h> > #include <sys/stat.h> > #include <unistd.h> >+#include <wtf/FileSystem.h> > #include <wtf/text/CString.h> > > namespace WebCore { >diff --git a/Source/WebCore/platform/sql/SQLiteFileSystem.cpp b/Source/WebCore/platform/sql/SQLiteFileSystem.cpp >index 90c20c7bce6a67b67d53d5c4053776bf14c7e5e5..364bff7107497896f7b1d757a7d9a5fc3ad3f643 100644 >--- a/Source/WebCore/platform/sql/SQLiteFileSystem.cpp >+++ b/Source/WebCore/platform/sql/SQLiteFileSystem.cpp >@@ -31,10 +31,10 @@ > #include "config.h" > #include "SQLiteFileSystem.h" > >-#include "FileSystem.h" > #include "SQLiteDatabase.h" > #include "SQLiteStatement.h" > #include <sqlite3.h> >+#include <wtf/FileSystem.h> > > #if PLATFORM(IOS_FAMILY) > #include <pal/spi/ios/SQLite3SPI.h> >diff --git a/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp b/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp >index 2d7b66d937905dcc22f4a13e95a0af06bb48b7af..5eeb9bfa7400f7215c026c552d82aa38a763f942 100644 >--- a/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp >+++ b/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp >@@ -29,10 +29,10 @@ > > #if USE(LIBHYPHEN) > >-#include "FileSystem.h" > #include <hyphen.h> > #include <limits> > #include <stdlib.h> >+#include <wtf/FileSystem.h> > #include <wtf/HashMap.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/TinyLRUCache.h> >@@ -224,7 +224,7 @@ public: > > static RefPtr<WebCore::HyphenationDictionary> createValueForKey(const AtomicString& dictionaryPath) > { >- return WebCore::HyphenationDictionary::create(WebCore::FileSystem::fileSystemRepresentation(dictionaryPath.string())); >+ return WebCore::HyphenationDictionary::create(FileSystem::fileSystemRepresentation(dictionaryPath.string())); > } > }; > >diff --git a/Source/WebCore/platform/win/FileSystemWin.cpp b/Source/WebCore/platform/win/FileSystemWin.cpp >deleted file mode 100644 >index bb702cb0120abbf258529faf94310ddfffdf6084..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/win/FileSystemWin.cpp >+++ /dev/null >@@ -1,589 +0,0 @@ >-/* >- * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >- * Copyright (C) 2008 Collabora, Ltd. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * 3. Neither the name of Apple Inc. ("Apple") nor the names of >- * its contributors may be used to endorse or promote products derived >- * from this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "FileSystem.h" >- >-#include "FileMetadata.h" >-#include "NotImplemented.h" >-#include "PathWalker.h" >-#include <io.h> >-#include <shlobj.h> >-#include <shlwapi.h> >-#include <sys/stat.h> >-#include <windows.h> >-#include <wtf/CryptographicallyRandomNumber.h> >-#include <wtf/HashMap.h> >-#include <wtf/text/CString.h> >-#include <wtf/text/StringBuilder.h> >-#include <wtf/text/win/WCharStringExtras.h> >- >-namespace WebCore { >- >-namespace FileSystem { >- >-static const ULONGLONG kSecondsFromFileTimeToTimet = 11644473600; >- >-static bool getFindData(String path, WIN32_FIND_DATAW& findData) >-{ >- HANDLE handle = FindFirstFileW(stringToNullTerminatedWChar(path).data(), &findData); >- if (handle == INVALID_HANDLE_VALUE) >- return false; >- FindClose(handle); >- return true; >-} >- >-static bool getFileSizeFromFindData(const WIN32_FIND_DATAW& findData, long long& size) >-{ >- ULARGE_INTEGER fileSize; >- fileSize.HighPart = findData.nFileSizeHigh; >- fileSize.LowPart = findData.nFileSizeLow; >- >- if (fileSize.QuadPart > static_cast<ULONGLONG>(std::numeric_limits<long long>::max())) >- return false; >- >- size = fileSize.QuadPart; >- return true; >-} >- >-static bool getFileSizeFromByHandleFileInformationStructure(const BY_HANDLE_FILE_INFORMATION& fileInformation, long long& size) >-{ >- ULARGE_INTEGER fileSize; >- fileSize.HighPart = fileInformation.nFileSizeHigh; >- fileSize.LowPart = fileInformation.nFileSizeLow; >- >- if (fileSize.QuadPart > static_cast<ULONGLONG>(std::numeric_limits<long long>::max())) >- return false; >- >- size = fileSize.QuadPart; >- return true; >-} >- >-static void getFileCreationTimeFromFindData(const WIN32_FIND_DATAW& findData, time_t& time) >-{ >- ULARGE_INTEGER fileTime; >- fileTime.HighPart = findData.ftCreationTime.dwHighDateTime; >- fileTime.LowPart = findData.ftCreationTime.dwLowDateTime; >- >- // Information about converting time_t to FileTime is available at http://msdn.microsoft.com/en-us/library/ms724228%28v=vs.85%29.aspx >- time = fileTime.QuadPart / 10000000 - kSecondsFromFileTimeToTimet; >-} >- >- >-static void getFileModificationTimeFromFindData(const WIN32_FIND_DATAW& findData, time_t& time) >-{ >- ULARGE_INTEGER fileTime; >- fileTime.HighPart = findData.ftLastWriteTime.dwHighDateTime; >- fileTime.LowPart = findData.ftLastWriteTime.dwLowDateTime; >- >- // Information about converting time_t to FileTime is available at http://msdn.microsoft.com/en-us/library/ms724228%28v=vs.85%29.aspx >- time = fileTime.QuadPart / 10000000 - kSecondsFromFileTimeToTimet; >-} >- >-bool getFileSize(const String& path, long long& size) >-{ >- WIN32_FIND_DATAW findData; >- if (!getFindData(path, findData)) >- return false; >- >- return getFileSizeFromFindData(findData, size); >-} >- >-bool getFileSize(PlatformFileHandle fileHandle, long long& size) >-{ >- BY_HANDLE_FILE_INFORMATION fileInformation; >- if (!::GetFileInformationByHandle(fileHandle, &fileInformation)) >- return false; >- >- return getFileSizeFromByHandleFileInformationStructure(fileInformation, size); >-} >- >-Optional<WallTime> getFileModificationTime(const String& path) >-{ >- WIN32_FIND_DATAW findData; >- if (!getFindData(path, findData)) >- return WTF::nullopt; >- >- time_t time = 0; >- getFileModificationTimeFromFindData(findData, time); >- return WallTime::fromRawSeconds(time); >-} >- >-Optional<WallTime> getFileCreationTime(const String& path) >-{ >- WIN32_FIND_DATAW findData; >- if (!getFindData(path, findData)) >- return WTF::nullopt; >- >- time_t time = 0; >- getFileCreationTimeFromFindData(findData, time); >- return WallTime::fromRawSeconds(time); >-} >- >-static String getFinalPathName(const String& path) >-{ >- auto handle = openFile(path, FileOpenMode::Read); >- if (!isHandleValid(handle)) >- return String(); >- >- Vector<UChar> buffer(MAX_PATH); >- if (::GetFinalPathNameByHandleW(handle, buffer.data(), buffer.size(), VOLUME_NAME_NT) >= MAX_PATH) { >- closeFile(handle); >- return String(); >- } >- closeFile(handle); >- >- buffer.shrink(wcslen(buffer.data())); >- return String::adopt(WTFMove(buffer)); >-} >- >-static inline bool isSymbolicLink(WIN32_FIND_DATAW findData) >-{ >- return findData.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT && findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK; >-} >- >-static FileMetadata::Type toFileMetadataType(WIN32_FIND_DATAW findData) >-{ >- if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) >- return FileMetadata::Type::Directory; >- if (isSymbolicLink(findData)) >- return FileMetadata::Type::SymbolicLink; >- return FileMetadata::Type::File; >-} >- >-static Optional<FileMetadata> findDataToFileMetadata(WIN32_FIND_DATAW findData) >-{ >- long long length; >- if (!getFileSizeFromFindData(findData, length)) >- return WTF::nullopt; >- >- time_t modificationTime; >- getFileModificationTimeFromFindData(findData, modificationTime); >- >- return FileMetadata { >- WallTime::fromRawSeconds(modificationTime), >- length, >- static_cast<bool>(findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN), >- toFileMetadataType(findData) >- }; >-} >- >-Optional<FileMetadata> fileMetadata(const String& path) >-{ >- WIN32_FIND_DATAW findData; >- if (!getFindData(path, findData)) >- return WTF::nullopt; >- >- return findDataToFileMetadata(findData); >-} >- >-Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path) >-{ >- WIN32_FIND_DATAW findData; >- if (!getFindData(path, findData)) >- return WTF::nullopt; >- >- if (isSymbolicLink(findData)) { >- String targetPath = getFinalPathName(path); >- if (targetPath.isNull()) >- return WTF::nullopt; >- if (!getFindData(targetPath, findData)) >- return WTF::nullopt; >- } >- >- return findDataToFileMetadata(findData); >-} >- >-bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath) >-{ >- return !::CreateSymbolicLinkW(stringToNullTerminatedWChar(symbolicLinkPath).data(), stringToNullTerminatedWChar(targetPath).data(), 0); >-} >- >-bool fileExists(const String& path) >-{ >- WIN32_FIND_DATAW findData; >- return getFindData(path, findData); >-} >- >-bool deleteFile(const String& path) >-{ >- String filename = path; >- return !!DeleteFileW(stringToNullTerminatedWChar(filename).data()); >-} >- >-bool deleteEmptyDirectory(const String& path) >-{ >- String filename = path; >- return !!RemoveDirectoryW(stringToNullTerminatedWChar(filename).data()); >-} >- >-bool moveFile(const String& oldPath, const String& newPath) >-{ >- String oldFilename = oldPath; >- String newFilename = newPath; >- return !!::MoveFileEx(stringToNullTerminatedWChar(oldFilename).data(), stringToNullTerminatedWChar(newFilename).data(), MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); >-} >- >-String pathByAppendingComponent(const String& path, const String& component) >-{ >- Vector<UChar> buffer(MAX_PATH); >- >- if (path.length() + 1 > buffer.size()) >- return String(); >- >- StringView(path).getCharactersWithUpconvert(buffer.data()); >- buffer[path.length()] = '\0'; >- >- if (!PathAppendW(buffer.data(), stringToNullTerminatedWChar(component).data())) >- return String(); >- >- buffer.shrink(wcslen(buffer.data())); >- >- return String::adopt(WTFMove(buffer)); >-} >- >-String pathByAppendingComponents(StringView path, const Vector<StringView>& components) >-{ >- String result = path.toString(); >- for (auto& component : components) >- result = pathByAppendingComponent(result, component.toString()); >- return result; >-} >- >-#if !USE(CF) >- >-CString fileSystemRepresentation(const String& path) >-{ >- auto upconvertedCharacters = path.upconvertedCharacters(); >- >- const UChar* characters = upconvertedCharacters; >- int size = WideCharToMultiByte(CP_ACP, 0, characters, path.length(), 0, 0, 0, 0) - 1; >- >- char* buffer; >- CString string = CString::newUninitialized(size, buffer); >- >- WideCharToMultiByte(CP_ACP, 0, characters, path.length(), buffer, size, 0, 0); >- >- return string; >-} >- >-#endif // !USE(CF) >- >-bool makeAllDirectories(const String& path) >-{ >- String fullPath = path; >- if (SHCreateDirectoryEx(0, stringToNullTerminatedWChar(fullPath).data(), 0) != ERROR_SUCCESS) { >- DWORD error = GetLastError(); >- if (error != ERROR_FILE_EXISTS && error != ERROR_ALREADY_EXISTS) { >- LOG_ERROR("Failed to create path %s", path.ascii().data()); >- return false; >- } >- } >- return true; >-} >- >-String homeDirectoryPath() >-{ >- notImplemented(); >- return ""; >-} >- >-String pathGetFileName(const String& path) >-{ >- return nullTerminatedWCharToString(::PathFindFileName(stringToNullTerminatedWChar(path).data())); >-} >- >-String directoryName(const String& path) >-{ >- String name = path.left(path.length() - pathGetFileName(path).length()); >- if (name.characterStartingAt(name.length() - 1) == '\\') { >- // Remove any trailing "\". >- name.truncate(name.length() - 1); >- } >- return name; >-} >- >-static String bundleName() >-{ >- static const NeverDestroyed<String> name = [] { >- String name { "WebKit"_s }; >- >-#if USE(CF) >- if (CFBundleRef bundle = CFBundleGetMainBundle()) { >- if (CFTypeRef bundleExecutable = CFBundleGetValueForInfoDictionaryKey(bundle, kCFBundleExecutableKey)) { >- if (CFGetTypeID(bundleExecutable) == CFStringGetTypeID()) >- name = reinterpret_cast<CFStringRef>(bundleExecutable); >- } >- } >-#endif >- >- return name; >- }(); >- >- return name; >-} >- >-static String storageDirectory(DWORD pathIdentifier) >-{ >- Vector<UChar> buffer(MAX_PATH); >- if (FAILED(SHGetFolderPathW(0, pathIdentifier | CSIDL_FLAG_CREATE, 0, 0, buffer.data()))) >- return String(); >- buffer.resize(wcslen(buffer.data())); >- String directory = String::adopt(WTFMove(buffer)); >- >- directory = pathByAppendingComponent(directory, "Apple Computer\\" + bundleName()); >- if (!makeAllDirectories(directory)) >- return String(); >- >- return directory; >-} >- >-static String cachedStorageDirectory(DWORD pathIdentifier) >-{ >- static HashMap<DWORD, String> directories; >- >- HashMap<DWORD, String>::iterator it = directories.find(pathIdentifier); >- if (it != directories.end()) >- return it->value; >- >- String directory = storageDirectory(pathIdentifier); >- directories.add(pathIdentifier, directory); >- >- return directory; >-} >- >-static String generateTemporaryPath(const Function<bool(const String&)>& action) >-{ >- wchar_t tempPath[MAX_PATH]; >- int tempPathLength = ::GetTempPathW(WTF_ARRAY_LENGTH(tempPath), tempPath); >- if (tempPathLength <= 0 || tempPathLength > WTF_ARRAY_LENGTH(tempPath)) >- return String(); >- >- String proposedPath; >- do { >- wchar_t tempFile[] = L"XXXXXXXX.tmp"; // Use 8.3 style name (more characters aren't helpful due to 8.3 short file names) >- const int randomPartLength = 8; >- cryptographicallyRandomValues(tempFile, randomPartLength * sizeof(wchar_t)); >- >- // Limit to valid filesystem characters, also excluding others that could be problematic, like punctuation. >- // don't include both upper and lowercase since Windows file systems are typically not case sensitive. >- const char validChars[] = "0123456789abcdefghijklmnopqrstuvwxyz"; >- for (int i = 0; i < randomPartLength; ++i) >- tempFile[i] = validChars[tempFile[i] % (sizeof(validChars) - 1)]; >- >- ASSERT(wcslen(tempFile) == WTF_ARRAY_LENGTH(tempFile) - 1); >- >- proposedPath = pathByAppendingComponent(nullTerminatedWCharToString(tempPath), nullTerminatedWCharToString(tempFile)); >- if (proposedPath.isEmpty()) >- break; >- } while (!action(proposedPath)); >- >- return proposedPath; >-} >- >-String openTemporaryFile(const String&, PlatformFileHandle& handle) >-{ >- handle = INVALID_HANDLE_VALUE; >- >- String proposedPath = generateTemporaryPath([&handle](const String& proposedPath) { >- // use CREATE_NEW to avoid overwriting an existing file with the same name >- handle = ::CreateFileW(stringToNullTerminatedWChar(proposedPath).data(), GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0); >- >- return isHandleValid(handle) || GetLastError() == ERROR_ALREADY_EXISTS; >- }); >- >- if (!isHandleValid(handle)) >- return String(); >- >- return proposedPath; >-} >- >-PlatformFileHandle openFile(const String& path, FileOpenMode mode) >-{ >- DWORD desiredAccess = 0; >- DWORD creationDisposition = 0; >- DWORD shareMode = 0; >- switch (mode) { >- case FileOpenMode::Read: >- desiredAccess = GENERIC_READ; >- creationDisposition = OPEN_EXISTING; >- shareMode = FILE_SHARE_READ; >- break; >- case FileOpenMode::Write: >- desiredAccess = GENERIC_WRITE; >- creationDisposition = CREATE_ALWAYS; >- break; >- default: >- ASSERT_NOT_REACHED(); >- } >- >- String destination = path; >- return CreateFile(stringToNullTerminatedWChar(destination).data(), desiredAccess, shareMode, 0, creationDisposition, FILE_ATTRIBUTE_NORMAL, 0); >-} >- >-void closeFile(PlatformFileHandle& handle) >-{ >- if (isHandleValid(handle)) { >- ::CloseHandle(handle); >- handle = invalidPlatformFileHandle; >- } >-} >- >-long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) >-{ >- DWORD moveMethod = FILE_BEGIN; >- >- if (origin == FileSeekOrigin::Current) >- moveMethod = FILE_CURRENT; >- else if (origin == FileSeekOrigin::End) >- moveMethod = FILE_END; >- >- LARGE_INTEGER largeOffset; >- largeOffset.QuadPart = offset; >- >- largeOffset.LowPart = SetFilePointer(handle, largeOffset.LowPart, &largeOffset.HighPart, moveMethod); >- >- if (largeOffset.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) >- return -1; >- >- return largeOffset.QuadPart; >-} >- >-int writeToFile(PlatformFileHandle handle, const char* data, int length) >-{ >- if (!isHandleValid(handle)) >- return -1; >- >- DWORD bytesWritten; >- bool success = WriteFile(handle, data, length, &bytesWritten, 0); >- >- if (!success) >- return -1; >- return static_cast<int>(bytesWritten); >-} >- >-int readFromFile(PlatformFileHandle handle, char* data, int length) >-{ >- if (!isHandleValid(handle)) >- return -1; >- >- DWORD bytesRead; >- bool success = ::ReadFile(handle, data, length, &bytesRead, 0); >- >- if (!success) >- return -1; >- return static_cast<int>(bytesRead); >-} >- >-bool hardLinkOrCopyFile(const String& source, const String& destination) >-{ >- return !!::CopyFile(stringToNullTerminatedWChar(source).data(), stringToNullTerminatedWChar(destination).data(), TRUE); >-} >- >-String localUserSpecificStorageDirectory() >-{ >- return cachedStorageDirectory(CSIDL_LOCAL_APPDATA); >-} >- >-String roamingUserSpecificStorageDirectory() >-{ >- return cachedStorageDirectory(CSIDL_APPDATA); >-} >- >-Vector<String> listDirectory(const String& directory, const String& filter) >-{ >- Vector<String> entries; >- >- PathWalker walker(directory, filter); >- if (!walker.isValid()) >- return entries; >- >- do { >- if (walker.data().dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY >- && (!wcscmp(walker.data().cFileName, L".") || !wcscmp(walker.data().cFileName, L".."))) >- continue; >- >- entries.append(directory + "\\" + reinterpret_cast<const UChar*>(walker.data().cFileName)); >- } while (walker.step()); >- >- return entries; >-} >- >-bool getVolumeFreeSpace(const String&, uint64_t&) >-{ >- notImplemented(); >- return false; >-} >- >-Optional<int32_t> getFileDeviceId(const CString& fsFile) >-{ >- auto handle = openFile(fsFile.data(), FileOpenMode::Read); >- if (!isHandleValid(handle)) >- return WTF::nullopt; >- >- BY_HANDLE_FILE_INFORMATION fileInformation = { }; >- if (!::GetFileInformationByHandle(handle, &fileInformation)) { >- closeFile(handle); >- return WTF::nullopt; >- } >- >- closeFile(handle); >- >- return fileInformation.dwVolumeSerialNumber; >-} >- >-String realPath(const String& filePath) >-{ >- return getFinalPathName(filePath); >-} >- >-String createTemporaryDirectory() >-{ >- return generateTemporaryPath([](const String& proposedPath) { >- return makeAllDirectories(proposedPath); >- }); >-} >- >-bool deleteNonEmptyDirectory(const String& directoryPath) >-{ >- SHFILEOPSTRUCT deleteOperation = { >- nullptr, >- FO_DELETE, >- stringToNullTerminatedWChar(directoryPath).data(), >- L"", >- FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT, >- false, >- 0, >- L"" >- }; >- return !SHFileOperation(&deleteOperation); >-} >- >-} // namespace FileSystem >-} // namespace WebCore >diff --git a/Source/WebCore/platform/win/PathWalker.cpp b/Source/WebCore/platform/win/PathWalker.cpp >deleted file mode 100644 >index f20407b1cfea624f3a1569a8fd6768a5debed363..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/win/PathWalker.cpp >+++ /dev/null >@@ -1,52 +0,0 @@ >-/* >- * Copyright (C) 2011 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "PathWalker.h" >- >-#include <wtf/text/WTFString.h> >-#include <wtf/text/win/WCharStringExtras.h> >- >-namespace WebCore { >- >-PathWalker::PathWalker(const String& directory, const String& pattern) >-{ >- String path = directory + "\\" + pattern; >- m_handle = ::FindFirstFileW(stringToNullTerminatedWChar(path).data(), &m_data); >-} >- >-PathWalker::~PathWalker() >-{ >- if (!isValid()) >- return; >- ::FindClose(m_handle); >-} >- >-bool PathWalker::step() >-{ >- return ::FindNextFileW(m_handle, &m_data); >-} >- >-} // namespace WebCore >diff --git a/Source/WebCore/platform/win/PathWalker.h b/Source/WebCore/platform/win/PathWalker.h >deleted file mode 100644 >index fc59d6731811b8ca1587a4a12a7da1e1a1593d84..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/win/PathWalker.h >+++ /dev/null >@@ -1,48 +0,0 @@ >-/* >- * Copyright (C) 2011-2018 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include <Windows.h> >-#include <wtf/Forward.h> >-#include <wtf/Noncopyable.h> >- >-namespace WebCore { >- >-class PathWalker { >- WTF_MAKE_NONCOPYABLE(PathWalker); >-public: >- PathWalker(const WTF::String& directory, const WTF::String& pattern); >- ~PathWalker(); >- >- bool isValid() const { return m_handle != INVALID_HANDLE_VALUE; } >- const WIN32_FIND_DATAW& data() const { return m_data; } >- >- bool step(); >- >-private: >- HANDLE m_handle; >- WIN32_FIND_DATAW m_data; >-}; >- >-} // namespace WebCore >diff --git a/Source/WebCore/platform/win/SearchPopupMenuDB.cpp b/Source/WebCore/platform/win/SearchPopupMenuDB.cpp >index 9e6e4c52d7b9838a1f07bdd59f409d8165fe5666..e5730b30ccf3f03eefdff9a331c08ed0e22e58bf 100644 >--- a/Source/WebCore/platform/win/SearchPopupMenuDB.cpp >+++ b/Source/WebCore/platform/win/SearchPopupMenuDB.cpp >@@ -25,9 +25,9 @@ > #include "config.h" > #include "SearchPopupMenuDB.h" > >-#include "FileSystem.h" > #include "SQLiteFileSystem.h" > #include "SQLiteTransaction.h" >+#include <wtf/FileSystem.h> > > namespace WebCore { > >diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp >index 76c9c5c78d56d3e8d97d421f4dfaa4ab1bd9ecc0..c4fa35670b9547676b7c4fb9a812b3d6e6ec99e9 100644 >--- a/Source/WebCore/rendering/RenderTheme.cpp >+++ b/Source/WebCore/rendering/RenderTheme.cpp >@@ -25,7 +25,6 @@ > #include "ControlStates.h" > #include "Document.h" > #include "FileList.h" >-#include "FileSystem.h" > #include "FloatConversion.h" > #include "FloatRoundedRect.h" > #include "FocusController.h" >@@ -45,6 +44,7 @@ > #include "SpinButtonElement.h" > #include "StringTruncator.h" > #include "TextControlInnerElements.h" >+#include <wtf/FileSystem.h> > #include <wtf/NeverDestroyed.h> > > #if ENABLE(METER_ELEMENT) >diff --git a/Source/WebCore/rendering/RenderThemeGtk.cpp b/Source/WebCore/rendering/RenderThemeGtk.cpp >index b696eac8fb105e2b70962069473973e13eb9fb66..b25966cb533276859ee819671ad25fdf77e03ea0 100644 >--- a/Source/WebCore/rendering/RenderThemeGtk.cpp >+++ b/Source/WebCore/rendering/RenderThemeGtk.cpp >@@ -27,7 +27,6 @@ > > #include "CSSValueKeywords.h" > #include "FileList.h" >-#include "FileSystem.h" > #include "FloatRoundedRect.h" > #include "FontDescription.h" > #include "GRefPtrGtk.h" >@@ -55,6 +54,7 @@ > #include <gdk/gdk.h> > #include <glib.h> > #include <gtk/gtk.h> >+#include <wtf/FileSystem.h> > #include <wtf/glib/GRefPtr.h> > #include <wtf/glib/GUniquePtr.h> > #include <wtf/text/CString.h> >diff --git a/Source/WebCore/rendering/RenderThemeWin.cpp b/Source/WebCore/rendering/RenderThemeWin.cpp >index eeb9985e62f5c9a348243e8dde9eccc0a9bdbfb5..219657e1f24aaba05825a2a62b0804c7fbb3f338 100644 >--- a/Source/WebCore/rendering/RenderThemeWin.cpp >+++ b/Source/WebCore/rendering/RenderThemeWin.cpp >@@ -24,7 +24,6 @@ > > #include "CSSValueKeywords.h" > #include "Element.h" >-#include "FileSystem.h" > #include "FontMetrics.h" > #include "Frame.h" > #include "FrameSelection.h" >@@ -38,6 +37,7 @@ > #include "SystemInfo.h" > #include "UserAgentStyleSheets.h" > #include "WebCoreBundleWin.h" >+#include <wtf/FileSystem.h> > #include <wtf/SoftLinking.h> > #include <wtf/text/StringBuilder.h> > #include <wtf/text/win/WCharStringExtras.h> >diff --git a/Source/WebCore/workers/service/server/RegistrationDatabase.cpp b/Source/WebCore/workers/service/server/RegistrationDatabase.cpp >index 60eeb8cc2c0f412ca2bced982ae927ffb1d6a468..1af43788fffbaaa912e1ad97bbd98b172de3f0e3 100644 >--- a/Source/WebCore/workers/service/server/RegistrationDatabase.cpp >+++ b/Source/WebCore/workers/service/server/RegistrationDatabase.cpp >@@ -28,7 +28,6 @@ > > #if ENABLE(SERVICE_WORKER) > >-#include "FileSystem.h" > #include "Logging.h" > #include "RegistrationStore.h" > #include "SQLiteDatabase.h" >@@ -39,6 +38,7 @@ > #include "SecurityOrigin.h" > #include <wtf/CompletionHandler.h> > #include <wtf/CrossThreadCopier.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/Scope.h> >diff --git a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp >index c210ecac8a4746e4140d40642e0c370a0e5a7ed0..105dd02886075070977cae87d2c4a4f40bbfefb7 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp >+++ b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp >@@ -33,9 +33,9 @@ > #include "ResourceLoadStatisticsMemoryStore.h" > #include "WebResourceLoadStatisticsStore.h" > #include <WebCore/FileMonitor.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/KeyedCoding.h> > #include <WebCore/SharedBuffer.h> >+#include <wtf/FileSystem.h> > #include <wtf/RunLoop.h> > #include <wtf/WorkQueue.h> > >diff --git a/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.h b/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.h >index 75d31a61a4f742f387f9b5ea2d4f60294361287c..eb794472595b56edd620be2576ed2181805d0d85 100644 >--- a/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.h >+++ b/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.h >@@ -33,7 +33,7 @@ > > #include "NetworkDataTask.h" > #include <WebCore/FileStreamClient.h> >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > > namespace WebCore { > class AsyncFileStream; >@@ -113,7 +113,7 @@ private: > unsigned m_sizeItemCount { 0 }; > unsigned m_readItemCount { 0 }; > bool m_fileOpened { false }; >- WebCore::FileSystem::PlatformFileHandle m_downloadFile { WebCore::FileSystem::invalidPlatformFileHandle }; >+ FileSystem::PlatformFileHandle m_downloadFile { FileSystem::invalidPlatformFileHandle }; > > Vector<RefPtr<WebCore::BlobDataFileReference>> m_fileReferences; > RefPtr<SandboxExtension> m_sandboxExtension; >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >index 59f6a0702d0288eb481b3954317be340bbca64be..7ef25323c31ae8f9be0a3b377e6fe9a8bfc54431 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >@@ -1619,7 +1619,7 @@ void NetworkProcess::setCacheModel(CacheModel cacheModel) > unsigned urlCacheMemoryCapacity = 0; > uint64_t urlCacheDiskCapacity = 0; > uint64_t diskFreeSize = 0; >- if (WebCore::FileSystem::getVolumeFreeSpace(m_diskCacheDirectory, diskFreeSize)) { >+ if (FileSystem::getVolumeFreeSpace(m_diskCacheDirectory, diskFreeSize)) { > // As a fudge factor, use 1000 instead of 1024, in case the reported byte > // count doesn't align exactly to a megabyte boundary. > diskFreeSize /= KB * 1000; >diff --git a/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp b/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp >index f17fd9f92be5d2a50545c0799e37d9ae0cf3efbd..1e3e11b198c352720a03f579d29947f9beefdb5f 100644 >--- a/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp >+++ b/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp >@@ -52,7 +52,7 @@ String Engine::cachesRootPath(const WebCore::ClientOrigin& origin) > return { }; > > Key key(origin.topOrigin.toString(), origin.clientOrigin.toString(), { }, { }, salt()); >- return WebCore::FileSystem::pathByAppendingComponent(rootPath(), key.hashAsString()); >+ return FileSystem::pathByAppendingComponent(rootPath(), key.hashAsString()); > } > > Engine::~Engine() >@@ -291,9 +291,9 @@ void Engine::initialize(CompletionCallback&& callback) > if (!shouldComputeSalt) > return; > >- String saltPath = WebCore::FileSystem::pathByAppendingComponent(m_rootPath, "salt"_s); >+ String saltPath = FileSystem::pathByAppendingComponent(m_rootPath, "salt"_s); > m_ioQueue->dispatch([this, weakThis = makeWeakPtr(this), saltPath = WTFMove(saltPath)] () mutable { >- WebCore::FileSystem::makeAllDirectories(m_rootPath); >+ FileSystem::makeAllDirectories(m_rootPath); > RunLoop::main().dispatch([this, weakThis = WTFMove(weakThis), salt = readOrMakeSalt(saltPath)]() mutable { > if (!weakThis) > return; >@@ -383,9 +383,9 @@ void Engine::writeFile(const String& filename, NetworkCache::Data&& data, WebCor > m_pendingWriteCallbacks.add(++m_pendingCallbacksCounter, WTFMove(callback)); > m_ioQueue->dispatch([this, weakThis = makeWeakPtr(this), identifier = m_pendingCallbacksCounter, data = WTFMove(data), filename = filename.isolatedCopy()]() mutable { > >- String directoryPath = WebCore::FileSystem::directoryName(filename); >- if (!WebCore::FileSystem::fileExists(directoryPath)) >- WebCore::FileSystem::makeAllDirectories(directoryPath); >+ String directoryPath = FileSystem::directoryName(filename); >+ if (!FileSystem::fileExists(directoryPath)) >+ FileSystem::makeAllDirectories(directoryPath); > > auto channel = IOChannel::open(filename, IOChannel::Type::Create); > channel->write(0, data, nullptr, [this, weakThis = WTFMove(weakThis), identifier](int error) mutable { >@@ -445,7 +445,7 @@ void Engine::removeFile(const String& filename) > return; > > m_ioQueue->dispatch([filename = filename.isolatedCopy()]() mutable { >- WebCore::FileSystem::deleteFile(filename); >+ FileSystem::deleteFile(filename); > }); > } > >@@ -487,8 +487,8 @@ void Engine::fetchEntries(bool shouldComputeSize, WTF::CompletionHandler<void(Ve > } > > auto taskCounter = ReadOriginsTaskCounter::create(WTFMove(completionHandler)); >- for (auto& folderPath : WebCore::FileSystem::listDirectory(m_rootPath, "*")) { >- if (!WebCore::FileSystem::fileIsDirectory(folderPath, WebCore::FileSystem::ShouldFollowSymbolicLinks::No)) >+ for (auto& folderPath : FileSystem::listDirectory(m_rootPath, "*")) { >+ if (!FileSystem::fileIsDirectory(folderPath, FileSystem::ShouldFollowSymbolicLinks::No)) > continue; > Caches::retrieveOriginFromDirectory(folderPath, *m_ioQueue, [protectedThis = makeRef(*this), shouldComputeSize, taskCounter = taskCounter.copyRef()] (auto&& origin) mutable { > ASSERT(RunLoop::isMain()); >@@ -531,8 +531,8 @@ void Engine::clearAllCachesFromDisk(CompletionHandler<void()>&& completionHandle > ASSERT(RunLoop::isMain()); > > m_ioQueue->dispatch([path = m_rootPath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable { >- for (auto& filename : WebCore::FileSystem::listDirectory(path, "*")) { >- if (WebCore::FileSystem::fileIsDirectory(filename, WebCore::FileSystem::ShouldFollowSymbolicLinks::No)) >+ for (auto& filename : FileSystem::listDirectory(path, "*")) { >+ if (FileSystem::fileIsDirectory(filename, FileSystem::ShouldFollowSymbolicLinks::No)) > deleteDirectoryRecursively(filename); > } > RunLoop::main().dispatch(WTFMove(completionHandler)); >@@ -562,8 +562,8 @@ void Engine::clearCachesForOriginFromDisk(const WebCore::SecurityOriginData& ori > > auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); > >- for (auto& folderPath : WebCore::FileSystem::listDirectory(m_rootPath, "*")) { >- if (!WebCore::FileSystem::fileIsDirectory(folderPath, WebCore::FileSystem::ShouldFollowSymbolicLinks::No)) >+ for (auto& folderPath : FileSystem::listDirectory(m_rootPath, "*")) { >+ if (!FileSystem::fileIsDirectory(folderPath, FileSystem::ShouldFollowSymbolicLinks::No)) > continue; > Caches::retrieveOriginFromDirectory(folderPath, *m_ioQueue, [this, protectedThis = makeRef(*this), origin, callbackAggregator = callbackAggregator.copyRef(), folderPath] (Optional<WebCore::ClientOrigin>&& folderOrigin) mutable { > if (!folderOrigin) >diff --git a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp >index 1913470cdd220ce3be975df9900ef350d071763c..1f608cf525f996b24ea4113600e8e29cb287c27c 100644 >--- a/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp >+++ b/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp >@@ -42,12 +42,12 @@ using namespace NetworkCache; > > static inline String cachesListFilename(const String& cachesRootPath) > { >- return WebCore::FileSystem::pathByAppendingComponent(cachesRootPath, "cacheslist"_s); >+ return FileSystem::pathByAppendingComponent(cachesRootPath, "cacheslist"_s); > } > > static inline String cachesOriginFilename(const String& cachesRootPath) > { >- return WebCore::FileSystem::pathByAppendingComponent(cachesRootPath, "origin"_s); >+ return FileSystem::pathByAppendingComponent(cachesRootPath, "origin"_s); > } > > Caches::~Caches() >@@ -58,7 +58,7 @@ Caches::~Caches() > void Caches::retrieveOriginFromDirectory(const String& folderPath, WorkQueue& queue, WTF::CompletionHandler<void(Optional<WebCore::ClientOrigin>&&)>&& completionHandler) > { > queue.dispatch([completionHandler = WTFMove(completionHandler), filename = cachesOriginFilename(folderPath)]() mutable { >- if (!WebCore::FileSystem::fileExists(filename)) { >+ if (!FileSystem::fileExists(filename)) { > RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)]() mutable { > completionHandler(WTF::nullopt); > }); >@@ -408,7 +408,7 @@ void Caches::readCachesFromDisk(WTF::Function<void(Expected<Vector<Cache>, Error > } > > auto filename = cachesListFilename(m_rootPath); >- if (!WebCore::FileSystem::fileExists(filename)) { >+ if (!FileSystem::fileExists(filename)) { > callback(Vector<Cache> { }); > return; > } >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp >index fd27cf06fe431fd384ca2f3b7e491f6fac1de086..f6511d899c428122c4226d8c2f910823054baed7 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp >@@ -32,13 +32,13 @@ > #include "NetworkCacheStorage.h" > #include "NetworkProcess.h" > #include <WebCore/CacheValidation.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/HTTPHeaderNames.h> > #include <WebCore/LowPowerModeNotifier.h> > #include <WebCore/NetworkStorageSession.h> > #include <WebCore/ResourceRequest.h> > #include <WebCore/ResourceResponse.h> > #include <WebCore/SharedBuffer.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/RunLoop.h> >@@ -51,7 +51,7 @@ > namespace WebKit { > namespace NetworkCache { > >-using namespace WebCore::FileSystem; >+using namespace WTF::FileSystem; > > static const AtomicString& resourceType() > { >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp >index f73c50da194793365d6f51e06141b523727e71ee..9538da641b4274002b279adaa87c1542d36a027f 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp >@@ -28,8 +28,8 @@ > > #include "Logging.h" > #include "NetworkCacheFileSystem.h" >-#include <WebCore/FileSystem.h> > #include <fcntl.h> >+#include <wtf/FileSystem.h> > #include <wtf/RunLoop.h> > #include <wtf/SHA1.h> > >@@ -57,15 +57,15 @@ void BlobStorage::synchronize() > { > ASSERT(!RunLoop::isMain()); > >- WebCore::FileSystem::makeAllDirectories(blobDirectoryPath()); >+ FileSystem::makeAllDirectories(blobDirectoryPath()); > > m_approximateSize = 0; > auto blobDirectory = blobDirectoryPath(); > traverseDirectory(blobDirectory, [this, &blobDirectory](const String& name, DirectoryEntryType type) { > if (type != DirectoryEntryType::File) > return; >- auto path = WebCore::FileSystem::pathByAppendingComponent(blobDirectory, name); >- auto filePath = WebCore::FileSystem::fileSystemRepresentation(path); >+ auto path = FileSystem::pathByAppendingComponent(blobDirectory, name); >+ auto filePath = FileSystem::fileSystemRepresentation(path); > struct stat stat; > ::stat(filePath.data(), &stat); > // No clients left for this blob. >@@ -81,7 +81,7 @@ void BlobStorage::synchronize() > String BlobStorage::blobPathForHash(const SHA1::Digest& hash) const > { > auto hashAsString = SHA1::hexDigest(hash); >- return WebCore::FileSystem::pathByAppendingComponent(blobDirectoryPath(), String::fromUTF8(hashAsString)); >+ return FileSystem::pathByAppendingComponent(blobDirectoryPath(), String::fromUTF8(hashAsString)); > } > > BlobStorage::Blob BlobStorage::add(const String& path, const Data& data) >@@ -93,8 +93,8 @@ BlobStorage::Blob BlobStorage::add(const String& path, const Data& data) > if (data.isEmpty()) > return { data, hash }; > >- auto blobPath = WebCore::FileSystem::fileSystemRepresentation(blobPathForHash(hash)); >- auto linkPath = WebCore::FileSystem::fileSystemRepresentation(path); >+ auto blobPath = FileSystem::fileSystemRepresentation(blobPathForHash(hash)); >+ auto linkPath = FileSystem::fileSystemRepresentation(path); > unlink(linkPath.data()); > > bool blobExists = access(blobPath.data(), F_OK) != -1; >@@ -127,7 +127,7 @@ BlobStorage::Blob BlobStorage::get(const String& path) > { > ASSERT(!RunLoop::isMain()); > >- auto linkPath = WebCore::FileSystem::fileSystemRepresentation(path); >+ auto linkPath = FileSystem::fileSystemRepresentation(path); > auto data = mapFile(linkPath.data()); > > return { data, computeSHA1(data, m_salt) }; >@@ -137,7 +137,7 @@ void BlobStorage::remove(const String& path) > { > ASSERT(!RunLoop::isMain()); > >- auto linkPath = WebCore::FileSystem::fileSystemRepresentation(path); >+ auto linkPath = FileSystem::fileSystemRepresentation(path); > unlink(linkPath.data()); > } > >@@ -145,7 +145,7 @@ unsigned BlobStorage::shareCount(const String& path) > { > ASSERT(!RunLoop::isMain()); > >- auto linkPath = WebCore::FileSystem::fileSystemRepresentation(path); >+ auto linkPath = FileSystem::fileSystemRepresentation(path); > struct stat stat; > if (::stat(linkPath.data(), &stat) < 0) > return 0; >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp >index 9e318943d7c6138caa1c1dc30f3a2f35f33029f2..1a32aa9a0e53b46957aa8eb3bb23856f0a899f31 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp >@@ -26,9 +26,9 @@ > #include "config.h" > #include "NetworkCacheData.h" > >-#include <WebCore/FileSystem.h> > #include <fcntl.h> > #include <wtf/CryptographicallyRandomNumber.h> >+#include <wtf/FileSystem.h> > > #if !OS(WINDOWS) > #include <sys/mman.h> >@@ -156,7 +156,7 @@ static Salt makeSalt() > Optional<Salt> readOrMakeSalt(const String& path) > { > #if !OS(WINDOWS) >- auto cpath = WebCore::FileSystem::fileSystemRepresentation(path); >+ auto cpath = FileSystem::fileSystemRepresentation(path); > auto fd = open(cpath.data(), O_RDONLY, 0); > Salt salt; > auto bytesRead = read(fd, salt.data(), salt.size()); >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.cpp >index 25bef7f92e8eb366a94f4bcd37983b16a9de3508..b0b2e715e65dd3a913cf70d70365a450bbeb9960 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.cpp >@@ -27,8 +27,8 @@ > #include "NetworkCacheFileSystem.h" > > #include "Logging.h" >-#include <WebCore/FileSystem.h> > #include <wtf/Assertions.h> >+#include <wtf/FileSystem.h> > #include <wtf/Function.h> > #include <wtf/text/CString.h> > >@@ -70,7 +70,7 @@ static DirectoryEntryType directoryEntryType(uint8_t dtype) > void traverseDirectory(const String& path, const Function<void (const String&, DirectoryEntryType)>& function) > { > #if !OS(WINDOWS) >- DIR* dir = opendir(WebCore::FileSystem::fileSystemRepresentation(path).data()); >+ DIR* dir = opendir(FileSystem::fileSystemRepresentation(path).data()); > if (!dir) > return; > dirent* dp; >@@ -94,10 +94,10 @@ void traverseDirectory(const String& path, const Function<void (const String&, D > void deleteDirectoryRecursively(const String& path) > { > traverseDirectory(path, [&path](const String& name, DirectoryEntryType type) { >- String entryPath = WebCore::FileSystem::pathByAppendingComponent(path, name); >+ String entryPath = FileSystem::pathByAppendingComponent(path, name); > switch (type) { > case DirectoryEntryType::File: >- WebCore::FileSystem::deleteFile(entryPath); >+ FileSystem::deleteFile(entryPath); > break; > case DirectoryEntryType::Directory: > deleteDirectoryRecursively(entryPath); >@@ -105,19 +105,19 @@ void deleteDirectoryRecursively(const String& path) > // This doesn't follow symlinks. > } > }); >- WebCore::FileSystem::deleteEmptyDirectory(path); >+ FileSystem::deleteEmptyDirectory(path); > } > > FileTimes fileTimes(const String& path) > { > #if HAVE(STAT_BIRTHTIME) > struct stat fileInfo; >- if (stat(WebCore::FileSystem::fileSystemRepresentation(path).data(), &fileInfo)) >+ if (stat(FileSystem::fileSystemRepresentation(path).data(), &fileInfo)) > return { }; > return { WallTime::fromRawSeconds(fileInfo.st_birthtime), WallTime::fromRawSeconds(fileInfo.st_mtime) }; > #elif USE(SOUP) > // There's no st_birthtime in some operating systems like Linux, so we use xattrs to set/get the creation time. >- GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(WebCore::FileSystem::fileSystemRepresentation(path).data())); >+ GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(FileSystem::fileSystemRepresentation(path).data())); > GRefPtr<GFileInfo> fileInfo = adoptGRef(g_file_query_info(file.get(), "xattr::birthtime,time::modified", G_FILE_QUERY_INFO_NONE, nullptr, nullptr)); > if (!fileInfo) > return { }; >@@ -141,7 +141,7 @@ void updateFileModificationTimeIfNeeded(const String& path) > } > #if !OS(WINDOWS) > // This really updates both the access time and the modification time. >- utimes(WebCore::FileSystem::fileSystemRepresentation(path).data(), nullptr); >+ utimes(FileSystem::fileSystemRepresentation(path).data(), nullptr); > #endif > } > >@@ -156,7 +156,7 @@ bool isSafeToUseMemoryMapForPath(const String& path) > attrlist attrList = { }; > attrList.bitmapcount = ATTR_BIT_MAP_COUNT; > attrList.commonattr = ATTR_CMN_DATA_PROTECT_FLAGS; >- int32_t error = getattrlist(WebCore::FileSystem::fileSystemRepresentation(path).data(), &attrList, &attrBuffer, sizeof(attrBuffer), FSOPT_NOFOLLOW); >+ int32_t error = getattrlist(FileSystem::fileSystemRepresentation(path).data(), &attrList, &attrBuffer, sizeof(attrBuffer), FSOPT_NOFOLLOW); > if (error) { > RELEASE_LOG_ERROR(Network, "Unable to get cache directory protection class, disabling use of shared mapped memory"); > return false; >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.h b/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.h >index 7dcce6c4c36728e9315833a5329bd56d5c412b8a..1831a351c9b0ff505df9adc7f7c03af701d6c883 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.h >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.h >@@ -25,7 +25,7 @@ > > #pragma once > >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > > namespace WebKit { > namespace NetworkCache { >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm b/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm >index 369bcf973f2dcee0a3d4396345370b64621e9f08..c652164ca188a07da57bcde75f3a2252e182f081 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm >@@ -41,7 +41,7 @@ IOChannel::IOChannel(const String& filePath, Type type) > : m_path(filePath) > , m_type(type) > { >- auto path = WebCore::FileSystem::fileSystemRepresentation(filePath); >+ auto path = FileSystem::fileSystemRepresentation(filePath); > int oflag; > mode_t mode; > bool useLowIOPriority = false; >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp >index 5392c790569fd6657a21a2620cb051efbeef0459..b56f9655312cdad0c108dccc6ef172995aed1a5b 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp >@@ -41,7 +41,7 @@ IOChannel::IOChannel(const String& filePath, Type type) > : m_path(filePath) > , m_type(type) > { >- auto path = WebCore::FileSystem::fileSystemRepresentation(filePath); >+ auto path = FileSystem::fileSystemRepresentation(filePath); > GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(path.data())); > switch (m_type) { > case Type::Create: { >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp >index b4a1314eb4b15ee0332f74e921e2fc8719064c37..61bef1e11c3cf8375f73925b723b916fb31eb37e 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheStatistics.cpp >@@ -77,7 +77,7 @@ std::unique_ptr<Statistics> Statistics::open(Cache& cache, const String& cachePa > { > ASSERT(RunLoop::isMain()); > >- String databasePath = WebCore::FileSystem::pathByAppendingComponent(cachePath, StatisticsDatabaseName); >+ String databasePath = FileSystem::pathByAppendingComponent(cachePath, StatisticsDatabaseName); > return std::make_unique<Statistics>(cache, databasePath); > } > >@@ -98,7 +98,7 @@ void Statistics::initialize(const String& databasePath) > serialBackgroundIOQueue().dispatch([this, databasePath = databasePath.isolatedCopy(), networkCachePath = m_cache.recordsPath(), startTime] { > WebCore::SQLiteTransactionInProgressAutoCounter transactionCounter; > >- if (!WebCore::FileSystem::makeAllDirectories(WebCore::FileSystem::directoryName(databasePath))) >+ if (!FileSystem::makeAllDirectories(FileSystem::directoryName(databasePath))) > return; > > LOG(NetworkCache, "(NetworkProcess) Opening network cache statistics database at %s...", databasePath.utf8().data()); >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp >index 4ea7430fa2044e9014a89904d5bbc1eb65b79cc6..c26aa1b96c713a80037fd1c57865db972b64aeed 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp >@@ -145,29 +145,29 @@ public: > static String makeVersionedDirectoryPath(const String& baseDirectoryPath) > { > String versionSubdirectory = versionDirectoryPrefix + String::number(Storage::version); >- return WebCore::FileSystem::pathByAppendingComponent(baseDirectoryPath, versionSubdirectory); >+ return FileSystem::pathByAppendingComponent(baseDirectoryPath, versionSubdirectory); > } > > static String makeRecordsDirectoryPath(const String& baseDirectoryPath) > { >- return WebCore::FileSystem::pathByAppendingComponent(makeVersionedDirectoryPath(baseDirectoryPath), recordsDirectoryName); >+ return FileSystem::pathByAppendingComponent(makeVersionedDirectoryPath(baseDirectoryPath), recordsDirectoryName); > } > > static String makeBlobDirectoryPath(const String& baseDirectoryPath) > { >- return WebCore::FileSystem::pathByAppendingComponent(makeVersionedDirectoryPath(baseDirectoryPath), blobsDirectoryName); >+ return FileSystem::pathByAppendingComponent(makeVersionedDirectoryPath(baseDirectoryPath), blobsDirectoryName); > } > > static String makeSaltFilePath(const String& baseDirectoryPath) > { >- return WebCore::FileSystem::pathByAppendingComponent(makeVersionedDirectoryPath(baseDirectoryPath), saltFileName); >+ return FileSystem::pathByAppendingComponent(makeVersionedDirectoryPath(baseDirectoryPath), saltFileName); > } > > RefPtr<Storage> Storage::open(const String& cachePath, Mode mode) > { > ASSERT(RunLoop::isMain()); > >- if (!WebCore::FileSystem::makeAllDirectories(makeVersionedDirectoryPath(cachePath))) >+ if (!FileSystem::makeAllDirectories(makeVersionedDirectoryPath(cachePath))) > return nullptr; > auto salt = readOrMakeSalt(makeSaltFilePath(cachePath)); > if (!salt) >@@ -180,13 +180,13 @@ void traverseRecordsFiles(const String& recordsPath, const String& expectedType, > traverseDirectory(recordsPath, [&](const String& partitionName, DirectoryEntryType entryType) { > if (entryType != DirectoryEntryType::Directory) > return; >- String partitionPath = WebCore::FileSystem::pathByAppendingComponent(recordsPath, partitionName); >+ String partitionPath = FileSystem::pathByAppendingComponent(recordsPath, partitionName); > traverseDirectory(partitionPath, [&](const String& actualType, DirectoryEntryType entryType) { > if (entryType != DirectoryEntryType::Directory) > return; > if (!expectedType.isEmpty() && expectedType != actualType) > return; >- String recordDirectoryPath = WebCore::FileSystem::pathByAppendingComponent(partitionPath, actualType); >+ String recordDirectoryPath = FileSystem::pathByAppendingComponent(partitionPath, actualType); > traverseDirectory(recordDirectoryPath, [&function, &recordDirectoryPath, &actualType](const String& fileName, DirectoryEntryType entryType) { > if (entryType != DirectoryEntryType::File || fileName.length() < Key::hashStringLength()) > return; >@@ -206,18 +206,18 @@ static void deleteEmptyRecordsDirectories(const String& recordsPath) > return; > > // Delete [type] sub-folders. >- String partitionPath = WebCore::FileSystem::pathByAppendingComponent(recordsPath, partitionName); >+ String partitionPath = FileSystem::pathByAppendingComponent(recordsPath, partitionName); > traverseDirectory(partitionPath, [&partitionPath](const String& subdirName, DirectoryEntryType entryType) { > if (entryType != DirectoryEntryType::Directory) > return; > > // Let system figure out if it is really empty. >- WebCore::FileSystem::deleteEmptyDirectory(WebCore::FileSystem::pathByAppendingComponent(partitionPath, subdirName)); >+ FileSystem::deleteEmptyDirectory(FileSystem::pathByAppendingComponent(partitionPath, subdirName)); > }); > > // Delete [Partition] folders. > // Let system figure out if it is really empty. >- WebCore::FileSystem::deleteEmptyDirectory(WebCore::FileSystem::pathByAppendingComponent(recordsPath, partitionName)); >+ FileSystem::deleteEmptyDirectory(FileSystem::pathByAppendingComponent(recordsPath, partitionName)); > }); > } > >@@ -300,11 +300,11 @@ void Storage::synchronize() > > String anyType; > traverseRecordsFiles(recordsPath(), anyType, [&](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) { >- auto filePath = WebCore::FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName); >+ auto filePath = FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName); > > Key::HashType hash; > if (!Key::stringToHash(hashString, hash)) { >- WebCore::FileSystem::deleteFile(filePath); >+ FileSystem::deleteFile(filePath); > return; > } > >@@ -318,7 +318,7 @@ void Storage::synchronize() > > if (shouldComputeExactRecordsSize) { > long long fileSize = 0; >- WebCore::FileSystem::getFileSize(filePath, fileSize); >+ FileSystem::getFileSize(filePath, fileSize); > recordsSize += fileSize; > } > >@@ -381,12 +381,12 @@ bool Storage::mayContainBlob(const Key& key) const > String Storage::recordDirectoryPathForKey(const Key& key) const > { > ASSERT(!key.type().isEmpty()); >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::pathByAppendingComponent(recordsPath(), key.partitionHashAsString()), key.type()); >+ return FileSystem::pathByAppendingComponent(FileSystem::pathByAppendingComponent(recordsPath(), key.partitionHashAsString()), key.type()); > } > > String Storage::recordPathForKey(const Key& key) const > { >- return WebCore::FileSystem::pathByAppendingComponent(recordDirectoryPathForKey(key), key.hashAsString()); >+ return FileSystem::pathByAppendingComponent(recordDirectoryPathForKey(key), key.hashAsString()); > } > > static String blobPathForRecordPath(const String& recordPath) >@@ -629,7 +629,7 @@ void Storage::deleteFiles(const Key& key) > { > ASSERT(!RunLoop::isMain()); > >- WebCore::FileSystem::deleteFile(recordPathForKey(key)); >+ FileSystem::deleteFile(recordPathForKey(key)); > m_blobStorage.remove(blobPathForKey(key)); > } > >@@ -809,7 +809,7 @@ void Storage::dispatchWriteOperation(std::unique_ptr<WriteOperation> writeOperat > auto recordDirectorPath = recordDirectoryPathForKey(writeOperation.record.key); > auto recordPath = recordPathForKey(writeOperation.record.key); > >- WebCore::FileSystem::makeAllDirectories(recordDirectorPath); >+ FileSystem::makeAllDirectories(recordDirectorPath); > > ++writeOperation.activeCount; > >@@ -917,7 +917,7 @@ void Storage::traverse(const String& type, OptionSet<TraverseFlag> flags, Traver > if (isBlob) > return; > >- auto recordPath = WebCore::FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName); >+ auto recordPath = FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName); > > double worth = -1; > if (traverseOperation.flags & TraverseFlag::ComputeWorth) >@@ -1009,13 +1009,13 @@ void Storage::clear(const String& type, WallTime modifiedSinceTime, CompletionHa > ioQueue().dispatch([this, protectedThis = makeRef(*this), modifiedSinceTime, completionHandler = WTFMove(completionHandler), type = type.isolatedCopy()] () mutable { > auto recordsPath = this->recordsPath(); > traverseRecordsFiles(recordsPath, type, [modifiedSinceTime](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) { >- auto filePath = WebCore::FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName); >+ auto filePath = FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName); > if (modifiedSinceTime > -WallTime::infinity()) { > auto times = fileTimes(filePath); > if (times.modification < modifiedSinceTime) > return; > } >- WebCore::FileSystem::deleteFile(filePath); >+ FileSystem::deleteFile(filePath); > }); > > deleteEmptyRecordsDirectories(recordsPath); >@@ -1089,7 +1089,7 @@ void Storage::shrink() > if (isBlob) > return; > >- auto recordPath = WebCore::FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName); >+ auto recordPath = FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName); > auto blobPath = blobPathForRecordPath(recordPath); > > auto times = fileTimes(recordPath); >@@ -1101,7 +1101,7 @@ void Storage::shrink() > LOG(NetworkCacheStorage, "Deletion probability=%f bodyLinkCount=%d shouldDelete=%d", probability, bodyShareCount, shouldDelete); > > if (shouldDelete) { >- WebCore::FileSystem::deleteFile(recordPath); >+ FileSystem::deleteFile(recordPath); > m_blobStorage.remove(blobPath); > } > }); >@@ -1137,7 +1137,7 @@ void Storage::deleteOldVersions() > return; > #endif > >- auto oldVersionPath = WebCore::FileSystem::pathByAppendingComponent(cachePath, subdirName); >+ auto oldVersionPath = FileSystem::pathByAppendingComponent(cachePath, subdirName); > LOG(NetworkCacheStorage, "(NetworkProcess) deleting old cache version, path %s", oldVersionPath.utf8().data()); > > deleteDirectoryRecursively(oldVersionPath); >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >index a61f9385a6774bd0b75c53969ce132878b3b973f..f47bd819883266aa678c487f6b3538ec5dabbe47 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >@@ -36,11 +36,11 @@ > #import "NetworkSessionCocoa.h" > #import "WebCoreArgumentCoders.h" > #import <WebCore/AuthenticationChallenge.h> >-#import <WebCore/FileSystem.h> > #import <WebCore/NetworkStorageSession.h> > #import <WebCore/NotImplemented.h> > #import <WebCore/ResourceRequest.h> > #import <pal/spi/cf/CFNetworkSPI.h> >+#import <wtf/FileSystem.h> > #import <wtf/MainThread.h> > #import <wtf/ProcessPrivilege.h> > #import <wtf/text/Base64.h> >@@ -403,8 +403,8 @@ void NetworkDataTaskCocoa::setPendingDownloadLocation(const WTF::String& filenam > > m_task.get()._pathToDownloadTaskFile = m_pendingDownloadLocation; > >- if (allowOverwrite && WebCore::FileSystem::fileExists(m_pendingDownloadLocation)) >- WebCore::FileSystem::deleteFile(filename); >+ if (allowOverwrite && FileSystem::fileExists(m_pendingDownloadLocation)) >+ FileSystem::deleteFile(filename); > } > > bool NetworkDataTaskCocoa::tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge& challenge, ChallengeCompletionHandler& completionHandler) >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm >index f6ad49f8bac35d017b9653798d57aaa2f4395608..4a1d79210afa596e4b0fafce818ff4f682b38b4a 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm >@@ -779,7 +779,7 @@ - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)data > auto& downloadManager = _session->networkProcess().downloadManager(); > auto download = std::make_unique<WebKit::Download>(downloadManager, downloadID, downloadTask, _session->sessionID(), networkDataTask->suggestedFilename()); > networkDataTask->transferSandboxExtensionToDownload(*download); >- ASSERT(WebCore::FileSystem::fileExists(networkDataTask->pendingDownloadLocation())); >+ ASSERT(FileSystem::fileExists(networkDataTask->pendingDownloadLocation())); > download->didCreateDestination(networkDataTask->pendingDownloadLocation()); > downloadManager.dataTaskBecameDownloadTask(downloadID, WTFMove(download)); > >diff --git a/Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm b/Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm >index 37f3b7f72aa502b32ba811ec9ba08f5e255863b2..f5bf04ae465f62b74d2b18a8175901a16ea555d1 100644 >--- a/Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm >+++ b/Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm >@@ -38,12 +38,12 @@ > #import "StringUtilities.h" > #import "WKFoundation.h" > #import <WebCore/CertificateInfo.h> >-#import <WebCore/FileSystem.h> > #import <WebCore/LocalizedStrings.h> > #import <notify.h> > #import <pal/spi/cf/CFNetworkSPI.h> > #import <pal/spi/cocoa/LaunchServicesSPI.h> > #import <sysexits.h> >+#import <wtf/FileSystem.h> > #import <wtf/MemoryPressureHandler.h> > #import <wtf/text/WTFString.h> > >diff --git a/Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp b/Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp >index c7ce1d27a001bfedded26224e8737acb409cb9bc..aa7c50cbf1e398c9c3ba9c0019cff1e4dee778b2 100644 >--- a/Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp >+++ b/Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp >@@ -32,12 +32,12 @@ > #include "ResourceCachesToClear.h" > #include "WebCookieManager.h" > #include <WebCore/CertificateInfo.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/NetworkStorageSession.h> > #include <WebCore/NotImplemented.h> > #include <WebCore/ResourceHandle.h> > #include <WebCore/SoupNetworkSession.h> > #include <libsoup/soup.h> >+#include <wtf/FileSystem.h> > #include <wtf/RAMSize.h> > #include <wtf/glib/GRefPtr.h> > #include <wtf/glib/GUniquePtr.h> >@@ -109,7 +109,7 @@ void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreati > ASSERT(!parameters.diskCacheDirectory.isEmpty()); > m_diskCacheDirectory = parameters.diskCacheDirectory; > >- SoupNetworkSession::clearOldSoupCache(WebCore::FileSystem::directoryName(m_diskCacheDirectory)); >+ SoupNetworkSession::clearOldSoupCache(FileSystem::directoryName(m_diskCacheDirectory)); > > OptionSet<NetworkCache::Cache::Option> cacheOptions { NetworkCache::Cache::Option::RegisterNotify }; > if (parameters.shouldEnableNetworkCacheEfficacyLogging) >diff --git a/Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.cpp b/Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.cpp >index 2bd2ed59ae6a2e24b0748b03cebc3563c667183e..3ade4c943f09b51d3cc3bec2ca9633f73d13496e 100644 >--- a/Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.cpp >+++ b/Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.cpp >@@ -34,8 +34,8 @@ > #include "Logging.h" > #include "NetscapePlugin.h" > #include "PluginProcess.h" >-#include <WebCore/FileSystem.h> > #include <stdlib.h> >+#include <wtf/FileSystem.h> > > #if PLATFORM(GTK) > #include <gtk/gtk.h> >diff --git a/Source/WebKit/Shared/PersistencyUtils.cpp b/Source/WebKit/Shared/PersistencyUtils.cpp >index 5dba968bd7e0b38c3d22694d6d5d2e6b069d2a81..eca9641d205345c81896eb565df627f95e3c517a 100644 >--- a/Source/WebKit/Shared/PersistencyUtils.cpp >+++ b/Source/WebKit/Shared/PersistencyUtils.cpp >@@ -27,8 +27,8 @@ > #include "PersistencyUtils.h" > > #include "Logging.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/SharedBuffer.h> >+#include <wtf/FileSystem.h> > #include <wtf/RunLoop.h> > > namespace WebKit { >diff --git a/Source/WebKit/Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp b/Source/WebKit/Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp >index fb1d9dc926fd676793f454a74fa551aee570c8e5..2a65da9fbcb2f33a1ff5410be8898cef1379911f 100644 >--- a/Source/WebKit/Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp >+++ b/Source/WebKit/Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp >@@ -30,16 +30,15 @@ > > #include "NetscapeBrowserFuncs.h" > #include "PluginProcessProxy.h" >-#include <WebCore/FileSystem.h> > #include <errno.h> > #include <fcntl.h> > #include <sys/stat.h> > #include <sys/types.h> > #include <unistd.h> >+#include <wtf/FileSystem.h> > #include <wtf/text/StringBuilder.h> > > namespace WebKit { >-using namespace WebCore; > > class StdoutDevNullRedirector { > public: >diff --git a/Source/WebKit/Shared/Plugins/unix/PluginSearchPath.cpp b/Source/WebKit/Shared/Plugins/unix/PluginSearchPath.cpp >index e8af9604ce5595a444fe8ca5045d3a617ab2364a..2bd549a95dfa675ce47f56d78a59b4f7315a11ab 100644 >--- a/Source/WebKit/Shared/Plugins/unix/PluginSearchPath.cpp >+++ b/Source/WebKit/Shared/Plugins/unix/PluginSearchPath.cpp >@@ -26,7 +26,7 @@ > #include "config.h" > #include "PluginSearchPath.h" > >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > > namespace WebKit { > using namespace WebCore; >diff --git a/Source/WebKit/Shared/WebMemorySampler.h b/Source/WebKit/Shared/WebMemorySampler.h >index 80813fea050f20491bd1c8b50e90b1cbbbcaa344..721cdbf3892264bc9fd792b5083830ff519fc9bd 100644 >--- a/Source/WebKit/Shared/WebMemorySampler.h >+++ b/Source/WebKit/Shared/WebMemorySampler.h >@@ -52,8 +52,8 @@ > #if ENABLE(MEMORY_SAMPLER) > > #include "SandboxExtension.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/Timer.h> >+#include <wtf/FileSystem.h> > #include <wtf/Noncopyable.h> > #include <wtf/RefPtr.h> > #include <wtf/Vector.h> >@@ -87,7 +87,7 @@ private: > void initializeTimers(double); > void sampleTimerFired(); > void stopTimerFired(); >- void appendCurrentMemoryUsageToFile(WebCore::FileSystem::PlatformFileHandle&); >+ void appendCurrentMemoryUsageToFile(FileSystem::PlatformFileHandle&); > void sendMemoryPressureEvent(); > > SystemMallocStats sampleSystemMalloc() const; >@@ -95,7 +95,7 @@ private: > WebMemoryStatistics sampleWebKit() const; > String processName() const; > >- WebCore::FileSystem::PlatformFileHandle m_sampleLogFile { WebCore::FileSystem::invalidPlatformFileHandle }; >+ FileSystem::PlatformFileHandle m_sampleLogFile { FileSystem::invalidPlatformFileHandle }; > String m_sampleLogFilePath; > WebCore::Timer m_sampleTimer; > WebCore::Timer m_stopTimer; >diff --git a/Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp b/Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp >index a70b41a09a930bbdc3b541ce6a708ad89bbc2f4b..4ff35d31de1d57231a6f6e1015a855d40f8c8c35 100644 >--- a/Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp >+++ b/Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp >@@ -27,12 +27,11 @@ > #include "config.h" > #include "ProcessExecutablePath.h" > >-#include <WebCore/FileSystem.h> > #include <glib.h> >+#include <wtf/FileSystem.h> > #include <wtf/glib/GLibUtilities.h> > > namespace WebKit { >-using namespace WebCore; > > #if ENABLE(DEVELOPER_MODE) > static String getExecutablePath() >diff --git a/Source/WebKit/Shared/ios/ChildProcessIOS.mm b/Source/WebKit/Shared/ios/ChildProcessIOS.mm >index 81d54f3bf009efaf05d402d6f5cfea8d10f4b567..69d53cff314a95cbc4a807ab98c9eca82fe2be21 100644 >--- a/Source/WebKit/Shared/ios/ChildProcessIOS.mm >+++ b/Source/WebKit/Shared/ios/ChildProcessIOS.mm >@@ -31,7 +31,6 @@ > > #import "SandboxInitializationParameters.h" > #import "XPCServiceEntryPoint.h" >-#import <WebCore/FileSystem.h> > #import <WebCore/FloatingPointEnvironment.h> > #import <WebCore/SystemVersion.h> > #import <mach/mach.h> >@@ -39,6 +38,7 @@ > #import <pwd.h> > #import <stdlib.h> > #import <sysexits.h> >+#import <wtf/FileSystem.h> > > #if ENABLE(MANUAL_SANDBOXING) > #import <wtf/spi/darwin/SandboxSPI.h> >diff --git a/Source/WebKit/Shared/mac/ChildProcessMac.mm b/Source/WebKit/Shared/mac/ChildProcessMac.mm >index 3c394cc916c09920d0333f2c4a258e47f1e7c979..78536aae60bcf02c92660c32811a8d0f58eff6f1 100644 >--- a/Source/WebKit/Shared/mac/ChildProcessMac.mm >+++ b/Source/WebKit/Shared/mac/ChildProcessMac.mm >@@ -35,7 +35,6 @@ > #import "WKFoundation.h" > #import "XPCServiceEntryPoint.h" > #import <WebCore/FileHandle.h> >-#import <WebCore/FileSystem.h> > #import <WebCore/SystemVersion.h> > #import <mach-o/dyld.h> > #import <mach/mach.h> >@@ -47,6 +46,7 @@ > #import <sys/sysctl.h> > #import <sysexits.h> > #import <wtf/DataLog.h> >+#import <wtf/FileSystem.h> > #import <wtf/RandomNumber.h> > #import <wtf/Scope.h> > #import <wtf/SystemTracing.h> >diff --git a/Source/WebKit/Shared/mac/SandboxExtensionMac.mm b/Source/WebKit/Shared/mac/SandboxExtensionMac.mm >index 0cec985c785c773659772d24f1b6d576d71d75e1..afbc6b2a14e5bff0c16656b7c20877cbcddd4571 100644 >--- a/Source/WebKit/Shared/mac/SandboxExtensionMac.mm >+++ b/Source/WebKit/Shared/mac/SandboxExtensionMac.mm >@@ -31,13 +31,12 @@ > #import "DataReference.h" > #import "Decoder.h" > #import "Encoder.h" >-#import <WebCore/FileSystem.h> > #import <sys/stat.h> >+#import <wtf/FileSystem.h> > #import <wtf/spi/darwin/SandboxSPI.h> > #import <wtf/text/CString.h> > > namespace WebKit { >-using namespace WebCore; > > class SandboxExtensionImpl { > public: >diff --git a/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp b/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp >index 38f42cb91a538ede68e225941050f96af67b9698..7426bd2b4554f3efeccabfa68996e55abfeda129 100644 >--- a/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp >+++ b/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp >@@ -39,6 +39,7 @@ > #include <WebCore/QualifiedName.h> > #include <string> > #include <wtf/CompletionHandler.h> >+#include <wtf/FileSystem.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/RunLoop.h> > #include <wtf/WorkQueue.h> >@@ -48,7 +49,7 @@ > > namespace API { > using namespace WebKit::NetworkCache; >-using namespace WebCore::FileSystem; >+using namespace WTF::FileSystem; > > ContentRuleListStore& ContentRuleListStore::legacyDefaultStore() > { >diff --git a/Source/WebKit/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm b/Source/WebKit/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm >index 4a2ec387237ffdc8ca8947186ffed0d5ca4ea754..3884f43c1e20a1298ba8857eb1b09155a98b0077 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm >@@ -28,9 +28,8 @@ > > #include "SandboxExtension.h" > #include "SandboxUtilities.h" >- > #include <Foundation/Foundation.h> >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > > #if PLATFORM(IOS_FAMILY) > #import <WebCore/RuntimeApplicationChecks.h> >@@ -169,7 +168,7 @@ WTF::String WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory() > // Currently, the top level of that directory contains entities related to WebSQL databases. > // We should fix this, and move WebSQL into a subdirectory (https://bugs.webkit.org/show_bug.cgi?id=124807) > // In the meantime, an entity name prefixed with three underscores will not conflict with any WebSQL entities. >- return WebCore::FileSystem::pathByAppendingComponent(legacyDefaultWebSQLDatabaseDirectory(), "___IndexedDB"); >+ return FileSystem::pathByAppendingComponent(legacyDefaultWebSQLDatabaseDirectory(), "___IndexedDB"); > } > > WTF::String WebsiteDataStore::legacyDefaultLocalStorageDirectory() >diff --git a/Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp b/Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp >index e1c4529b3d21ee58bfefb5c18fefb51122c0160f..f5ab931cbed3b771bf3cec812cb742e49bb68532 100644 >--- a/Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp >+++ b/Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp >@@ -26,7 +26,7 @@ > #include "config.h" > #include "APIWebsiteDataStore.h" > >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > #include <wtf/glib/GUniquePtr.h> > > #if PLATFORM(GTK) >@@ -46,12 +46,12 @@ WTF::String WebsiteDataStore::defaultApplicationCacheDirectory() > // Why is only this directory namespaced to a particular application? > WTF::String WebsiteDataStore::defaultNetworkCacheDirectory() > { >- return cacheDirectoryFileSystemRepresentation(WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::stringFromFileSystemRepresentation(g_get_prgname()), "WebKitCache")); >+ return cacheDirectoryFileSystemRepresentation(FileSystem::pathByAppendingComponent(FileSystem::stringFromFileSystemRepresentation(g_get_prgname()), "WebKitCache")); > } > > WTF::String WebsiteDataStore::defaultCacheStorageDirectory() > { >- return cacheDirectoryFileSystemRepresentation(WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::stringFromFileSystemRepresentation(g_get_prgname()), "CacheStorage")); >+ return cacheDirectoryFileSystemRepresentation(FileSystem::pathByAppendingComponent(FileSystem::stringFromFileSystemRepresentation(g_get_prgname()), "CacheStorage")); > } > > WTF::String WebsiteDataStore::defaultIndexedDBDatabaseDirectory() >@@ -91,19 +91,19 @@ WTF::String WebsiteDataStore::defaultResourceLoadStatisticsDirectory() > > WTF::String WebsiteDataStore::cacheDirectoryFileSystemRepresentation(const WTF::String& directoryName) > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::stringFromFileSystemRepresentation(g_get_user_cache_dir()), directoryName); >+ return FileSystem::pathByAppendingComponent(FileSystem::stringFromFileSystemRepresentation(g_get_user_cache_dir()), directoryName); > } > > WTF::String WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation(const WTF::String& directoryName) > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::stringFromFileSystemRepresentation(g_get_user_data_dir()), directoryName); >+ return FileSystem::pathByAppendingComponent(FileSystem::stringFromFileSystemRepresentation(g_get_user_data_dir()), directoryName); > } > > WTF::String WebsiteDataStore::legacyDefaultApplicationCacheDirectory() > { > #if PLATFORM(WPE) > GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "appcache", nullptr)); >- return WebCore::FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get()); >+ return FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get()); > #endif > return defaultApplicationCacheDirectory(); > } >@@ -112,7 +112,7 @@ WTF::String WebsiteDataStore::legacyDefaultNetworkCacheDirectory() > { > #if PLATFORM(WPE) > GUniquePtr<char> diskCacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "cache", nullptr)); >- return WebCore::FileSystem::stringFromFileSystemRepresentation(diskCacheDirectory.get()); >+ return FileSystem::stringFromFileSystemRepresentation(diskCacheDirectory.get()); > #endif > return defaultNetworkCacheDirectory(); > } >@@ -121,7 +121,7 @@ WTF::String WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory() > { > #if PLATFORM(WPE) > GUniquePtr<gchar> databaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", nullptr)); >- return WebCore::FileSystem::stringFromFileSystemRepresentation(databaseDirectory.get()); >+ return FileSystem::stringFromFileSystemRepresentation(databaseDirectory.get()); > #endif > return defaultWebSQLDatabaseDirectory(); > } >@@ -130,7 +130,7 @@ WTF::String WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory() > { > #if PLATFORM(WPE) > GUniquePtr<gchar> indexedDBDatabaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", "indexeddb", nullptr)); >- return WebCore::FileSystem::stringFromFileSystemRepresentation(indexedDBDatabaseDirectory.get()); >+ return FileSystem::stringFromFileSystemRepresentation(indexedDBDatabaseDirectory.get()); > #endif > return defaultIndexedDBDatabaseDirectory(); > } >@@ -139,7 +139,7 @@ WTF::String WebsiteDataStore::legacyDefaultLocalStorageDirectory() > { > #if PLATFORM(WPE) > GUniquePtr<gchar> storageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "localstorage", nullptr)); >- return WebCore::FileSystem::stringFromFileSystemRepresentation(storageDirectory.get()); >+ return FileSystem::stringFromFileSystemRepresentation(storageDirectory.get()); > #endif > return defaultLocalStorageDirectory(); > } >@@ -148,7 +148,7 @@ WTF::String WebsiteDataStore::legacyDefaultMediaCacheDirectory() > { > #if PLATFORM(WPE) > GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "mediacache", nullptr)); >- return WebCore::FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get()); >+ return FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get()); > #endif > return defaultMediaCacheDirectory(); > } >@@ -157,7 +157,7 @@ WTF::String WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory() > { > #if PLATFORM(WPE) > GUniquePtr<gchar> mediaKeysStorageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "mediakeys", nullptr)); >- return WebCore::FileSystem::stringFromFileSystemRepresentation(mediaKeysStorageDirectory.get()); >+ return FileSystem::stringFromFileSystemRepresentation(mediaKeysStorageDirectory.get()); > #endif > return defaultMediaKeysStorageDirectory(); > } >@@ -166,7 +166,7 @@ String WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory() > { > #if PLATFORM(WPE) > GUniquePtr<gchar> deviceIdHashSaltsStorageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "deviceidhashsalts", nullptr)); >- return WebCore::FileSystem::stringFromFileSystemRepresentation(deviceIdHashSaltsStorageDirectory.get()); >+ return FileSystem::stringFromFileSystemRepresentation(deviceIdHashSaltsStorageDirectory.get()); > #endif > return defaultDeviceIdHashSaltsStorageDirectory(); > } >@@ -174,7 +174,7 @@ String WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory() > WTF::String WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory() > { > GUniquePtr<gchar> javaScriptCoreConfigDirectory(g_build_filename(g_get_user_data_dir(), BASE_DIRECTORY, "JavaScriptCoreDebug", nullptr)); >- return WebCore::FileSystem::stringFromFileSystemRepresentation(javaScriptCoreConfigDirectory.get()); >+ return FileSystem::stringFromFileSystemRepresentation(javaScriptCoreConfigDirectory.get()); > } > > Ref<WebKit::WebsiteDataStoreConfiguration> WebsiteDataStore::defaultDataStoreConfiguration() >diff --git a/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp b/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp >index 674a5db043c8a60f3620aa7ba018c1f985edf8a9..b0466e914090bc055966e6b9df319ea304db2356 100644 >--- a/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp >+++ b/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp >@@ -29,11 +29,11 @@ > > #include "Logging.h" > #include <WebCore/BitmapImage.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/Image.h> > #include <WebCore/SQLiteStatement.h> > #include <WebCore/SQLiteTransaction.h> > #include <WebCore/SharedBuffer.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/StdLibExtras.h> >diff --git a/Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabase.cpp b/Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabase.cpp >index 9be7253f85e91da11b95ed2809eb44b5a3715a5a..e0164868171a5d8bee8a3e186ac6825c491d9700 100644 >--- a/Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabase.cpp >+++ b/Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabase.cpp >@@ -23,12 +23,12 @@ > #include "IconDatabase.h" > #include "WebKitFaviconDatabasePrivate.h" > #include "WebPreferences.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/Image.h> > #include <WebCore/IntSize.h> > #include <WebCore/RefPtrCairo.h> > #include <WebCore/SharedBuffer.h> > #include <glib/gi18n-lib.h> >+#include <wtf/FileSystem.h> > #include <wtf/RunLoop.h> > #include <wtf/SetForScope.h> > #include <wtf/glib/GRefPtr.h> >@@ -273,7 +273,7 @@ void webkitFaviconDatabaseOpen(WebKitFaviconDatabase* database, const String& pa > priv->iconDatabase->setEnabled(true); > priv->iconDatabase->setPrivateBrowsingEnabled(WebPreferences::anyPagesAreUsingPrivateBrowsing()); > >- if (!priv->iconDatabase->open(WebCore::FileSystem::directoryName(path), WebCore::FileSystem::pathGetFileName(path))) { >+ if (!priv->iconDatabase->open(FileSystem::directoryName(path), FileSystem::pathGetFileName(path))) { > priv->iconDatabase = nullptr; > IconDatabase::allowDatabaseCleanup(); > } >diff --git a/Source/WebKit/UIProcess/API/glib/WebKitFileChooserRequest.cpp b/Source/WebKit/UIProcess/API/glib/WebKitFileChooserRequest.cpp >index 37e6cca0cebce914730e3c6d425c5fef77fb485f..09980aae0699ebce9d33e9c5a697a02de04703d8 100644 >--- a/Source/WebKit/UIProcess/API/glib/WebKitFileChooserRequest.cpp >+++ b/Source/WebKit/UIProcess/API/glib/WebKitFileChooserRequest.cpp >@@ -25,9 +25,9 @@ > #include "APIString.h" > #include "WebKitFileChooserRequestPrivate.h" > #include "WebOpenPanelResultListenerProxy.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/TextEncoding.h> > #include <glib/gi18n-lib.h> >+#include <wtf/FileSystem.h> > #include <wtf/URL.h> > #include <wtf/glib/GRefPtr.h> > #include <wtf/glib/GUniquePtr.h> >diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp >index 0f39e125f3da6c48396a40c9cdfe8f4c41d969ae..66d83a7188e6cda70ef2b49f263997ac4ef6950a 100644 >--- a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp >+++ b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp >@@ -333,20 +333,20 @@ static void webkitWebContextConstructed(GObject* object) > GUniquePtr<char> bundleFilename(g_build_filename(injectedBundleDirectory(), INJECTED_BUNDLE_FILENAME, nullptr)); > > API::ProcessPoolConfiguration configuration; >- configuration.setInjectedBundlePath(WebCore::FileSystem::stringFromFileSystemRepresentation(bundleFilename.get())); >+ configuration.setInjectedBundlePath(FileSystem::stringFromFileSystemRepresentation(bundleFilename.get())); > configuration.setMaximumProcessCount(1); > configuration.setDiskCacheSpeculativeValidationEnabled(true); > > WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(object); > WebKitWebContextPrivate* priv = webContext->priv; > if (priv->websiteDataManager && !webkit_website_data_manager_is_ephemeral(priv->websiteDataManager.get())) { >- configuration.setLocalStorageDirectory(WebCore::FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_local_storage_directory(priv->websiteDataManager.get()))); >- configuration.setDiskCacheDirectory(WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_disk_cache_directory(priv->websiteDataManager.get())), networkCacheSubdirectory)); >- configuration.setApplicationCacheDirectory(WebCore::FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_offline_application_cache_directory(priv->websiteDataManager.get()))); >- configuration.setIndexedDBDatabaseDirectory(WebCore::FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_indexeddb_directory(priv->websiteDataManager.get()))); >- configuration.setWebSQLDatabaseDirectory(WebCore::FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_websql_directory(priv->websiteDataManager.get()))); >+ configuration.setLocalStorageDirectory(FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_local_storage_directory(priv->websiteDataManager.get()))); >+ configuration.setDiskCacheDirectory(FileSystem::pathByAppendingComponent(FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_disk_cache_directory(priv->websiteDataManager.get())), networkCacheSubdirectory)); >+ configuration.setApplicationCacheDirectory(FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_offline_application_cache_directory(priv->websiteDataManager.get()))); >+ configuration.setIndexedDBDatabaseDirectory(FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_indexeddb_directory(priv->websiteDataManager.get()))); >+ configuration.setWebSQLDatabaseDirectory(FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_websql_directory(priv->websiteDataManager.get()))); > } else if (!priv->localStorageDirectory.isNull()) >- configuration.setLocalStorageDirectory(WebCore::FileSystem::stringFromFileSystemRepresentation(priv->localStorageDirectory.data())); >+ configuration.setLocalStorageDirectory(FileSystem::stringFromFileSystemRepresentation(priv->localStorageDirectory.data())); > > priv->processPool = WebProcessPool::create(configuration); > >@@ -924,7 +924,7 @@ void webkit_web_context_set_favicon_database_directory(WebKitWebContext* context > WebKitWebContextPrivate* priv = context->priv; > ensureFaviconDatabase(context); > >- String directoryPath = WebCore::FileSystem::stringFromFileSystemRepresentation(path); >+ String directoryPath = FileSystem::stringFromFileSystemRepresentation(path); > // Use default if nullptr is passed as parameter. > if (directoryPath.isEmpty()) { > #if PLATFORM(GTK) >@@ -933,7 +933,7 @@ void webkit_web_context_set_favicon_database_directory(WebKitWebContext* context > const char* portDirectory = "wpe"; > #endif > GUniquePtr<gchar> databaseDirectory(g_build_filename(g_get_user_cache_dir(), portDirectory, "icondatabase", nullptr)); >- directoryPath = WebCore::FileSystem::stringFromFileSystemRepresentation(databaseDirectory.get()); >+ directoryPath = FileSystem::stringFromFileSystemRepresentation(databaseDirectory.get()); > } > priv->faviconDatabaseDirectory = directoryPath.utf8(); > >@@ -942,7 +942,7 @@ void webkit_web_context_set_favicon_database_directory(WebKitWebContext* context > "WebpageIcons.db", nullptr)); > > // Setting the path will cause the icon database to be opened. >- webkitFaviconDatabaseOpen(priv->faviconDatabase.get(), WebCore::FileSystem::stringFromFileSystemRepresentation(faviconDatabasePath.get())); >+ webkitFaviconDatabaseOpen(priv->faviconDatabase.get(), FileSystem::stringFromFileSystemRepresentation(faviconDatabasePath.get())); > > if (webkit_web_context_is_ephemeral(context)) > webkitFaviconDatabaseSetPrivateBrowsingEnabled(priv->faviconDatabase.get(), true); >@@ -1026,7 +1026,7 @@ void webkit_web_context_set_additional_plugins_directory(WebKitWebContext* conte > g_return_if_fail(directory); > > #if ENABLE(NETSCAPE_PLUGIN_API) >- context->priv->processPool->setAdditionalPluginsDirectory(WebCore::FileSystem::stringFromFileSystemRepresentation(directory)); >+ context->priv->processPool->setAdditionalPluginsDirectory(FileSystem::stringFromFileSystemRepresentation(directory)); > #endif > } > >@@ -1418,7 +1418,7 @@ void webkit_web_context_set_disk_cache_directory(WebKitWebContext* context, cons > g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context)); > g_return_if_fail(directory); > >- context->priv->processPool->configuration().setDiskCacheDirectory(WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::stringFromFileSystemRepresentation(directory), networkCacheSubdirectory)); >+ context->priv->processPool->configuration().setDiskCacheDirectory(FileSystem::pathByAppendingComponent(FileSystem::stringFromFileSystemRepresentation(directory), networkCacheSubdirectory)); > } > #endif > >diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp >index 7e1d14b67b9538f475e0f8af450aabdef2e2155e..1cc065411e731fa672c434f3b3c0abe9a5693ebd 100644 >--- a/Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp >+++ b/Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp >@@ -26,8 +26,8 @@ > #include "WebKitWebsiteDataManagerPrivate.h" > #include "WebKitWebsiteDataPrivate.h" > #include "WebsiteDataFetchOption.h" >-#include <WebCore/FileSystem.h> > #include <glib/gi18n-lib.h> >+#include <wtf/FileSystem.h> > #include <wtf/glib/GUniquePtr.h> > #include <wtf/glib/WTFGType.h> > >@@ -363,13 +363,13 @@ API::WebsiteDataStore& webkitWebsiteDataManagerGetDataStore(WebKitWebsiteDataMan > if (!priv->websiteDataStore) { > auto configuration = WebsiteDataStoreConfiguration::create(); > configuration->setLocalStorageDirectory(!priv->localStorageDirectory ? >- API::WebsiteDataStore::defaultLocalStorageDirectory() : WebCore::FileSystem::stringFromFileSystemRepresentation(priv->localStorageDirectory.get())); >+ API::WebsiteDataStore::defaultLocalStorageDirectory() : FileSystem::stringFromFileSystemRepresentation(priv->localStorageDirectory.get())); > configuration->setNetworkCacheDirectory(!priv->diskCacheDirectory ? >- API::WebsiteDataStore::defaultNetworkCacheDirectory() : WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::stringFromFileSystemRepresentation(priv->diskCacheDirectory.get()), networkCacheSubdirectory)); >+ API::WebsiteDataStore::defaultNetworkCacheDirectory() : FileSystem::pathByAppendingComponent(FileSystem::stringFromFileSystemRepresentation(priv->diskCacheDirectory.get()), networkCacheSubdirectory)); > configuration->setApplicationCacheDirectory(!priv->applicationCacheDirectory ? >- API::WebsiteDataStore::defaultApplicationCacheDirectory() : WebCore::FileSystem::stringFromFileSystemRepresentation(priv->applicationCacheDirectory.get())); >+ API::WebsiteDataStore::defaultApplicationCacheDirectory() : FileSystem::stringFromFileSystemRepresentation(priv->applicationCacheDirectory.get())); > configuration->setWebSQLDatabaseDirectory(!priv->webSQLDirectory ? >- API::WebsiteDataStore::defaultWebSQLDatabaseDirectory() : WebCore::FileSystem::stringFromFileSystemRepresentation(priv->webSQLDirectory.get())); >+ API::WebsiteDataStore::defaultWebSQLDatabaseDirectory() : FileSystem::stringFromFileSystemRepresentation(priv->webSQLDirectory.get())); > configuration->setMediaKeysStorageDirectory(API::WebsiteDataStore::defaultMediaKeysStorageDirectory()); > priv->websiteDataStore = API::WebsiteDataStore::createLegacy(WTFMove(configuration)); > } >@@ -532,7 +532,7 @@ const gchar* webkit_website_data_manager_get_disk_cache_directory(WebKitWebsiteD > > if (!priv->diskCacheDirectory) { > // The default directory already has the subdirectory. >- priv->diskCacheDirectory.reset(g_strdup(WebCore::FileSystem::directoryName(API::WebsiteDataStore::defaultNetworkCacheDirectory()).utf8().data())); >+ priv->diskCacheDirectory.reset(g_strdup(FileSystem::directoryName(API::WebsiteDataStore::defaultNetworkCacheDirectory()).utf8().data())); > } > return priv->diskCacheDirectory.get(); > } >diff --git a/Source/WebKit/UIProcess/API/win/APIWebsiteDataStoreWin.cpp b/Source/WebKit/UIProcess/API/win/APIWebsiteDataStoreWin.cpp >index 19be288d482daafdd18e4cfdfedce203aac75bdd..3225b92170d7c98b4be845accfe8d8c1b367d7b3 100644 >--- a/Source/WebKit/UIProcess/API/win/APIWebsiteDataStoreWin.cpp >+++ b/Source/WebKit/UIProcess/API/win/APIWebsiteDataStoreWin.cpp >@@ -26,43 +26,43 @@ > #include "config.h" > #include "APIWebsiteDataStore.h" > >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > > namespace API { > > String WebsiteDataStore::defaultApplicationCacheDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "ApplicationCache"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "ApplicationCache"); > } > > String WebsiteDataStore::defaultCacheStorageDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "CacheStorage"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "CacheStorage"); > } > > String WebsiteDataStore::defaultNetworkCacheDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "NetworkCache"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "NetworkCache"); > } > > String WebsiteDataStore::defaultIndexedDBDatabaseDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "IndexedDB"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "IndexedDB"); > } > > String WebsiteDataStore::defaultServiceWorkerRegistrationDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "ServiceWorkers"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "ServiceWorkers"); > } > > String WebsiteDataStore::defaultLocalStorageDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "LocalStorage"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "LocalStorage"); > } > > String WebsiteDataStore::defaultMediaKeysStorageDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "MediaKeyStorage"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "MediaKeyStorage"); > } > > String WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory() >@@ -73,57 +73,57 @@ String WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory() > > String WebsiteDataStore::defaultWebSQLDatabaseDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "WebSQL"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "WebSQL"); > } > > String WebsiteDataStore::defaultResourceLoadStatisticsDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "ResourceLoadStatistics"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "ResourceLoadStatistics"); > } > > String WebsiteDataStore::cacheDirectoryFileSystemRepresentation(const String& directoryName) > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), directoryName); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), directoryName); > } > > String WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation(const String& directoryName) > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), directoryName); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), directoryName); > } > > String WebsiteDataStore::legacyDefaultApplicationCacheDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "ApplicationCache"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "ApplicationCache"); > } > > String WebsiteDataStore::legacyDefaultNetworkCacheDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "NetworkCache"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "NetworkCache"); > } > > String WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "WebSQL"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "WebSQL"); > } > > String WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "IndexedDB"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "IndexedDB"); > } > > String WebsiteDataStore::legacyDefaultLocalStorageDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "LocalStorage"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "LocalStorage"); > } > > String WebsiteDataStore::legacyDefaultMediaCacheDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "MediaCache"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "MediaCache"); > } > > String WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "MediaKeyStorage"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "MediaKeyStorage"); > } > > String WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory() >@@ -134,7 +134,7 @@ String WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory() > > String WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory() > { >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "JavaScriptCoreDebug"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "JavaScriptCoreDebug"); > } > > Ref<WebKit::WebsiteDataStoreConfiguration> WebsiteDataStore::defaultDataStoreConfiguration() >diff --git a/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp b/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >index 80547e6be138655f0798b676dc12dc9ab33acf1b..f8844afe6d22e4cd5ee208148b4f492f7cc6310d 100644 >--- a/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >+++ b/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >@@ -806,7 +806,7 @@ void WebAutomationSession::willClosePage(const WebPageProxy& page) > > static bool fileCanBeAcceptedForUpload(const String& filename, const HashSet<String>& allowedMIMETypes, const HashSet<String>& allowedFileExtensions) > { >- if (!WebCore::FileSystem::fileExists(filename)) >+ if (!FileSystem::fileExists(filename)) > return false; > > if (allowedMIMETypes.isEmpty() && allowedFileExtensions.isEmpty()) >diff --git a/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm b/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >index 3b49628fdf6dfc5aadd029d5a2cbcb6bfb78cfc1..c727bd23ef955251f79809d69c58232197af1eb6 100644 >--- a/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >+++ b/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >@@ -42,10 +42,10 @@ > #import "WebProcessProxy.h" > #import "_WKDownloadDelegate.h" > #import "_WKDownloadInternal.h" >-#import <WebCore/FileSystem.h> > #import <WebCore/ResourceError.h> > #import <WebCore/ResourceResponse.h> > #import <wtf/BlockPtr.h> >+#import <wtf/FileSystem.h> > > namespace WebKit { > >@@ -181,7 +181,7 @@ void DownloadClient::decideDestinationWithSuggestedFilename(WebProcessPool&, Dow > { > #if USE(SYSTEM_PREVIEW) > if (downloadProxy.isSystemPreviewDownload()) { >- NSString *temporaryDirectory = WebCore::FileSystem::createTemporaryDirectory(@"SystemPreviews"); >+ NSString *temporaryDirectory = FileSystem::createTemporaryDirectory(@"SystemPreviews"); > NSString *destination = [temporaryDirectory stringByAppendingPathComponent:filename]; > completionHandler(AllowOverwrite::Yes, destination); > return; >diff --git a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >index 56cf0fd0590c61543d3410f84f66d19c7ed851bf..2daf75571ccb1a9d705baa057ad624a5a698a439 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >@@ -43,7 +43,6 @@ > #import "WebProcessMessages.h" > #import "WindowServerConnection.h" > #import <WebCore/Color.h> >-#import <WebCore/FileSystem.h> > #import <WebCore/NetworkStorageSession.h> > #import <WebCore/NotImplemented.h> > #import <WebCore/PlatformPasteboard.h> >@@ -52,6 +51,7 @@ > #import <pal/spi/cf/CFNetworkSPI.h> > #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> > #import <sys/param.h> >+#import <wtf/FileSystem.h> > #import <wtf/ProcessPrivilege.h> > #import <wtf/cocoa/Entitlements.h> > #import <wtf/spi/darwin/dyldSPI.h> >diff --git a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >index 064e0dfd90ff6bb9ddc3ab442ec8cda69aa2d96d..16095a8bd15648849c6aeb131165e6374fe0e8be 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >@@ -84,7 +84,6 @@ > #import <WebCore/DragData.h> > #import <WebCore/DragItem.h> > #import <WebCore/Editor.h> >-#import <WebCore/FileSystem.h> > #import <WebCore/FontAttributeChanges.h> > #import <WebCore/FontAttributes.h> > #import <WebCore/KeypressCommand.h> >@@ -115,6 +114,7 @@ > #import <pal/spi/mac/NSViewSPI.h> > #import <pal/spi/mac/NSWindowSPI.h> > #import <sys/stat.h> >+#import <wtf/FileSystem.h> > #import <wtf/NeverDestroyed.h> > #import <wtf/ProcessPrivilege.h> > #import <wtf/SetForScope.h> >@@ -3969,7 +3969,7 @@ bool WebViewImpl::performDragOperation(id <NSDraggingInfo> draggingInfo) > return false; > } > >- NSString *dropDestinationPath = WebCore::FileSystem::createTemporaryDirectory(@"WebKitDropDestination"); >+ NSString *dropDestinationPath = FileSystem::createTemporaryDirectory(@"WebKitDropDestination"); > if (!dropDestinationPath) { > delete dragData; > return false; >@@ -4291,7 +4291,7 @@ NSArray *WebViewImpl::namesOfPromisedFilesDroppedAtDestination(NSURL *dropDestin > LOG_ERROR("Failed to create image file via -[NSFileWrapper writeToURL:options:originalContentsURL:error:]"); > > if (!m_promisedURL.isEmpty()) >- WebCore::FileSystem::setMetadataURL(String(path), m_promisedURL); >+ FileSystem::setMetadataURL(String(path), m_promisedURL); > > return [NSArray arrayWithObject:[path lastPathComponent]]; > } >diff --git a/Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp b/Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp >index e60ee3f4f94b032d399b7a377a7e8f9cca23751d..19a7a12cfa3f31bf1e2137c35cd57d0a507b9a9f 100644 >--- a/Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp >+++ b/Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp >@@ -28,9 +28,9 @@ > > #include "PersistencyUtils.h" > >-#include <WebCore/FileSystem.h> > #include <WebCore/SharedBuffer.h> > #include <wtf/CryptographicallyRandomNumber.h> >+#include <wtf/FileSystem.h> > #include <wtf/HexNumber.h> > #include <wtf/RunLoop.h> > #include <wtf/text/StringBuilder.h> >diff --git a/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp b/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp >index 75102ee3b00424a4809415f36b04ed3b53cad148..e09254b0187249c992fc2fcd72888e784b193391 100644 >--- a/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp >+++ b/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp >@@ -36,8 +36,8 @@ > #include "WebProcessMessages.h" > #include "WebProcessPool.h" > #include "WebProtectionSpace.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/MIMETypeRegistry.h> >+#include <wtf/FileSystem.h> > #include <wtf/text/CString.h> > #include <wtf/text/WTFString.h> > >diff --git a/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp b/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp >index e434e0333987a92749c00ddc5b53360904def1be..16723dfdda4fadbb92aa7ea0a8e6ae5884f2d068 100644 >--- a/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp >+++ b/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp >@@ -20,12 +20,12 @@ > > #if ENABLE(BUBBLEWRAP_SANDBOX) > >-#include <WebCore/FileSystem.h> > #include <WebCore/PlatformDisplay.h> > #include <fcntl.h> > #include <glib.h> > #include <seccomp.h> > #include <sys/ioctl.h> >+#include <wtf/FileSystem.h> > #include <wtf/glib/GLibUtilities.h> > #include <wtf/glib/GRefPtr.h> > #include <wtf/glib/GUniquePtr.h> >diff --git a/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp b/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp >index c5661873a05e7109b517ea75bdfabccd8f23fb86..0c39073fe1de7adaf5312683d816462f64d3ec6f 100644 >--- a/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp >+++ b/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp >@@ -31,10 +31,10 @@ > #include "Connection.h" > #include "FlatpakLauncher.h" > #include "ProcessExecutablePath.h" >-#include <WebCore/FileSystem.h> > #include <errno.h> > #include <fcntl.h> > #include <glib.h> >+#include <wtf/FileSystem.h> > #include <wtf/RunLoop.h> > #include <wtf/UniStdExtras.h> > #include <wtf/glib/GLibUtilities.h> >@@ -47,7 +47,6 @@ > #endif > > namespace WebKit { >-using namespace WebCore; > > static void childSetupFunction(gpointer userData) > { >diff --git a/Source/WebKit/UIProcess/Plugins/gtk/PluginInfoCache.cpp b/Source/WebKit/UIProcess/Plugins/gtk/PluginInfoCache.cpp >index 80647eb12ee52511a119e85fde2f59c4e2377885..a28a00a386cafecb3782a411037ca9a535dc2203 100644 >--- a/Source/WebKit/UIProcess/Plugins/gtk/PluginInfoCache.cpp >+++ b/Source/WebKit/UIProcess/Plugins/gtk/PluginInfoCache.cpp >@@ -29,8 +29,8 @@ > #if ENABLE(NETSCAPE_PLUGIN_API) > > #include "NetscapePluginModule.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/PlatformDisplay.h> >+#include <wtf/FileSystem.h> > #include <wtf/text/CString.h> > > namespace WebKit { >@@ -66,10 +66,10 @@ PluginInfoCache::PluginInfoCache() > m_saveToFileIdle.setPriority(G_PRIORITY_DEFAULT_IDLE); > > GUniquePtr<char> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "webkitgtk", nullptr)); >- if (WebCore::FileSystem::makeAllDirectories(cacheDirectory.get())) { >+ if (FileSystem::makeAllDirectories(cacheDirectory.get())) { > // Delete old cache file. > GUniquePtr<char> oldCachePath(g_build_filename(cacheDirectory.get(), "plugins", nullptr)); >- WebCore::FileSystem::deleteFile(WebCore::FileSystem::stringFromFileSystemRepresentation(oldCachePath.get())); >+ FileSystem::deleteFile(FileSystem::stringFromFileSystemRepresentation(oldCachePath.get())); > > m_cachePath.reset(g_build_filename(cacheDirectory.get(), cacheFilenameForCurrentDisplay(), nullptr)); > g_key_file_load_from_file(m_cacheFile.get(), m_cachePath.get(), G_KEY_FILE_NONE, nullptr); >@@ -112,7 +112,7 @@ bool PluginInfoCache::getPluginInfo(const String& pluginPath, PluginModuleInfo& > if (!g_key_file_has_group(m_cacheFile.get(), pluginGroup.data())) > return false; > >- auto lastModifiedTime = WebCore::FileSystem::getFileModificationTime(pluginPath); >+ auto lastModifiedTime = FileSystem::getFileModificationTime(pluginPath); > if (!lastModifiedTime) > return false; > time_t cachedLastModified = static_cast<time_t>(g_key_file_get_uint64(m_cacheFile.get(), pluginGroup.data(), "mtime", nullptr)); >@@ -120,7 +120,7 @@ bool PluginInfoCache::getPluginInfo(const String& pluginPath, PluginModuleInfo& > return false; > > plugin.path = pluginPath; >- plugin.info.file = WebCore::FileSystem::pathGetFileName(pluginPath); >+ plugin.info.file = FileSystem::pathGetFileName(pluginPath); > > GUniquePtr<char> stringValue(g_key_file_get_string(m_cacheFile.get(), pluginGroup.data(), "name", nullptr)); > plugin.info.name = String::fromUTF8(stringValue.get()); >@@ -140,7 +140,7 @@ bool PluginInfoCache::getPluginInfo(const String& pluginPath, PluginModuleInfo& > > void PluginInfoCache::updatePluginInfo(const String& pluginPath, const PluginModuleInfo& plugin) > { >- auto lastModifiedTime = WebCore::FileSystem::getFileModificationTime(pluginPath); >+ auto lastModifiedTime = FileSystem::getFileModificationTime(pluginPath); > if (!lastModifiedTime) > return; > >diff --git a/Source/WebKit/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit/UIProcess/Plugins/mac/PluginProcessProxyMac.mm >index 89fab5ecb666d2b44fcc2239ebe5ba5ee1ac63d8..3633c2ab0706011ebd7bc13f1a0bfda5ad6dd9bb 100644 >--- a/Source/WebKit/UIProcess/Plugins/mac/PluginProcessProxyMac.mm >+++ b/Source/WebKit/UIProcess/Plugins/mac/PluginProcessProxyMac.mm >@@ -33,11 +33,11 @@ > #import "PluginProcessMessages.h" > #import "SandboxUtilities.h" > #import <QuartzCore/CARemoteLayerServer.h> >-#import <WebCore/FileSystem.h> > #import <crt_externs.h> > #import <mach-o/dyld.h> > #import <pal/spi/cf/CFNetworkSPI.h> > #import <spawn.h> >+#import <wtf/FileSystem.h> > #import <wtf/ProcessPrivilege.h> > #import <wtf/URL.h> > #import <wtf/text/CString.h> >@@ -57,8 +57,6 @@ - (BOOL)_wantsUserAttention > @end > > namespace WebKit { >-using namespace WebCore; >- > > void PluginProcessProxy::platformGetLaunchOptionsWithAttributes(ProcessLauncher::LaunchOptions& launchOptions, const PluginProcessAttributes& pluginProcessAttributes) > { >diff --git a/Source/WebKit/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp b/Source/WebKit/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp >index 1dfd807c1239c3079ef92407450b89ec9119cf0c..aa09473681654a9ef64406b2c643903f7e01263d 100644 >--- a/Source/WebKit/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp >+++ b/Source/WebKit/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp >@@ -34,10 +34,10 @@ > #include "NetscapePluginModule.h" > #include "PluginSearchPath.h" > #include "ProcessExecutablePath.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/PlatformDisplay.h> > #include <limits.h> > #include <stdlib.h> >+#include <wtf/FileSystem.h> > > #if PLATFORM(GTK) > #include "PluginInfoCache.h" >diff --git a/Source/WebKit/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp b/Source/WebKit/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp >index f89612170d011160432eeeea3d9b88a3538b7122..c500c0fcea627886badddc3fc950c6c4ea38bc0b 100644 >--- a/Source/WebKit/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp >+++ b/Source/WebKit/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp >@@ -32,9 +32,9 @@ > > #include "PluginProcessCreationParameters.h" > #include "ProcessExecutablePath.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/PlatformDisplay.h> > #include <sys/wait.h> >+#include <wtf/FileSystem.h> > #include <wtf/text/CString.h> > #include <wtf/text/WTFString.h> > >diff --git a/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp b/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp >index 726883b3cf80f48f2dbfa563fc9bf7c55d57006f..5bcda63a86b0e1f8e9646194309926cba51f2d17 100644 >--- a/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp >@@ -64,7 +64,7 @@ ServiceWorkerProcessProxy::~ServiceWorkerProcessProxy() > bool ServiceWorkerProcessProxy::hasRegisteredServiceWorkers(const String& serviceWorkerDirectory) > { > String registrationFile = WebCore::serviceWorkerRegistrationDatabaseFilename(serviceWorkerDirectory); >- return WebCore::FileSystem::fileExists(registrationFile); >+ return FileSystem::fileExists(registrationFile); > } > > void ServiceWorkerProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions) >diff --git a/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp b/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp >index 0c25d657e9776a7474d2055fdf54872a00d8eddb..46fb6c77294f3c631d4fffdfc24a148f708a44ce 100644 >--- a/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp >+++ b/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp >@@ -27,12 +27,12 @@ > #include "LocalStorageDatabase.h" > > #include "LocalStorageDatabaseTracker.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/SQLiteStatement.h> > #include <WebCore/SQLiteTransaction.h> > #include <WebCore/SecurityOrigin.h> > #include <WebCore/StorageMap.h> > #include <WebCore/SuddenTermination.h> >+#include <wtf/FileSystem.h> > #include <wtf/RefPtr.h> > #include <wtf/WorkQueue.h> > #include <wtf/text/StringHash.h> >diff --git a/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp b/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp >index affd7e8acae2decb5c844e873b56f7d153d0ac96..c3781df676900c694be14bfe6ae3649bc18890c3 100644 >--- a/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp >+++ b/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp >@@ -27,10 +27,10 @@ > #include "LocalStorageDatabaseTracker.h" > > #include "Logging.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/SQLiteFileSystem.h> > #include <WebCore/SQLiteStatement.h> > #include <WebCore/TextEncoding.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/RunLoop.h> > #include <wtf/WorkQueue.h> >diff --git a/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm b/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm >index 427a9c85a3b9845ae4f754fb4c7a39263c8c17c9..61900500058d5a8e0748cb362c1f76b4454e2b23 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm >+++ b/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm >@@ -30,10 +30,10 @@ > #import "StorageManager.h" > #import "WebResourceLoadStatisticsStore.h" > #import "WebsiteDataStoreParameters.h" >-#import <WebCore/FileSystem.h> > #import <WebCore/RuntimeApplicationChecks.h> > #import <WebCore/SearchPopupMenuCocoa.h> > #import <pal/spi/cf/CFNetworkSPI.h> >+#import <wtf/FileSystem.h> > #import <wtf/NeverDestroyed.h> > #import <wtf/ProcessPrivilege.h> > >@@ -121,7 +121,7 @@ WebsiteDataStoreParameters WebsiteDataStore::parameters() > parameters.pendingCookies = copyToVector(m_pendingCookies); > > if (!cookieFile.isEmpty()) >- SandboxExtension::createHandleForReadWriteDirectory(WebCore::FileSystem::directoryName(cookieFile), parameters.cookieStoragePathExtensionHandle); >+ SandboxExtension::createHandleForReadWriteDirectory(FileSystem::directoryName(cookieFile), parameters.cookieStoragePathExtensionHandle); > > #if ENABLE(INDEXED_DATABASE) > parameters.indexedDatabaseDirectory = resolvedIndexedDatabaseDirectory(); >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >index b18fce7906f8e2bb8c5bd2464460608e4ccfeadd..2a590c4bd5e1987e55ae61486dac8acf3173662e 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >@@ -44,7 +44,6 @@ > #include "WebsiteDataStoreParameters.h" > #include <WebCore/ApplicationCacheStorage.h> > #include <WebCore/DatabaseTracker.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/HTMLMediaElement.h> > #include <WebCore/OriginLock.h> > #include <WebCore/SecurityOrigin.h> >@@ -52,6 +51,7 @@ > #include <wtf/CallbackAggregator.h> > #include <wtf/CompletionHandler.h> > #include <wtf/CrossThreadCopier.h> >+#include <wtf/FileSystem.h> > #include <wtf/ProcessPrivilege.h> > #include <wtf/RunLoop.h> > >@@ -193,8 +193,8 @@ void WebsiteDataStore::resolveDirectoriesIfNecessary() > > // Resolve directories for file paths. > if (!m_configuration->cookieStorageFile().isEmpty()) { >- m_resolvedConfiguration->setCookieStorageFile(resolveAndCreateReadWriteDirectoryForSandboxExtension(WebCore::FileSystem::directoryName(m_configuration->cookieStorageFile()))); >- m_resolvedConfiguration->setCookieStorageFile(WebCore::FileSystem::pathByAppendingComponent(m_resolvedConfiguration->cookieStorageFile(), WebCore::FileSystem::pathGetFileName(m_configuration->cookieStorageFile()))); >+ m_resolvedConfiguration->setCookieStorageFile(resolveAndCreateReadWriteDirectoryForSandboxExtension(FileSystem::directoryName(m_configuration->cookieStorageFile()))); >+ m_resolvedConfiguration->setCookieStorageFile(FileSystem::pathByAppendingComponent(m_resolvedConfiguration->cookieStorageFile(), FileSystem::pathGetFileName(m_configuration->cookieStorageFile()))); > } > } > >@@ -2265,7 +2265,7 @@ Vector<PluginModuleInfo> WebsiteDataStore::plugins() const > > static String computeMediaKeyFile(const String& mediaKeyDirectory) > { >- return WebCore::FileSystem::pathByAppendingComponent(mediaKeyDirectory, "SecureStop.plist"); >+ return FileSystem::pathByAppendingComponent(mediaKeyDirectory, "SecureStop.plist"); > } > > Vector<WebCore::SecurityOriginData> WebsiteDataStore::mediaKeyOrigins(const String& mediaKeysStorageDirectory) >@@ -2274,12 +2274,12 @@ Vector<WebCore::SecurityOriginData> WebsiteDataStore::mediaKeyOrigins(const Stri > > Vector<WebCore::SecurityOriginData> origins; > >- for (const auto& originPath : WebCore::FileSystem::listDirectory(mediaKeysStorageDirectory, "*")) { >+ for (const auto& originPath : FileSystem::listDirectory(mediaKeysStorageDirectory, "*")) { > auto mediaKeyFile = computeMediaKeyFile(originPath); >- if (!WebCore::FileSystem::fileExists(mediaKeyFile)) >+ if (!FileSystem::fileExists(mediaKeyFile)) > continue; > >- auto mediaKeyIdentifier = WebCore::FileSystem::pathGetFileName(originPath); >+ auto mediaKeyIdentifier = FileSystem::pathGetFileName(originPath); > > if (auto securityOrigin = WebCore::SecurityOriginData::fromDatabaseIdentifier(mediaKeyIdentifier)) > origins.append(*securityOrigin); >@@ -2292,18 +2292,18 @@ void WebsiteDataStore::removeMediaKeys(const String& mediaKeysStorageDirectory, > { > ASSERT(!mediaKeysStorageDirectory.isEmpty()); > >- for (const auto& mediaKeyDirectory : WebCore::FileSystem::listDirectory(mediaKeysStorageDirectory, "*")) { >+ for (const auto& mediaKeyDirectory : FileSystem::listDirectory(mediaKeysStorageDirectory, "*")) { > auto mediaKeyFile = computeMediaKeyFile(mediaKeyDirectory); > >- auto modificationTime = WebCore::FileSystem::getFileModificationTime(mediaKeyFile); >+ auto modificationTime = FileSystem::getFileModificationTime(mediaKeyFile); > if (!modificationTime) > continue; > > if (modificationTime.value() < modifiedSince) > continue; > >- WebCore::FileSystem::deleteFile(mediaKeyFile); >- WebCore::FileSystem::deleteEmptyDirectory(mediaKeyDirectory); >+ FileSystem::deleteFile(mediaKeyFile); >+ FileSystem::deleteEmptyDirectory(mediaKeyDirectory); > } > } > >@@ -2312,11 +2312,11 @@ void WebsiteDataStore::removeMediaKeys(const String& mediaKeysStorageDirectory, > ASSERT(!mediaKeysStorageDirectory.isEmpty()); > > for (const auto& origin : origins) { >- auto mediaKeyDirectory = WebCore::FileSystem::pathByAppendingComponent(mediaKeysStorageDirectory, origin.databaseIdentifier()); >+ auto mediaKeyDirectory = FileSystem::pathByAppendingComponent(mediaKeysStorageDirectory, origin.databaseIdentifier()); > auto mediaKeyFile = computeMediaKeyFile(mediaKeyDirectory); > >- WebCore::FileSystem::deleteFile(mediaKeyFile); >- WebCore::FileSystem::deleteEmptyDirectory(mediaKeyDirectory); >+ FileSystem::deleteFile(mediaKeyFile); >+ FileSystem::deleteEmptyDirectory(mediaKeyDirectory); > } > } > >diff --git a/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp b/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp >index 8f5fa03ff46532f6b582579e99b017b06540aea5..169ea20125b030637fafc0747ca8698585495b9b 100644 >--- a/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp >+++ b/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp >@@ -31,8 +31,8 @@ > #endif > #include "WebProcessPool.h" > #include "WebsiteDataStore.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/PlatformDisplay.h> >+#include <wtf/FileSystem.h> > > namespace WebKit { > using namespace WebCore; >diff --git a/Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp b/Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp >index ca187a64234112e8579bd86162d9b83fb429c83a..16b02a43576e56f1ae2263a0df4f0673234dbe05 100644 >--- a/Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp >+++ b/Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp >@@ -42,9 +42,9 @@ > #include "WebProcessPool.h" > #include "WebProcessProxy.h" > #include <WebCore/CertificateInfo.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/GtkUtilities.h> > #include <WebCore/NotImplemented.h> >+#include <wtf/FileSystem.h> > #include <wtf/text/CString.h> > #include <wtf/text/WTFString.h> > >diff --git a/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp b/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp >index 6240415f157279e4bfc0c56a2cda8b62259069f6..6b2357404e03ae3021ae880b63a8cec0ee86f0f6 100644 >--- a/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp >+++ b/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp >@@ -34,10 +34,10 @@ > #include "WebProcessCreationParameters.h" > #include "WebProcessMessages.h" > #include <JavaScriptCore/RemoteInspectorServer.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/GStreamerCommon.h> > #include <WebCore/NotImplemented.h> > #include <WebCore/SchemeRegistry.h> >+#include <wtf/FileSystem.h> > #include <wtf/glib/GUniquePtr.h> > #include <wtf/text/CString.h> > >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 66818c6eae8971c7a4c0e260599c357ff1a836c8..96466a2e3ace5c028e3308ed7d01e4322e35337b 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -5690,7 +5690,7 @@ - (void)_prepareToDragPromisedAttachment:(const WebCore::PromisedAttachmentInfo& > return; > } > >- NSString *temporaryBlobDirectory = WebCore::FileSystem::createTemporaryDirectory(@"blobs"); >+ NSString *temporaryBlobDirectory = FileSystem::createTemporaryDirectory(@"blobs"); > NSURL *destinationURL = [NSURL fileURLWithPath:[temporaryBlobDirectory stringByAppendingPathComponent:[NSUUID UUID].UUIDString] isDirectory:NO]; > > auto attachment = strongSelf->_page->attachmentForIdentifier(info.attachmentIdentifier); >diff --git a/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm b/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm >index 6801646d08f9d09fe3e73983845729be211d5aa6..877114fcf266e992aebdd90360406a1d89751df6 100644 >--- a/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm >+++ b/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm >@@ -620,7 +620,7 @@ - (void)_uploadItemForImageData:(NSData *)imageData imageName:(NSString *)imageN > NSString * const kTemporaryDirectoryName = @"WKWebFileUpload"; > > // Build temporary file path. >- NSString *temporaryDirectory = WebCore::FileSystem::createTemporaryDirectory(kTemporaryDirectoryName); >+ NSString *temporaryDirectory = FileSystem::createTemporaryDirectory(kTemporaryDirectoryName); > NSString *filePath = [temporaryDirectory stringByAppendingPathComponent:imageName]; > if (!filePath) { > LOG_ERROR("WKFileUploadPanel: Failed to create temporary directory to save image"); >diff --git a/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm >index 62be410f23b0e2c33030bb09c1e62f1c8b20e1c0..83004d70a817771618384d4d8f2815cf211a776a 100644 >--- a/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm >+++ b/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm >@@ -495,7 +495,7 @@ static NSString *pathToPDFOnDisk(const String& suggestedFilename) > > void WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID) > { >- // FIXME: Write originatingURLString to the file's originating URL metadata (perhaps WebCore::FileSystem::setMetadataURL()?). >+ // FIXME: Write originatingURLString to the file's originating URL metadata (perhaps FileSystem::setMetadataURL()?). > UNUSED_PARAM(originatingURLString); > > if (!suggestedFilename.endsWithIgnoringASCIICase(".pdf")) { >diff --git a/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp b/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp >index 1015ff0606cf4bb4cf562a0789288733656f9ed6..390a0c9019219433c5fa49d3e3844a1b835528cb 100644 >--- a/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp >+++ b/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp >@@ -28,8 +28,8 @@ > #include "WebProcessPool.h" > > #include "WebProcessCreationParameters.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/NotImplemented.h> >+#include <wtf/FileSystem.h> > > namespace WebKit { > >diff --git a/Source/WebKit/UIProcess/win/WebView.cpp b/Source/WebKit/UIProcess/win/WebView.cpp >index ef7919c720fe717b590919bb85b458185ba50fb1..0f9f9d4efd5286c626843ac3a04cd2e6bd9499e4 100644 >--- a/Source/WebKit/UIProcess/win/WebView.cpp >+++ b/Source/WebKit/UIProcess/win/WebView.cpp >@@ -44,7 +44,6 @@ > #include <WebCore/BitmapInfo.h> > #include <WebCore/Cursor.h> > #include <WebCore/Editor.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/FloatRect.h> > #include <WebCore/HWndDC.h> > #include <WebCore/IntRect.h> >@@ -55,6 +54,7 @@ > #include <WebCore/WindowsTouch.h> > #include <cairo-win32.h> > #include <cairo.h> >+#include <wtf/FileSystem.h> > #include <wtf/SoftLinking.h> > #include <wtf/text/StringBuffer.h> > #include <wtf/text/StringBuilder.h> >diff --git a/Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp b/Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp >index 6255c427b7a1ba5cfeed0cb37de5c02c0bcce5d1..f51017a8ca29ed07994d7d207c95714112a38bf5 100644 >--- a/Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp >+++ b/Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp >@@ -34,10 +34,10 @@ > #include "WebCookieManagerProxy.h" > #include "WebProcessCreationParameters.h" > #include "WebProcessMessages.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/NotImplemented.h> > #include <WebCore/SchemeRegistry.h> > #include <cstdlib> >+#include <wtf/FileSystem.h> > > #if ENABLE(REMOTE_INSPECTOR) > #include <JavaScriptCore/RemoteInspectorServer.h> >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp b/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp >index aac28280ca520bf83965b794c3e34feafc61ee75..4ccec62ef0e1131fa13f7fb060c80e07ee4251af 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp >@@ -23,8 +23,8 @@ > #include "APIString.h" > #include "InjectedBundle.h" > #include "WebKitWebExtensionPrivate.h" >-#include <WebCore/FileSystem.h> > #include <memory> >+#include <wtf/FileSystem.h> > #include <wtf/text/CString.h> > > namespace WebKit { >@@ -41,9 +41,9 @@ WebKitExtensionManager::WebKitExtensionManager() > > void WebKitExtensionManager::scanModules(const String& webExtensionsDirectory, Vector<String>& modules) > { >- Vector<String> modulePaths = WebCore::FileSystem::listDirectory(webExtensionsDirectory, String("*.so")); >+ Vector<String> modulePaths = FileSystem::listDirectory(webExtensionsDirectory, String("*.so")); > for (size_t i = 0; i < modulePaths.size(); ++i) { >- if (WebCore::FileSystem::fileExists(modulePaths[i])) >+ if (FileSystem::fileExists(modulePaths[i])) > modules.append(modulePaths[i]); > } > } >@@ -63,7 +63,7 @@ static void parseUserData(API::Object* userData, String& webExtensionsDirectory, > GVariant* data = nullptr; > g_variant_get(variant.get(), "(m&smv)", &directory, &data); > >- webExtensionsDirectory = WebCore::FileSystem::stringFromFileSystemRepresentation(directory); >+ webExtensionsDirectory = FileSystem::stringFromFileSystemRepresentation(directory); > initializationUserData = adoptGRef(data); > } > >diff --git a/Source/WebKit/WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp b/Source/WebKit/WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp >index 0a860652f00dad9328cf355d40513fe80f5ef658..ed9658ca1f46a4c77cc7260330d160aad288276c 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp >+++ b/Source/WebKit/WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp >@@ -29,11 +29,10 @@ > > #include "WKBundleAPICast.h" > #include "WKBundleInitialize.h" >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > #include <wtf/text/CString.h> > > namespace WebKit { >-using namespace WebCore; > > bool InjectedBundle::initialize(const WebProcessCreationParameters&, API::Object* initializationUserData) > { >diff --git a/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp b/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp >index 4bf48d0e94eef76066ca30ea9cf35704ab3deaeb..bd3982426c66e635b6c5605cbe5a3b05025d3a1a 100644 >--- a/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp >+++ b/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp >@@ -27,9 +27,9 @@ > #include "WebMediaKeyStorageManager.h" > > #include "WebProcessCreationParameters.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/SecurityOrigin.h> > #include <WebCore/SecurityOriginData.h> >+#include <wtf/FileSystem.h> > #include <wtf/URL.h> > > namespace WebKit { >diff --git a/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePluginStream.h b/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePluginStream.h >index bb6a5b08c7cce5dded899360f7ab8340f0395e74..3edcec6a72ccc3aa64d819fa9337f43e62e7d76d 100644 >--- a/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePluginStream.h >+++ b/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePluginStream.h >@@ -27,9 +27,9 @@ > > #if ENABLE(NETSCAPE_PLUGIN_API) > >-#include <WebCore/FileSystem.h> > #include <WebCore/npruntime_internal.h> > #include <memory> >+#include <wtf/FileSystem.h> > #include <wtf/Forward.h> > #include <wtf/RefCounted.h> > #include <wtf/RefPtr.h> >@@ -89,7 +89,7 @@ private: > int32_t m_offset; > > String m_filePath; >- WebCore::FileSystem::PlatformFileHandle m_fileHandle; >+ FileSystem::PlatformFileHandle m_fileHandle; > > // Whether NPP_NewStream has successfully been called. > bool m_isStarted; >diff --git a/Source/WebKit/WebProcess/Plugins/PluginProcessConnection.cpp b/Source/WebKit/WebProcess/Plugins/PluginProcessConnection.cpp >index 01c53f3d843dd1d24314f5cc0c12e90964efbbe4..26d6d500e69a0193b1df5f403f1f3f18c2c8ed5e 100644 >--- a/Source/WebKit/WebProcess/Plugins/PluginProcessConnection.cpp >+++ b/Source/WebKit/WebProcess/Plugins/PluginProcessConnection.cpp >@@ -36,10 +36,9 @@ > #include "WebProcess.h" > #include "WebProcessProxyMessages.h" > #include <JavaScriptCore/JSObject.h> >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > > namespace WebKit { >-using namespace WebCore; > > PluginProcessConnection::PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, uint64_t pluginProcessToken, IPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization) > : m_pluginProcessConnectionManager(pluginProcessConnectionManager) >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.cpp b/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.cpp >index 63c36a3db69a82ad3bea660f6b06dfe763c55617..1d8166a07e3fd97881cb7f44f4a6beff85bbfe5c 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.cpp >@@ -28,9 +28,9 @@ > > #include "SessionState.h" > #include <WebCore/BlobData.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/FormData.h> > #include <WebCore/HistoryItem.h> >+#include <wtf/FileSystem.h> > > namespace WebKit { > using namespace WebCore; >diff --git a/Source/WebKit/WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp b/Source/WebKit/WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp >index 89c3ba1aa8939cfa51f6fb221a73b38d780327a3..dbb2a91804be132648c9ad33e6f027bdd3f110f1 100644 >--- a/Source/WebKit/WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp >+++ b/Source/WebKit/WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp >@@ -28,8 +28,8 @@ > #include "WebInspectorUI.h" > #include "RemoteWebInspectorUI.h" > >-#include <WebCore/FileSystem.h> > #include <glib.h> >+#include <wtf/FileSystem.h> > #include <wtf/text/WTFString.h> > > namespace WebKit { >diff --git a/Source/WebKit/WebProcess/WebPage/win/WebInspectorUIWin.cpp b/Source/WebKit/WebProcess/WebPage/win/WebInspectorUIWin.cpp >index 6a7af3c5d649c504eedad49c91a1fb4435e4a18c..471114cafa14a7d1f33ffa2c1e8afbbbed2e03a2 100644 >--- a/Source/WebKit/WebProcess/WebPage/win/WebInspectorUIWin.cpp >+++ b/Source/WebKit/WebProcess/WebPage/win/WebInspectorUIWin.cpp >@@ -28,8 +28,8 @@ > > #include "RemoteWebInspectorUI.h" > >-#include <WebCore/FileSystem.h> > #include <WebCore/WebCoreBundleWin.h> >+#include <wtf/FileSystem.h> > #include <wtf/text/WTFString.h> > > namespace WebKit { >diff --git a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >index a44681c77271c04a796f07bbccac3becc481f75a..35d57d5ce67b658760793dcc7c409169f8580af5 100644 >--- a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >+++ b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >@@ -51,7 +51,6 @@ > #import <WebCore/AXObjectCache.h> > #import <WebCore/CPUMonitor.h> > #import <WebCore/DisplayRefreshMonitorManager.h> >-#import <WebCore/FileSystem.h> > #import <WebCore/FontCache.h> > #import <WebCore/FontCascade.h> > #import <WebCore/HistoryController.h> >@@ -72,6 +71,7 @@ > #import <pal/spi/mac/NSAccessibilitySPI.h> > #import <pal/spi/mac/NSApplicationSPI.h> > #import <stdio.h> >+#import <wtf/FileSystem.h> > #import <wtf/cocoa/NSURLExtras.h> > > #if PLATFORM(IOS_FAMILY) >diff --git a/Source/WebKitLegacy/Storage/StorageAreaSync.cpp b/Source/WebKitLegacy/Storage/StorageAreaSync.cpp >index 4039960b140fcb9c63a76d6d07713a3a3182c5a4..17d489494d7e090d3ff735eff26445efec6b9299 100644 >--- a/Source/WebKitLegacy/Storage/StorageAreaSync.cpp >+++ b/Source/WebKitLegacy/Storage/StorageAreaSync.cpp >@@ -28,11 +28,11 @@ > #include "StorageAreaImpl.h" > #include "StorageSyncManager.h" > #include "StorageTracker.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/SQLiteDatabaseTracker.h> > #include <WebCore/SQLiteStatement.h> > #include <WebCore/SQLiteTransaction.h> > #include <WebCore/SuddenTermination.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > > using namespace WebCore; >diff --git a/Source/WebKitLegacy/Storage/StorageSyncManager.cpp b/Source/WebKitLegacy/Storage/StorageSyncManager.cpp >index 3e8ff65ee60f274dc904eb58c1174ed5cc1a574c..369095cdad1d34711a0676d8736a90e193e2905e 100644 >--- a/Source/WebKitLegacy/Storage/StorageSyncManager.cpp >+++ b/Source/WebKitLegacy/Storage/StorageSyncManager.cpp >@@ -26,7 +26,7 @@ > #include "StorageSyncManager.h" > > #include "StorageThread.h" >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/text/CString.h> > >diff --git a/Source/WebKitLegacy/Storage/StorageTracker.cpp b/Source/WebKitLegacy/Storage/StorageTracker.cpp >index 710140b1b133a2eb59396d767486d2183ec90484..b934d1a3b1baa831addf3abe5e0770ab1cf77fa2 100644 >--- a/Source/WebKitLegacy/Storage/StorageTracker.cpp >+++ b/Source/WebKitLegacy/Storage/StorageTracker.cpp >@@ -28,13 +28,13 @@ > #include "StorageThread.h" > #include "StorageTrackerClient.h" > #include "WebStorageNamespaceProvider.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/PageGroup.h> > #include <WebCore/SQLiteDatabaseTracker.h> > #include <WebCore/SQLiteStatement.h> > #include <WebCore/SecurityOrigin.h> > #include <WebCore/SecurityOriginData.h> > #include <WebCore/TextEncoding.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/StdLibExtras.h> > #include <wtf/Vector.h> >diff --git a/Source/WebKitLegacy/mac/Misc/WebNSFileManagerExtras.mm b/Source/WebKitLegacy/mac/Misc/WebNSFileManagerExtras.mm >index 905174da756dd628bedefd50c2b23729e533502b..c5413e81c6a3ecb2ec9781f6b8bfd6c2b2a05df1 100644 >--- a/Source/WebKitLegacy/mac/Misc/WebNSFileManagerExtras.mm >+++ b/Source/WebKitLegacy/mac/Misc/WebNSFileManagerExtras.mm >@@ -30,10 +30,10 @@ > > #import "WebKitNSStringExtras.h" > #import "WebNSURLExtras.h" >-#import <WebCore/FileSystem.h> > #import <WebCore/LoaderNSURLExtras.h> > #import <sys/stat.h> > #import <wtf/Assertions.h> >+#import <wtf/FileSystem.h> > #import <wtf/ObjCRuntimeExtras.h> > > @implementation NSFileManager (WebNSFileManagerExtras) >@@ -44,7 +44,7 @@ - (void)_webkit_setMetadataURL:(NSString *)URLString referrer:(NSString *)referr > { > ASSERT(URLString); > ASSERT(path); >- WebCore::FileSystem::setMetadataURL(path, URLString, referrer); >+ FileSystem::setMetadataURL(path, URLString, referrer); > } > > #endif // !PLATFORM(IOS_FAMILY) >@@ -93,7 +93,7 @@ - (NSString *)_webkit_pathWithUniqueFilenameForPath:(NSString *)path > #if PLATFORM(IOS_FAMILY) > - (NSString *)_webkit_createTemporaryDirectoryWithTemplatePrefix:(NSString *)prefix > { >- return WebCore::FileSystem::createTemporaryDirectory(prefix); >+ return FileSystem::createTemporaryDirectory(prefix); > } > #endif > >diff --git a/Source/WebKitLegacy/mac/Storage/WebDatabaseProvider.mm b/Source/WebKitLegacy/mac/Storage/WebDatabaseProvider.mm >index 7495b175fff45dc5a54b014f8d5bf03e543943cc..adc4c39884c4cb2d2a3beb6b195bcda00089c171 100644 >--- a/Source/WebKitLegacy/mac/Storage/WebDatabaseProvider.mm >+++ b/Source/WebKitLegacy/mac/Storage/WebDatabaseProvider.mm >@@ -26,16 +26,16 @@ > #import "WebDatabaseProvider.h" > #import "WebDatabaseManagerPrivate.h" > >-#import <WebCore/FileSystem.h> >+#import <wtf/FileSystem.h> > > String WebDatabaseProvider::indexedDatabaseDirectoryPath() > { > NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; > NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey]; > if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]]) >- databasesDirectory = WebCore::FileSystem::pathByAppendingComponent("~/Library/WebKit/Databases/___IndexedDB"_s, [[NSBundle mainBundle] bundleIdentifier]); >+ databasesDirectory = FileSystem::pathByAppendingComponent("~/Library/WebKit/Databases/___IndexedDB"_s, [[NSBundle mainBundle] bundleIdentifier]); > else >- databasesDirectory = WebCore::FileSystem::pathByAppendingComponent(databasesDirectory, "___IndexedDB"_s); >+ databasesDirectory = FileSystem::pathByAppendingComponent(databasesDirectory, "___IndexedDB"_s); > > return [databasesDirectory stringByStandardizingPath]; > } >diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm >index ed0e0df79b03da66e8a29bced9ceaa93cd665e8c..01c6005eb2a2c0d064f06f8dc44c0353f478fcec 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm >@@ -148,7 +148,6 @@ > #import <WebCore/Editor.h> > #import <WebCore/Event.h> > #import <WebCore/EventHandler.h> >-#import <WebCore/FileSystem.h> > #import <WebCore/FocusController.h> > #import <WebCore/FontAttributes.h> > #import <WebCore/FontCache.h> >@@ -231,6 +230,7 @@ > #import <pal/spi/mac/NSSpellCheckerSPI.h> > #import <pal/spi/mac/NSWindowSPI.h> > #import <wtf/Assertions.h> >+#import <wtf/FileSystem.h> > #import <wtf/HashTraits.h> > #import <wtf/MainThread.h> > #import <wtf/ObjCRuntimeExtras.h> >@@ -6885,7 +6885,7 @@ - (BOOL)performDragOperation:(id <NSDraggingInfo>)draggingInfo > return false; > } > >- NSString *dropDestinationPath = WebCore::FileSystem::createTemporaryDirectory(@"WebKitDropDestination"); >+ NSString *dropDestinationPath = FileSystem::createTemporaryDirectory(@"WebKitDropDestination"); > if (!dropDestinationPath) { > delete dragData; > return false; >diff --git a/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp b/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp >index bc79d89bd446c56ea1ba9d57c75ae399aa8f04cf..641ac354c341967ea6ced690d5e6d45c6c2c2a1a 100644 >--- a/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp >+++ b/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp >@@ -33,7 +33,7 @@ > #include <wtf/text/CString.h> > > #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE) >-#include "FileSystem.h" >+#include <wtf/FileSystem.h> > #endif > > namespace WebCore { >diff --git a/Source/WebKitLegacy/win/Plugins/PluginPackage.h b/Source/WebKitLegacy/win/Plugins/PluginPackage.h >index b4883dea9976db50cde52860aa9b92b5bb1010df..8987a3d353c76c0aa446eab3908373339d517d32 100644 >--- a/Source/WebKitLegacy/win/Plugins/PluginPackage.h >+++ b/Source/WebKitLegacy/win/Plugins/PluginPackage.h >@@ -29,8 +29,8 @@ > > #include "PlatformModule.h" > #include "PluginQuirkSet.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/Timer.h> >+#include <wtf/FileSystem.h> > #include <wtf/HashMap.h> > #include <wtf/RefCounted.h> > #include <wtf/text/StringHash.h> >diff --git a/Source/WebKitLegacy/win/Plugins/PluginStream.h b/Source/WebKitLegacy/win/Plugins/PluginStream.h >index c1b9f87ac4e622fbb2e2e205d16459c0c194e7b6..431b3630362c9e521118dd03273a6cd9c28cc467 100644 >--- a/Source/WebKitLegacy/win/Plugins/PluginStream.h >+++ b/Source/WebKitLegacy/win/Plugins/PluginStream.h >@@ -27,12 +27,12 @@ > #pragma once > > #include "PluginQuirkSet.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/NetscapePlugInStreamLoader.h> > #include <WebCore/ResourceRequest.h> > #include <WebCore/ResourceResponse.h> > #include <WebCore/Timer.h> > #include <WebCore/npruntime_internal.h> >+#include <wtf/FileSystem.h> > #include <wtf/HashMap.h> > #include <wtf/RefCounted.h> > #include <wtf/URL.h> >diff --git a/Source/WebKitLegacy/win/WebApplicationCache.cpp b/Source/WebKitLegacy/win/WebApplicationCache.cpp >index b85dd15440a6ea5404a8a4852143e59178fec12d..90be1fce751b4f1b5d94b1bb674c36b3ec569fce 100644 >--- a/Source/WebKitLegacy/win/WebApplicationCache.cpp >+++ b/Source/WebKitLegacy/win/WebApplicationCache.cpp >@@ -30,13 +30,13 @@ > #include "MarshallingHelpers.h" > #include "WebPreferences.h" > #include "WebSecurityOrigin.h" >-#include <wtf/RetainPtr.h> > #include <WebCore/ApplicationCache.h> > #include <WebCore/ApplicationCacheStorage.h> > #include <WebCore/COMPtr.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/SecurityOrigin.h> > #include <comutil.h> >+#include <wtf/FileSystem.h> >+#include <wtf/RetainPtr.h> > > using namespace WebCore; > >diff --git a/Source/WebKitLegacy/win/WebDatabaseManager.cpp b/Source/WebKitLegacy/win/WebDatabaseManager.cpp >index 3f6c38b0628db4bacf9c41357b591a7dec9acd41..f9963f1c06896d7a2cb2d733a18efaaaf3ce4808 100644 >--- a/Source/WebKitLegacy/win/WebDatabaseManager.cpp >+++ b/Source/WebKitLegacy/win/WebDatabaseManager.cpp >@@ -39,9 +39,9 @@ > #include <WebCore/COMPtr.h> > #include <WebCore/DatabaseManager.h> > #include <WebCore/DatabaseTracker.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/SecurityOrigin.h> > #include <WebCore/SecurityOriginData.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > > #if ENABLE(INDEXED_DATABASE) >@@ -436,7 +436,7 @@ static WTF::String databasesDirectory() > return static_cast<CFStringRef>(directoryPref.get()); > #endif > >- return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "Databases"); >+ return FileSystem::pathByAppendingComponent(FileSystem::localUserSpecificStorageDirectory(), "Databases"); > } > > void WebKitInitializeWebDatabasesIfNecessary() >diff --git a/Source/WebKitLegacy/win/WebDownloadCurl.cpp b/Source/WebKitLegacy/win/WebDownloadCurl.cpp >index 20d4f40835f724138f1723a8dc2f94b8952eeed7..99b627f1aac03aedf50687fc7f336bb95d9cdd20 100644 >--- a/Source/WebKitLegacy/win/WebDownloadCurl.cpp >+++ b/Source/WebKitLegacy/win/WebDownloadCurl.cpp >@@ -35,22 +35,19 @@ > #include "WebURLAuthenticationChallenge.h" > #include "WebURLCredential.h" > #include "WebURLResponse.h" >- >-#include <wtf/text/CString.h> >- >-#include <io.h> >-#include <sys/stat.h> >-#include <sys/types.h> >- > #include <WebCore/BString.h> > #include <WebCore/CurlDownload.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/NotImplemented.h> > #include <WebCore/ResourceError.h> > #include <WebCore/ResourceHandle.h> > #include <WebCore/ResourceRequest.h> > #include <WebCore/ResourceResponse.h> > #include <WebCore/TextEncoding.h> >+#include <io.h> >+#include <sys/stat.h> >+#include <sys/types.h> >+#include <wtf/FileSystem.h> >+#include <wtf/text/CString.h> > > using namespace WebCore; > >diff --git a/Source/WebKitLegacy/win/WebPreferences.cpp b/Source/WebKitLegacy/win/WebPreferences.cpp >index a631b916967772bb80e7c63e0f5e57f6f325c69e..025c20bea238cd6a495a250f6c550ca7f5279d69 100644 >--- a/Source/WebKitLegacy/win/WebPreferences.cpp >+++ b/Source/WebKitLegacy/win/WebPreferences.cpp >@@ -38,13 +38,13 @@ > > #include <CoreFoundation/CoreFoundation.h> > #include <WebCore/COMPtr.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/FontCascade.h> > #include <WebCore/LocalizedStrings.h> > #include <WebCore/NetworkStorageSession.h> > #include <limits> > #include <shlobj.h> > #include <wchar.h> >+#include <wtf/FileSystem.h> > #include <wtf/HashMap.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/StdLibExtras.h> >diff --git a/Source/WebKitLegacy/win/WebView.cpp b/Source/WebKitLegacy/win/WebView.cpp >index e761744e0d1b85affd10b777cdd3791a4f71b31e..e331063a0bf0ebd82009150407626de9a140e52f 100644 >--- a/Source/WebKitLegacy/win/WebView.cpp >+++ b/Source/WebKitLegacy/win/WebView.cpp >@@ -96,7 +96,6 @@ > #include <WebCore/Editor.h> > #include <WebCore/EventHandler.h> > #include <WebCore/EventNames.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/FloatQuad.h> > #include <WebCore/FocusController.h> > #include <WebCore/Font.h> >@@ -171,6 +170,7 @@ > #include <WebCore/WindowsTouch.h> > #include <comdef.h> > #include <d2d1.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/ProcessPrivilege.h> > #include <wtf/RAMSize.h> >@@ -513,7 +513,7 @@ void WebView::setCacheModel(WebCacheModel cacheModel) > if (preference && (CFStringGetTypeID() == CFGetTypeID(preference.get()))) > cfurlCacheDirectory = adoptCF(static_cast<CFStringRef>(preference.leakRef())); > else >- cfurlCacheDirectory = WebCore::FileSystem::localUserSpecificStorageDirectory().createCFString(); >+ cfurlCacheDirectory = FileSystem::localUserSpecificStorageDirectory().createCFString(); > } > cacheDirectory = String(cfurlCacheDirectory.get()); > CFIndex cacheMemoryCapacity = 0; >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 3165bd57825e4a320869675ccb0c47cdc1761266..7e381607919bf5fdfe2468be69dbc60e36082d22 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,27 @@ >+2019-01-22 Ross Kirsling <ross.kirsling@sony.com> >+ >+ Move FileSystem to WTF >+ https://bugs.webkit.org/show_bug.cgi?id=193602 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * DumpRenderTree/win/DumpRenderTree.cpp: >+ * TestWebKitAPI/CMakeLists.txt: >+ * TestWebKitAPI/PlatformGTK.cmake: >+ * TestWebKitAPI/PlatformJSCOnly.cmake: >+ * TestWebKitAPI/PlatformPlayStation.cmake: >+ * TestWebKitAPI/PlatformWPE.cmake: >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/Tests/WTF/FileSystem.cpp: Renamed from Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp. >+ * TestWebKitAPI/Tests/WebCore/FileMonitor.cpp: >+ * TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp: >+ * TestWebKitAPI/Tests/WebCore/SharedBufferTest.cpp: >+ * TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm: >+ * TestWebKitAPI/Tests/WebCore/curl/Cookies.cpp: >+ * TestWebKitAPI/Tests/WebKitCocoa/Download.mm: >+ * TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm: >+ * TestWebKitAPI/win/PlatformUtilitiesWin.cpp: >+ > 2019-01-22 Aakash Jain <aakash_jain@apple.com> > > [ews-app] fetch loop should not stop on network issues >diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp >index a4b5c77070890a5cf142d2d9c8b3c3386483e6ed..a0b685c75f9daf0feb7eaae1bb32a2e952d226f4 100644 >--- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp >@@ -46,7 +46,6 @@ > > #include <CoreFoundation/CoreFoundation.h> > #include <JavaScriptCore/TestRunnerUtils.h> >-#include <WebCore/FileSystem.h> > #include <WebKitLegacy/WebKit.h> > #include <WebKitLegacy/WebKitCOMAPI.h> > #include <comutil.h> >@@ -60,6 +59,7 @@ > #include <shlwapi.h> > #include <tchar.h> > #include <windows.h> >+#include <wtf/FileSystem.h> > #include <wtf/HashSet.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/RetainPtr.h> >@@ -222,7 +222,7 @@ static String libraryPathForDumpRenderTree() > return String (path.data(), path.length()); > } > >- return WebCore::FileSystem::localUserSpecificStorageDirectory(); >+ return FileSystem::localUserSpecificStorageDirectory(); > } > #endif > >@@ -931,9 +931,9 @@ static void setDefaultsToConsistentValuesForTesting() > String libraryPath = libraryPathForDumpRenderTree(); > > // Set up these values before creating the WebView so that the various initializations will see these preferred values. >- CFPreferencesSetAppValue(WebDatabaseDirectoryDefaultsKey, WebCore::FileSystem::pathByAppendingComponent(libraryPath, "Databases").createCFString().get(), appId.get()); >- CFPreferencesSetAppValue(WebStorageDirectoryDefaultsKey, WebCore::FileSystem::pathByAppendingComponent(libraryPath, "LocalStorage").createCFString().get(), appId.get()); >- CFPreferencesSetAppValue(WebKitLocalCacheDefaultsKey, WebCore::FileSystem::pathByAppendingComponent(libraryPath, "LocalCache").createCFString().get(), appId.get()); >+ CFPreferencesSetAppValue(WebDatabaseDirectoryDefaultsKey, FileSystem::pathByAppendingComponent(libraryPath, "Databases").createCFString().get(), appId.get()); >+ CFPreferencesSetAppValue(WebStorageDirectoryDefaultsKey, FileSystem::pathByAppendingComponent(libraryPath, "LocalStorage").createCFString().get(), appId.get()); >+ CFPreferencesSetAppValue(WebKitLocalCacheDefaultsKey, FileSystem::pathByAppendingComponent(libraryPath, "LocalCache").createCFString().get(), appId.get()); > #endif > } > >@@ -1035,7 +1035,7 @@ static void sizeWebViewForCurrentTest() > > static String findFontFallback(const char* pathOrUrl) > { >- String pathToFontFallback = WebCore::FileSystem::directoryName(pathOrUrl); >+ String pathToFontFallback = FileSystem::directoryName(pathOrUrl); > > wchar_t fullPath[_MAX_PATH]; > if (!_wfullpath(fullPath, pathToFontFallback.charactersWithNullTermination().data(), _MAX_PATH)) >@@ -1054,20 +1054,20 @@ static String findFontFallback(const char* pathOrUrl) > return emptyString(); > > String pathToTest = pathToCheck.substring(location + layoutTests.length() + 1); >- String possiblePathToLogue = WebCore::FileSystem::pathByAppendingComponent(pathToCheck.substring(0, location + layoutTests.length() + 1), "platform\\win"); >+ String possiblePathToLogue = FileSystem::pathByAppendingComponent(pathToCheck.substring(0, location + layoutTests.length() + 1), "platform\\win"); > > Vector<String> possiblePaths; >- possiblePaths.append(WebCore::FileSystem::pathByAppendingComponent(possiblePathToLogue, pathToTest)); >+ possiblePaths.append(FileSystem::pathByAppendingComponent(possiblePathToLogue, pathToTest)); > > size_t nextCandidateEnd = pathToTest.reverseFind('\\'); > while (nextCandidateEnd && nextCandidateEnd != WTF::notFound) { > pathToTest = pathToTest.substring(0, nextCandidateEnd); >- possiblePaths.append(WebCore::FileSystem::pathByAppendingComponent(possiblePathToLogue, pathToTest)); >+ possiblePaths.append(FileSystem::pathByAppendingComponent(possiblePathToLogue, pathToTest)); > nextCandidateEnd = pathToTest.reverseFind('\\'); > } > > for (Vector<String>::iterator pos = possiblePaths.begin(); pos != possiblePaths.end(); ++pos) { >- pathToFontFallback = WebCore::FileSystem::pathByAppendingComponent(*pos, "resources\\"); >+ pathToFontFallback = FileSystem::pathByAppendingComponent(*pos, "resources\\"); > > if (::PathIsDirectoryW(pathToFontFallback.charactersWithNullTermination().data())) > return pathToFontFallback; >@@ -1081,7 +1081,7 @@ static void addFontFallbackIfPresent(const String& fontFallbackPath) > if (fontFallbackPath.isEmpty()) > return; > >- String fontFallback = WebCore::FileSystem::pathByAppendingComponent(fontFallbackPath, "Mac-compatible-font-fallback.css"); >+ String fontFallback = FileSystem::pathByAppendingComponent(fontFallbackPath, "Mac-compatible-font-fallback.css"); > > if (!::PathFileExistsW(fontFallback.charactersWithNullTermination().data())) > return; >@@ -1094,7 +1094,7 @@ static void removeFontFallbackIfPresent(const String& fontFallbackPath) > if (fontFallbackPath.isEmpty()) > return; > >- String fontFallback = WebCore::FileSystem::pathByAppendingComponent(fontFallbackPath, "Mac-compatible-font-fallback.css"); >+ String fontFallback = FileSystem::pathByAppendingComponent(fontFallbackPath, "Mac-compatible-font-fallback.css"); > > if (!::PathFileExistsW(fontFallback.charactersWithNullTermination().data())) > return; >diff --git a/Tools/TestWebKitAPI/CMakeLists.txt b/Tools/TestWebKitAPI/CMakeLists.txt >index b24900898b3fc5af89c4903380c3fd7c1dc0d705..d9cea8f581f6b301d2935d5db45b077969d4c0dc 100644 >--- a/Tools/TestWebKitAPI/CMakeLists.txt >+++ b/Tools/TestWebKitAPI/CMakeLists.txt >@@ -188,7 +188,14 @@ set(TestWTF_SOURCES > ${TESTWEBKITAPI_DIR}/Tests/WTF/WorkerPool.cpp > ) > >-# FIXME: Tests/WTF/RunLoop.cpp is missing because it doesn't work for Windows. >+# FIXME: Make these work on Windows too. >+if (NOT WIN32) >+ list(APPEND TestWTF_SOURCES >+ ${TESTWEBKITAPI_DIR}/Tests/WTF/FileSystem.cpp >+ ${TESTWEBKITAPI_DIR}/Tests/WTF/RunLoop.cpp >+ ) >+endif () >+ > # FIXME: Platform-specific sources in Tests/WTF are not included in TestWTF_SOURCES. > > WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() >diff --git a/Tools/TestWebKitAPI/PlatformGTK.cmake b/Tools/TestWebKitAPI/PlatformGTK.cmake >index c34fae07cf3c6b0a39c399fee32cd25c3a0aa7f4..ce821e61b056435b2eeee5e0e56ba2357725885e 100644 >--- a/Tools/TestWebKitAPI/PlatformGTK.cmake >+++ b/Tools/TestWebKitAPI/PlatformGTK.cmake >@@ -93,7 +93,6 @@ add_executable(TestWebCore > ${TESTWEBKITAPI_DIR}/Tests/WebCore/ComplexTextController.cpp > ${TESTWEBKITAPI_DIR}/Tests/WebCore/DNS.cpp > ${TESTWEBKITAPI_DIR}/Tests/WebCore/FileMonitor.cpp >- ${TESTWEBKITAPI_DIR}/Tests/WebCore/FileSystem.cpp > ${TESTWEBKITAPI_DIR}/Tests/WebCore/gstreamer/GstMappedBuffer.cpp > ${TESTWEBKITAPI_DIR}/Tests/WebCore/gstreamer/GStreamerTest.cpp > ${TESTWEBKITAPI_DIR}/Tests/WebCore/GridPosition.cpp >diff --git a/Tools/TestWebKitAPI/PlatformJSCOnly.cmake b/Tools/TestWebKitAPI/PlatformJSCOnly.cmake >index a3fa2da955d5a39c1c39680c21e8cde6e8fb5c80..b55698bbfbf9733ac08e36935a98bb2b69ee0b7f 100644 >--- a/Tools/TestWebKitAPI/PlatformJSCOnly.cmake >+++ b/Tools/TestWebKitAPI/PlatformJSCOnly.cmake >@@ -21,7 +21,3 @@ endif () > set(test_main_SOURCES > ${TESTWEBKITAPI_DIR}/generic/main.cpp > ) >- >-list(APPEND TestWTF_SOURCES >- ${TESTWEBKITAPI_DIR}/Tests/WTF/RunLoop.cpp >-) >diff --git a/Tools/TestWebKitAPI/PlatformPlayStation.cmake b/Tools/TestWebKitAPI/PlatformPlayStation.cmake >index 9f1a2a64d518404da986e6651270f788a05d8e6c..f1fcb041c75b0715f0a32fbd440eac4e011c4179 100644 >--- a/Tools/TestWebKitAPI/PlatformPlayStation.cmake >+++ b/Tools/TestWebKitAPI/PlatformPlayStation.cmake >@@ -14,5 +14,4 @@ set(test_main_SOURCES > > list(APPEND TestWTF_SOURCES > ${TESTWEBKITAPI_DIR}/generic/UtilitiesGeneric.cpp >- ${TESTWEBKITAPI_DIR}/Tests/WTF/RunLoop.cpp > ) >diff --git a/Tools/TestWebKitAPI/PlatformWPE.cmake b/Tools/TestWebKitAPI/PlatformWPE.cmake >index b6877598d877de6c8da86b4eb57cc86ff0a2f7ef..4267da20d070c47bc81e46ec2b7f2d13c0799d76 100644 >--- a/Tools/TestWebKitAPI/PlatformWPE.cmake >+++ b/Tools/TestWebKitAPI/PlatformWPE.cmake >@@ -60,7 +60,6 @@ add_executable(TestWebCore > ${TESTWEBKITAPI_DIR}/glib/UtilitiesGLib.cpp > ${TESTWEBKITAPI_DIR}/TestsController.cpp > ${TESTWEBKITAPI_DIR}/Tests/WebCore/FileMonitor.cpp >- ${TESTWEBKITAPI_DIR}/Tests/WebCore/FileSystem.cpp > ${TESTWEBKITAPI_DIR}/Tests/WebCore/gstreamer/GstMappedBuffer.cpp > ${TESTWEBKITAPI_DIR}/Tests/WebCore/gstreamer/GStreamerTest.cpp > ${TESTWEBKITAPI_DIR}/Tests/WebCore/HTMLParserIdioms.cpp >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 7a1072acdaa2c2aa507cdb2fc2970810845c3f0a..f65268e5fd3b41d36b6fc46d5f7eb2fc1d1e2c08 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -427,7 +427,6 @@ > 7C83E04C1D0A641800FEBCF3 /* WebCoreNSURLSession.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD89D0381C4EDB2A00040A04 /* WebCoreNSURLSession.mm */; }; > 7C83E04D1D0A641800FEBCF3 /* DFACombiner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260BA5781B1D2E7B004FA07C /* DFACombiner.cpp */; }; > 7C83E04E1D0A641800FEBCF3 /* DFAMinimizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F6E1EF1ADC749B00DE696B /* DFAMinimizer.cpp */; }; >- 7C83E04F1D0A641800FEBCF3 /* FileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41973B5A1AF2286A006C7B36 /* FileSystem.cpp */; }; > 7C83E0501D0A641800FEBCF3 /* HTMLParserIdioms.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83B88A331C80056D00BB2418 /* HTMLParserIdioms.cpp */; }; > 7C83E0511D0A641800FEBCF3 /* ParsedContentRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD225C071C45A69200140761 /* ParsedContentRange.cpp */; }; > 7C83E0521D0A641800FEBCF3 /* SharedBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41973B5C1AF22875006C7B36 /* SharedBuffer.cpp */; }; >@@ -689,6 +688,7 @@ > A1C4FB731BACD1CA003742D0 /* pages.pages in Copy Resources */ = {isa = PBXBuildFile; fileRef = A1C4FB721BACD1B7003742D0 /* pages.pages */; }; > A1DF74321C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1DF74301C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm */; }; > A1EC11881F42541200D0146E /* PreviewLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1EC11871F42541200D0146E /* PreviewLoader.cpp */; }; >+ A310827221F296FF00C28B97 /* FileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A310827121F296EC00C28B97 /* FileSystem.cpp */; }; > A57A34F216AF6B2B00C2501F /* PageVisibilityStateWithWindowChanges.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = A57A34F116AF69E200C2501F /* PageVisibilityStateWithWindowChanges.html */; }; > A57D54F31F338C3600A97AA7 /* NeverDestroyed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D54F21F338C3600A97AA7 /* NeverDestroyed.cpp */; }; > A57D54F61F3395D000A97AA7 /* Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D54F41F3395D000A97AA7 /* Logger.cpp */; }; >@@ -1520,7 +1520,6 @@ > 4135FB832011FAA300332139 /* InjectInternals_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InjectInternals_Bundle.cpp; path = Tests/InjectInternals_Bundle.cpp; sourceTree = SOURCE_ROOT; }; > 4135FB862011FABF00332139 /* libWebCoreTestSupport.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; path = libWebCoreTestSupport.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; > 41882F0221010A70002FF288 /* ProcessPreWarming.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProcessPreWarming.mm; sourceTree = "<group>"; }; >- 41973B5A1AF2286A006C7B36 /* FileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystem.cpp; sourceTree = "<group>"; }; > 41973B5C1AF22875006C7B36 /* SharedBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedBuffer.cpp; sourceTree = "<group>"; }; > 442BBF681C91CAD90017087F /* RefLogger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefLogger.cpp; sourceTree = "<group>"; }; > 4433A395208044130091ED57 /* SynchronousTimeoutTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SynchronousTimeoutTests.mm; sourceTree = "<group>"; }; >@@ -1917,6 +1916,7 @@ > A1DF74301C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AlwaysRevalidatedURLSchemes.mm; sourceTree = "<group>"; }; > A1EC11871F42541200D0146E /* PreviewLoader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PreviewLoader.cpp; sourceTree = "<group>"; }; > A1FDFD2E19C288BB005148A4 /* WKImageCreateCGImageCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKImageCreateCGImageCrash.cpp; sourceTree = "<group>"; }; >+ A310827121F296EC00C28B97 /* FileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystem.cpp; sourceTree = "<group>"; }; > A57A34EF16AF677200C2501F /* PageVisibilityStateWithWindowChanges.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageVisibilityStateWithWindowChanges.mm; sourceTree = "<group>"; }; > A57A34F116AF69E200C2501F /* PageVisibilityStateWithWindowChanges.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = PageVisibilityStateWithWindowChanges.html; sourceTree = "<group>"; }; > A57D54F21F338C3600A97AA7 /* NeverDestroyed.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = NeverDestroyed.cpp; sourceTree = "<group>"; }; >@@ -2677,7 +2677,6 @@ > 579651E6216BFD53006EBFE5 /* FidoHidMessageTest.cpp */, > 572B40352176A029000AD43E /* FidoTestData.h */, > 7A32D7491F02151500162C44 /* FileMonitor.cpp */, >- 41973B5A1AF2286A006C7B36 /* FileSystem.cpp */, > 7A909A701D877475007E10F8 /* FloatPoint.cpp */, > 7A909A711D877475007E10F8 /* FloatRect.cpp */, > 7A909A721D877475007E10F8 /* FloatSize.cpp */, >@@ -3187,6 +3186,7 @@ > E4A757D3178AEA5B00B5D7A4 /* Deque.cpp */, > 1AF7B21D1D6CD12E008C126C /* EnumTraits.cpp */, > AD7C434C1DD2A5470026888B /* Expected.cpp */, >+ A310827121F296EC00C28B97 /* FileSystem.cpp */, > 9310CD361EF708FB0050FFE0 /* Function.cpp */, > 83DB79671EF63B3C00BFA5E5 /* Function.cpp */, > 7A38D7E51C752D5F004F157D /* HashCountedSet.cpp */, >@@ -3795,6 +3795,7 @@ > 7C83DEAD1D0A590C00FEBCF3 /* Deque.cpp in Sources */, > 1AF7B21F1D6CD14D008C126C /* EnumTraits.cpp in Sources */, > AD7C434D1DD2A54E0026888B /* Expected.cpp in Sources */, >+ A310827221F296FF00C28B97 /* FileSystem.cpp in Sources */, > 9310CD381EF708FB0050FFE0 /* Function.cpp in Sources */, > 6BFD294C1D5E6C1D008EC968 /* HashCountedSet.cpp in Sources */, > 933D631D1FCB76200032ECD6 /* Hasher.cpp in Sources */, >@@ -3998,7 +3999,6 @@ > 7CCE7EF11A411AE600447C4C /* FailedLoad.cpp in Sources */, > 579651E7216BFDED006EBFE5 /* FidoHidMessageTest.cpp in Sources */, > 7A32D74A1F02151500162C44 /* FileMonitor.cpp in Sources */, >- 7C83E04F1D0A641800FEBCF3 /* FileSystem.cpp in Sources */, > 7CCE7EF31A411AE600447C4C /* Find.cpp in Sources */, > 7C83E0BB1D0A650000FEBCF3 /* FindInPage.mm in Sources */, > 7CCE7EF41A411AE600447C4C /* FindMatches.mm in Sources */, >diff --git a/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp b/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..d57df614297f0a2372395c76bf4c5915a57575fa >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp >@@ -0,0 +1,148 @@ >+/* >+ * Copyright (C) 2015 Canon Inc. All rights reserved. >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+ >+#include "Test.h" >+#include <wtf/FileMetadata.h> >+#include <wtf/FileSystem.h> >+#include <wtf/MainThread.h> >+#include <wtf/StringExtras.h> >+ >+namespace TestWebKitAPI { >+ >+const char* FileSystemTestData = "This is a test"; >+ >+// FIXME: Refactor FileSystemTest and SharedBufferTest as a single class. >+class FileSystemTest : public testing::Test { >+public: >+ void SetUp() override >+ { >+ WTF::initializeMainThread(); >+ >+ // create temp file >+ FileSystem::PlatformFileHandle handle; >+ m_tempFilePath = FileSystem::openTemporaryFile("tempTestFile", handle); >+ FileSystem::writeToFile(handle, FileSystemTestData, strlen(FileSystemTestData)); >+ FileSystem::closeFile(handle); >+ >+ m_tempFileSymlinkPath = m_tempFilePath + "-symlink"; >+ FileSystem::createSymbolicLink(m_tempFilePath, m_tempFileSymlinkPath); >+ >+ m_tempEmptyFilePath = FileSystem::openTemporaryFile("tempEmptyTestFile", handle); >+ FileSystem::closeFile(handle); >+ >+ m_spaceContainingFilePath = FileSystem::openTemporaryFile("temp Empty Test File", handle); >+ FileSystem::closeFile(handle); >+ >+ m_bangContainingFilePath = FileSystem::openTemporaryFile("temp!Empty!Test!File", handle); >+ FileSystem::closeFile(handle); >+ >+ m_quoteContainingFilePath = FileSystem::openTemporaryFile("temp\"Empty\"TestFile", handle); >+ FileSystem::closeFile(handle); >+ } >+ >+ void TearDown() override >+ { >+ FileSystem::deleteFile(m_tempFilePath); >+ FileSystem::deleteFile(m_tempFileSymlinkPath); >+ FileSystem::deleteFile(m_tempEmptyFilePath); >+ FileSystem::deleteFile(m_spaceContainingFilePath); >+ FileSystem::deleteFile(m_bangContainingFilePath); >+ FileSystem::deleteFile(m_quoteContainingFilePath); >+ } >+ >+ const String& tempFilePath() { return m_tempFilePath; } >+ const String& tempFileSymlinkPath() { return m_tempFileSymlinkPath; } >+ const String& tempEmptyFilePath() { return m_tempEmptyFilePath; } >+ const String& spaceContainingFilePath() { return m_spaceContainingFilePath; } >+ const String& bangContainingFilePath() { return m_bangContainingFilePath; } >+ const String& quoteContainingFilePath() { return m_quoteContainingFilePath; } >+ >+private: >+ String m_tempFilePath; >+ String m_tempFileSymlinkPath; >+ String m_tempEmptyFilePath; >+ String m_spaceContainingFilePath; >+ String m_bangContainingFilePath; >+ String m_quoteContainingFilePath; >+}; >+ >+TEST_F(FileSystemTest, MappingMissingFile) >+{ >+ bool success; >+ FileSystem::MappedFileData mappedFileData(String("not_existing_file"), success); >+ EXPECT_FALSE(success); >+ EXPECT_TRUE(!mappedFileData); >+} >+ >+TEST_F(FileSystemTest, MappingExistingFile) >+{ >+ bool success; >+ FileSystem::MappedFileData mappedFileData(tempFilePath(), success); >+ EXPECT_TRUE(success); >+ EXPECT_TRUE(!!mappedFileData); >+ EXPECT_TRUE(mappedFileData.size() == strlen(FileSystemTestData)); >+ EXPECT_TRUE(strnstr(FileSystemTestData, static_cast<const char*>(mappedFileData.data()), mappedFileData.size())); >+} >+ >+TEST_F(FileSystemTest, MappingExistingEmptyFile) >+{ >+ bool success; >+ FileSystem::MappedFileData mappedFileData(tempEmptyFilePath(), success); >+ EXPECT_TRUE(success); >+ EXPECT_TRUE(!mappedFileData); >+} >+ >+TEST_F(FileSystemTest, FilesHaveSameVolume) >+{ >+ EXPECT_TRUE(FileSystem::filesHaveSameVolume(tempFilePath(), spaceContainingFilePath())); >+ EXPECT_TRUE(FileSystem::filesHaveSameVolume(spaceContainingFilePath(), bangContainingFilePath())); >+ EXPECT_TRUE(FileSystem::filesHaveSameVolume(bangContainingFilePath(), quoteContainingFilePath())); >+} >+ >+TEST_F(FileSystemTest, GetFileMetadataSymlink) >+{ >+ auto symlinkMetadata = FileSystem::fileMetadata(tempFileSymlinkPath()); >+ ASSERT_TRUE(symlinkMetadata.hasValue()); >+ EXPECT_TRUE(symlinkMetadata.value().type == FileMetadata::Type::SymbolicLink); >+ EXPECT_FALSE(static_cast<size_t>(symlinkMetadata.value().length) == strlen(FileSystemTestData)); >+ >+ auto targetMetadata = FileSystem::fileMetadataFollowingSymlinks(tempFileSymlinkPath()); >+ ASSERT_TRUE(targetMetadata.hasValue()); >+ EXPECT_TRUE(targetMetadata.value().type == FileMetadata::Type::File); >+ EXPECT_EQ(strlen(FileSystemTestData), static_cast<size_t>(targetMetadata.value().length)); >+} >+ >+TEST_F(FileSystemTest, UnicodeDirectoryName) >+{ >+ String path = String::fromUTF8("/test/a\u0308lo/test.txt"); >+ String directoryName = FileSystem::directoryName(path); >+ String expectedDirectoryName = String::fromUTF8("/test/a\u0308lo"); >+ EXPECT_TRUE(expectedDirectoryName == directoryName); >+} >+ >+} >diff --git a/Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp b/Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp >index 5f1dc8b2e4d524d3526804bd6cd9ce98a3711fe8..e002df1ef094f5b3f00d16e9c6be6d49d5e6af24 100644 >--- a/Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp >@@ -29,7 +29,7 @@ > #include "Test.h" > #include "WTFStringUtilities.h" > #include <WebCore/FileMonitor.h> >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/RunLoop.h> > #include <wtf/Scope.h> >diff --git a/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp b/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp >deleted file mode 100644 >index 76625025309727ea605cb52cfc9ecd4b33e77875..0000000000000000000000000000000000000000 >--- a/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp >+++ /dev/null >@@ -1,150 +0,0 @@ >-/* >- * Copyright (C) 2015 Canon Inc. All rights reserved. >- * Copyright (C) 2017 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >- >-#include "Test.h" >-#include <WebCore/FileMetadata.h> >-#include <WebCore/FileSystem.h> >-#include <wtf/MainThread.h> >-#include <wtf/StringExtras.h> >- >-using namespace WebCore; >- >-namespace TestWebKitAPI { >- >-const char* FileSystemTestData = "This is a test"; >- >-// FIXME: Refactor FileSystemTest and SharedBufferTest as a single class. >-class FileSystemTest : public testing::Test { >-public: >- void SetUp() override >- { >- WTF::initializeMainThread(); >- >- // create temp file >- FileSystem::PlatformFileHandle handle; >- m_tempFilePath = FileSystem::openTemporaryFile("tempTestFile", handle); >- FileSystem::writeToFile(handle, FileSystemTestData, strlen(FileSystemTestData)); >- FileSystem::closeFile(handle); >- >- m_tempFileSymlinkPath = m_tempFilePath + "-symlink"; >- FileSystem::createSymbolicLink(m_tempFilePath, m_tempFileSymlinkPath); >- >- m_tempEmptyFilePath = FileSystem::openTemporaryFile("tempEmptyTestFile", handle); >- FileSystem::closeFile(handle); >- >- m_spaceContainingFilePath = FileSystem::openTemporaryFile("temp Empty Test File", handle); >- FileSystem::closeFile(handle); >- >- m_bangContainingFilePath = FileSystem::openTemporaryFile("temp!Empty!Test!File", handle); >- FileSystem::closeFile(handle); >- >- m_quoteContainingFilePath = FileSystem::openTemporaryFile("temp\"Empty\"TestFile", handle); >- FileSystem::closeFile(handle); >- } >- >- void TearDown() override >- { >- FileSystem::deleteFile(m_tempFilePath); >- FileSystem::deleteFile(m_tempFileSymlinkPath); >- FileSystem::deleteFile(m_tempEmptyFilePath); >- FileSystem::deleteFile(m_spaceContainingFilePath); >- FileSystem::deleteFile(m_bangContainingFilePath); >- FileSystem::deleteFile(m_quoteContainingFilePath); >- } >- >- const String& tempFilePath() { return m_tempFilePath; } >- const String& tempFileSymlinkPath() { return m_tempFileSymlinkPath; } >- const String& tempEmptyFilePath() { return m_tempEmptyFilePath; } >- const String& spaceContainingFilePath() { return m_spaceContainingFilePath; } >- const String& bangContainingFilePath() { return m_bangContainingFilePath; } >- const String& quoteContainingFilePath() { return m_quoteContainingFilePath; } >- >-private: >- String m_tempFilePath; >- String m_tempFileSymlinkPath; >- String m_tempEmptyFilePath; >- String m_spaceContainingFilePath; >- String m_bangContainingFilePath; >- String m_quoteContainingFilePath; >-}; >- >-TEST_F(FileSystemTest, MappingMissingFile) >-{ >- bool success; >- FileSystem::MappedFileData mappedFileData(String("not_existing_file"), success); >- EXPECT_FALSE(success); >- EXPECT_TRUE(!mappedFileData); >-} >- >-TEST_F(FileSystemTest, MappingExistingFile) >-{ >- bool success; >- FileSystem::MappedFileData mappedFileData(tempFilePath(), success); >- EXPECT_TRUE(success); >- EXPECT_TRUE(!!mappedFileData); >- EXPECT_TRUE(mappedFileData.size() == strlen(FileSystemTestData)); >- EXPECT_TRUE(strnstr(FileSystemTestData, static_cast<const char*>(mappedFileData.data()), mappedFileData.size())); >-} >- >-TEST_F(FileSystemTest, MappingExistingEmptyFile) >-{ >- bool success; >- FileSystem::MappedFileData mappedFileData(tempEmptyFilePath(), success); >- EXPECT_TRUE(success); >- EXPECT_TRUE(!mappedFileData); >-} >- >-TEST_F(FileSystemTest, FilesHaveSameVolume) >-{ >- EXPECT_TRUE(FileSystem::filesHaveSameVolume(tempFilePath(), spaceContainingFilePath())); >- EXPECT_TRUE(FileSystem::filesHaveSameVolume(spaceContainingFilePath(), bangContainingFilePath())); >- EXPECT_TRUE(FileSystem::filesHaveSameVolume(bangContainingFilePath(), quoteContainingFilePath())); >-} >- >-TEST_F(FileSystemTest, GetFileMetadataSymlink) >-{ >- auto symlinkMetadata = FileSystem::fileMetadata(tempFileSymlinkPath()); >- ASSERT_TRUE(symlinkMetadata.hasValue()); >- EXPECT_TRUE(symlinkMetadata.value().type == FileMetadata::Type::SymbolicLink); >- EXPECT_FALSE(static_cast<size_t>(symlinkMetadata.value().length) == strlen(FileSystemTestData)); >- >- auto targetMetadata = FileSystem::fileMetadataFollowingSymlinks(tempFileSymlinkPath()); >- ASSERT_TRUE(targetMetadata.hasValue()); >- EXPECT_TRUE(targetMetadata.value().type == FileMetadata::Type::File); >- EXPECT_EQ(strlen(FileSystemTestData), static_cast<size_t>(targetMetadata.value().length)); >-} >- >-TEST_F(FileSystemTest, UnicodeDirectoryName) >-{ >- String path = String::fromUTF8("/test/a\u0308lo/test.txt"); >- String directoryName = FileSystem::directoryName(path); >- String expectedDirectoryName = String::fromUTF8("/test/a\u0308lo"); >- EXPECT_TRUE(expectedDirectoryName == directoryName); >-} >- >-} >diff --git a/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp b/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp >index da5f4ff5898a9f09c8b8395a55de738f168c909f..a41ab4bca371d45de8cb458685bc974e30f406f3 100644 >--- a/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp >@@ -26,8 +26,8 @@ > > #include "config.h" > #include "WTFStringUtilities.h" >-#include <WebCore/FileSystem.h> > #include <WebCore/SecurityOrigin.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > #include <wtf/URL.h> > >diff --git a/Tools/TestWebKitAPI/Tests/WebCore/SharedBufferTest.cpp b/Tools/TestWebKitAPI/Tests/WebCore/SharedBufferTest.cpp >index 8fe3567c1e113691d85b7c55a1f96659de9d1f24..9b8b13a75d52ff951ead18185d56c3791b2d7bed 100644 >--- a/Tools/TestWebKitAPI/Tests/WebCore/SharedBufferTest.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebCore/SharedBufferTest.cpp >@@ -26,11 +26,9 @@ > #include "config.h" > #include "SharedBufferTest.h" > >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > #include <wtf/MainThread.h> > >-using namespace WebCore; >- > namespace TestWebKitAPI { > > void SharedBufferTest::SetUp() >diff --git a/Tools/TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm b/Tools/TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm >index 6a3c70280a4ede009102ee9976b367c26ab7fee7..2217156f6e56915a75d44884ead51719a7c52911 100644 >--- a/Tools/TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm >+++ b/Tools/TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm >@@ -26,11 +26,11 @@ > #include "config.h" > > #include <WebCore/DatabaseTracker.h> >-#include <WebCore/FileSystem.h> > #include <WebCore/OriginLock.h> > #include <WebCore/SQLiteDatabase.h> > #include <WebCore/SQLiteStatement.h> > #include <WebCore/SecurityOriginData.h> >+#include <wtf/FileSystem.h> > > using namespace WebCore; > >diff --git a/Tools/TestWebKitAPI/Tests/WebCore/curl/Cookies.cpp b/Tools/TestWebKitAPI/Tests/WebCore/curl/Cookies.cpp >index 1b8d7fc3cde50299e30ad6c6d8ca1627f2390c1f..b40b0d5a0a5e5fb5f4919a3da2c2fed6fcbc1c4e 100644 >--- a/Tools/TestWebKitAPI/Tests/WebCore/curl/Cookies.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebCore/curl/Cookies.cpp >@@ -29,8 +29,8 @@ > > #include <WebCore/CookieJarDB.h> > #include <WebCore/CookieUtil.h> >-#include <WebCore/FileSystem.h> > #include <memory> >+#include <wtf/FileSystem.h> > > using namespace WebCore; > >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm >index 60cc93b340dd680941c41a2a5aa0ba923b5aec64..681b02ca9c87daec3726224617d1c592088d7a6c 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm >@@ -33,7 +33,6 @@ > #import "Test.h" > #import "TestProtocol.h" > #import "TestWKWebView.h" >-#import <WebCore/FileSystem.h> > #import <WebKit/_WKDownload.h> > #import <WebKit/_WKDownloadDelegate.h> > #import <WebKit/WKNavigationDelegatePrivate.h> >@@ -41,6 +40,7 @@ > #import <WebKit/WKUIDelegatePrivate.h> > #import <WebKit/WKWebView.h> > #import <WebKit/WKWebViewConfiguration.h> >+#import <wtf/FileSystem.h> > #import <wtf/MainThread.h> > #import <wtf/RetainPtr.h> > #import <wtf/text/WTFString.h> >@@ -94,10 +94,10 @@ IGNORE_WARNINGS_END > EXPECT_TRUE(hasReceivedResponse); > EXPECT_EQ(_download, download); > >- WebCore::FileSystem::PlatformFileHandle fileHandle; >- _destinationPath = WebCore::FileSystem::openTemporaryFile("TestWebKitAPI", fileHandle); >- EXPECT_TRUE(fileHandle != WebCore::FileSystem::invalidPlatformFileHandle); >- WebCore::FileSystem::closeFile(fileHandle); >+ FileSystem::PlatformFileHandle fileHandle; >+ _destinationPath = FileSystem::openTemporaryFile("TestWebKitAPI", fileHandle); >+ EXPECT_TRUE(fileHandle != FileSystem::invalidPlatformFileHandle); >+ FileSystem::closeFile(fileHandle); > > *allowOverwrite = YES; > return _destinationPath; >@@ -109,7 +109,7 @@ - (void)_downloadDidFinish:(_WKDownload *)download > EXPECT_EQ(expectedUserInitiatedState, download.wasUserInitiated); > EXPECT_TRUE(_expectedContentLength == NSURLResponseUnknownLength || static_cast<uint64_t>(_expectedContentLength) == _receivedContentLength); > EXPECT_TRUE([[NSFileManager defaultManager] contentsEqualAtPath:_destinationPath andPath:[sourceURL path]]); >- WebCore::FileSystem::deleteFile(_destinationPath); >+ FileSystem::deleteFile(_destinationPath); > isDone = true; > } > >@@ -397,10 +397,10 @@ IGNORE_WARNINGS_END > EXPECT_TRUE(hasReceivedResponse); > EXPECT_EQ(_download, download); > >- WebCore::FileSystem::PlatformFileHandle fileHandle; >- _destinationPath = WebCore::FileSystem::openTemporaryFile("TestWebKitAPI", fileHandle); >- EXPECT_TRUE(fileHandle != WebCore::FileSystem::invalidPlatformFileHandle); >- WebCore::FileSystem::closeFile(fileHandle); >+ FileSystem::PlatformFileHandle fileHandle; >+ _destinationPath = FileSystem::openTemporaryFile("TestWebKitAPI", fileHandle); >+ EXPECT_TRUE(fileHandle != FileSystem::invalidPlatformFileHandle); >+ FileSystem::closeFile(fileHandle); > > *allowOverwrite = YES; > return _destinationPath; >@@ -414,7 +414,7 @@ - (void)_downloadDidFinish:(_WKDownload *)download > NSString* expectedContent = @"{\"x\":42,\"s\":\"hello, world\"}"; > NSData* expectedData = [expectedContent dataUsingEncoding:NSUTF8StringEncoding]; > EXPECT_TRUE([[[NSFileManager defaultManager] contentsAtPath:_destinationPath] isEqualToData:expectedData]); >- WebCore::FileSystem::deleteFile(_destinationPath); >+ FileSystem::deleteFile(_destinationPath); > isDone = true; > } > >@@ -457,10 +457,10 @@ IGNORE_WARNINGS_BEGIN("deprecated-implementations") > - (NSString *)_download:(_WKDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename allowOverwrite:(BOOL *)allowOverwrite > IGNORE_WARNINGS_END > { >- WebCore::FileSystem::PlatformFileHandle fileHandle; >- _destinationPath = WebCore::FileSystem::openTemporaryFile("TestWebKitAPI", fileHandle); >- EXPECT_TRUE(fileHandle != WebCore::FileSystem::invalidPlatformFileHandle); >- WebCore::FileSystem::closeFile(fileHandle); >+ FileSystem::PlatformFileHandle fileHandle; >+ _destinationPath = FileSystem::openTemporaryFile("TestWebKitAPI", fileHandle); >+ EXPECT_TRUE(fileHandle != FileSystem::invalidPlatformFileHandle); >+ FileSystem::closeFile(fileHandle); > *allowOverwrite = YES; > return _destinationPath; > } >@@ -487,7 +487,7 @@ - (void)_downloadDidFinish:(_WKDownload *)download > if (redirectChain.count > 2) > EXPECT_STREQ("http://pass/", [redirectChain[2].absoluteString UTF8String]); > >- WebCore::FileSystem::deleteFile(_destinationPath); >+ FileSystem::deleteFile(_destinationPath); > isDone = true; > } > >@@ -632,17 +632,17 @@ - (void)_download:(_WKDownload *)download decideDestinationWithSuggestedFilename > { > EXPECT_TRUE([filename hasSuffix:@".usdz"]); > >- WebCore::FileSystem::PlatformFileHandle fileHandle; >- _destinationPath = WebCore::FileSystem::openTemporaryFile(filename, fileHandle); >- EXPECT_TRUE(fileHandle != WebCore::FileSystem::invalidPlatformFileHandle); >- WebCore::FileSystem::closeFile(fileHandle); >+ FileSystem::PlatformFileHandle fileHandle; >+ _destinationPath = FileSystem::openTemporaryFile(filename, fileHandle); >+ EXPECT_TRUE(fileHandle != FileSystem::invalidPlatformFileHandle); >+ FileSystem::closeFile(fileHandle); > > completionHandler(YES, _destinationPath); > } > > - (void)_downloadDidFinish:(_WKDownload *)download > { >- WebCore::FileSystem::deleteFile(_destinationPath); >+ FileSystem::deleteFile(_destinationPath); > isDone = true; > } > >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm >index f560df3f4c42e24e65b3bf62871b5fadc19a5f65..3eb03f04a1dd8a8e176783d5effd48347a90da00 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm >@@ -28,7 +28,6 @@ > #import "TestWKWebView.h" > #import "Utilities.h" > #import <Foundation/NSProgress.h> >-#import <WebCore/FileSystem.h> > #import <WebKit/WKBrowsingContextController.h> > #import <WebKit/WKNavigationDelegatePrivate.h> > #import <WebKit/WKProcessPoolPrivate.h> >@@ -37,6 +36,7 @@ > #import <WebKit/_WKDownloadDelegate.h> > #import <pal/spi/cocoa/NSProgressSPI.h> > #import <wtf/BlockPtr.h> >+#import <wtf/FileSystem.h> > #import <wtf/RetainPtr.h> > #import <wtf/WeakObjCPtr.h> > >@@ -380,10 +380,10 @@ - (void)_download:(_WKDownload *)download decideDestinationWithSuggestedFilename > { > EXPECT_EQ(download, m_download.get()); > >- WebCore::FileSystem::PlatformFileHandle fileHandle; >- RetainPtr<NSString> path = (NSString *)WebCore::FileSystem::openTemporaryFile("TestWebKitAPI", fileHandle); >- EXPECT_TRUE(fileHandle != WebCore::FileSystem::invalidPlatformFileHandle); >- WebCore::FileSystem::closeFile(fileHandle); >+ FileSystem::PlatformFileHandle fileHandle; >+ RetainPtr<NSString> path = (NSString *)FileSystem::openTemporaryFile("TestWebKitAPI", fileHandle); >+ EXPECT_TRUE(fileHandle != FileSystem::invalidPlatformFileHandle); >+ FileSystem::closeFile(fileHandle); > > completionHandler(YES, path.get()); > } >diff --git a/Tools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp b/Tools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp >index 056bff77829528b1290f12e39ab238b0f6868b86..35f22e2a8b1bfe50a47059091834723679a3d7fd 100644 >--- a/Tools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp >+++ b/Tools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp >@@ -27,7 +27,7 @@ > #include "PlatformUtilities.h" > > #include <Shlwapi.h> >-#include <WebCore/FileSystem.h> >+#include <wtf/FileSystem.h> > #include <wtf/URL.h> > #include <wtf/text/win/WCharStringExtras.h> > >@@ -40,19 +40,19 @@ static String moduleDirectory() > wchar_t filename[bufferLength]; > auto len = GetModuleFileName(nullptr, filename, bufferLength); > ASSERT(len > 0); >- return WebCore::FileSystem::directoryName(wcharToString(filename, len)); >+ return FileSystem::directoryName(wcharToString(filename, len)); > } > > WKStringRef createInjectedBundlePath() > { >- auto path = WebCore::FileSystem::pathByAppendingComponent(moduleDirectory(), String(L"TestWebKitAPIInjectedBundle.dll")); >+ auto path = FileSystem::pathByAppendingComponent(moduleDirectory(), String(L"TestWebKitAPIInjectedBundle.dll")); > return WKStringCreateWithUTF8CString(path.utf8().data()); > } > > WKURLRef createURLForResource(const char* resource, const char* extension) > { > String filename = String::format("..\\..\\..\\Tools\\TestWebKitAPI\\Tests\\WebKit\\%s.%s", resource, extension); >- auto url = URL::fileURLWithFileSystemPath(WebCore::FileSystem::pathByAppendingComponent(moduleDirectory(), filename)); >+ auto url = URL::fileURLWithFileSystemPath(FileSystem::pathByAppendingComponent(moduleDirectory(), filename)); > return WKURLCreateWithUTF8CString(url.string().utf8().data()); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193602
:
359556
|
359559
|
359589
|
359718
|
359719
|
359827
|
359830
|
359839
|
359862
|
359913
|
359945
|
359985