Title: [290863] trunk/Source/WebKit
Revision
290863
Author
[email protected]
Date
2022-03-04 23:22:15 -0800 (Fri, 04 Mar 2022)

Log Message

Stop setting NSURLIsExcludedFromBackupKey attribute for localSorageDirectory in UI process
https://bugs.webkit.org/show_bug.cgi?id=237447

Reviewed by Chris Dumez.

Let's do that on storage thread in network process when the directory is used.

Covered by existing test: WKWebView.LocalStorageDirectoryExcludedFromBackup.

* NetworkProcess/storage/OriginStorageManager.cpp:
(WebKit::OriginStorageManager::StorageBucket::resolvedLocalStoragePath):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (290862 => 290863)


--- trunk/Source/WebKit/ChangeLog	2022-03-05 06:02:13 UTC (rev 290862)
+++ trunk/Source/WebKit/ChangeLog	2022-03-05 07:22:15 UTC (rev 290863)
@@ -1,3 +1,19 @@
+2022-03-04  Sihui Liu  <[email protected]>
+
+        Stop setting NSURLIsExcludedFromBackupKey attribute for localSorageDirectory in UI process
+        https://bugs.webkit.org/show_bug.cgi?id=237447
+
+        Reviewed by Chris Dumez.
+
+        Let's do that on storage thread in network process when the directory is used.
+
+        Covered by existing test: WKWebView.LocalStorageDirectoryExcludedFromBackup.
+
+        * NetworkProcess/storage/OriginStorageManager.cpp:
+        (WebKit::OriginStorageManager::StorageBucket::resolvedLocalStoragePath):
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::parameters):
+
 2022-03-04  Harrison Weinerman  <[email protected]>
 
         Change app launch scheme

Modified: trunk/Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp (290862 => 290863)


--- trunk/Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp	2022-03-05 06:02:13 UTC (rev 290862)
+++ trunk/Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp	2022-03-05 07:22:15 UTC (rev 290863)
@@ -347,12 +347,11 @@
 
     if (m_shouldUseCustomPaths) {
         ASSERT(m_customLocalStoragePath.isEmpty() == m_rootPath.isEmpty());
+        FileSystem::makeAllDirectories(FileSystem::parentPath(m_customLocalStoragePath));
         m_resolvedLocalStoragePath = m_customLocalStoragePath;
     } else if (!m_rootPath.isEmpty()) {
         auto localStorageDirectory = typeStoragePath(StorageType::LocalStorage);
         FileSystem::makeAllDirectories(localStorageDirectory);
-        FileSystem::excludeFromBackup(localStorageDirectory);
-
         auto localStoragePath = LocalStorageManager::localStorageFilePath(localStorageDirectory);
         if (!m_customLocalStoragePath.isEmpty() && !FileSystem::fileExists(localStoragePath) && FileSystem::fileExists(m_customLocalStoragePath))
             WebCore::SQLiteFileSystem::moveDatabaseFile(m_customLocalStoragePath, localStoragePath);
@@ -361,6 +360,12 @@
     } else
         m_resolvedLocalStoragePath = emptyString();
 
+#if PLATFORM(IOS_FAMILY)
+    // Exclude LocalStorage directory to reduce backup traffic. See https://webkit.org/b/168388.
+    if (!m_resolvedLocalStoragePath.isEmpty())
+        FileSystem::excludeFromBackup(FileSystem::parentPath(m_customLocalStoragePath));
+#endif
+
     return m_resolvedLocalStoragePath;
 }
 

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (290862 => 290863)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2022-03-05 06:02:13 UTC (rev 290862)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2022-03-05 07:22:15 UTC (rev 290863)
@@ -1852,11 +1852,6 @@
         // FIXME: SandboxExtension::createHandleForReadWriteDirectory resolves the directory, but that has already been done. Remove this duplicate work.
         if (auto handle = SandboxExtension::createHandleForReadWriteDirectory(directory))
             networkSessionParameters.localStorageDirectoryExtensionHandle = WTFMove(*handle);
-#if PLATFORM(IOS_FAMILY)
-        // FIXME: we should move file system operations to background thread.
-        FileSystem::makeAllDirectories(directory);
-        FileSystem::excludeFromBackup(directory);
-#endif
     }
 
     if (auto directory = resolvedIndexedDBDatabaseDirectory(); !directory.isEmpty()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to