Title: [179703] trunk/Source/WebKit2
Revision
179703
Author
[email protected]
Date
2015-02-05 13:46:11 -0800 (Thu, 05 Feb 2015)

Log Message

Use deleteFile() in NetworkCacheStorageCocoa.mm
https://bugs.webkit.org/show_bug.cgi?id=141299

Reviewed by Antti Koivisto.

Use deleteFile() in NetworkCacheStorageCocoa.mm to simplify the code
a bit.

* NetworkProcess/cache/NetworkCacheStorageCocoa.mm:
(WebKit::NetworkCacheStorage::removeEntry):
(WebKit::NetworkCacheStorage::clear):
(WebKit::NetworkCacheStorage::shrinkIfNeeded):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (179702 => 179703)


--- trunk/Source/WebKit2/ChangeLog	2015-02-05 21:29:19 UTC (rev 179702)
+++ trunk/Source/WebKit2/ChangeLog	2015-02-05 21:46:11 UTC (rev 179703)
@@ -1,3 +1,18 @@
+2015-02-05  Chris Dumez  <[email protected]>
+
+        Use deleteFile() in NetworkCacheStorageCocoa.mm
+        https://bugs.webkit.org/show_bug.cgi?id=141299
+
+        Reviewed by Antti Koivisto.
+
+        Use deleteFile() in NetworkCacheStorageCocoa.mm to simplify the code
+        a bit.
+
+        * NetworkProcess/cache/NetworkCacheStorageCocoa.mm:
+        (WebKit::NetworkCacheStorage::removeEntry):
+        (WebKit::NetworkCacheStorage::clear):
+        (WebKit::NetworkCacheStorage::shrinkIfNeeded):
+
 2015-02-04  Antti Koivisto  <[email protected]>
 
         Avoid copying std::functions across threads in NetworkCacheStorage

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm (179702 => 179703)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm	2015-02-05 21:29:19 UTC (rev 179702)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm	2015-02-05 21:46:11 UTC (rev 179703)
@@ -345,8 +345,7 @@
 
     StringCapture filePathCapture(filePathForKey(key, m_directoryPath));
     dispatch_async(m_ioQueue.get(), [this, filePathCapture] {
-        CString path = WebCore::fileSystemRepresentation(filePathCapture.string());
-        unlink(path.data());
+        WebCore::deleteFile(filePathCapture.string());
         if (m_approximateEntryCount)
             --m_approximateEntryCount;
     });
@@ -550,8 +549,7 @@
         traverseDirectory(directoryPath, DT_DIR, [&directoryPath](const String& subdirName) {
             String subdirPath = WebCore::pathByAppendingComponent(directoryPath, subdirName);
             traverseDirectory(subdirPath, DT_REG, [&subdirPath](const String& fileName) {
-                String filePath = WebCore::pathByAppendingComponent(subdirPath, fileName);
-                unlink(WebCore::fileSystemRepresentation(filePath).data());
+                WebCore::deleteFile(WebCore::pathByAppendingComponent(subdirPath, fileName));
             });
             rmdir(WebCore::fileSystemRepresentation(subdirPath).data());
         });
@@ -578,15 +576,13 @@
         String cachePath = cachePathCapture.string();
         size_t foundEntryCount = 0;
         size_t deletedCount = 0;
-        traverseCacheFiles(cachePath, [this, &foundEntryCount, &deletedCount](const String& fileName, const String& directory) {
-            String partitionPath = WebCore::pathByAppendingComponent(directory, fileName);
-            CString path = WebCore::fileSystemRepresentation(partitionPath);
+        traverseCacheFiles(cachePath, [this, &foundEntryCount, &deletedCount](const String& fileName, const String& partitionPath) {
             ++foundEntryCount;
             if (foundEntryCount % everyNthResourceToDelete)
                 return;
             ++deletedCount;
 
-            unlink(path.data());
+            WebCore::deleteFile(WebCore::pathByAppendingComponent(partitionPath, fileName));
 
             NetworkCacheKey::HashType hash;
             if (!NetworkCacheKey::stringToHash(fileName, hash))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to