Title: [180947] trunk/Source/WebKit2
- Revision
- 180947
- Author
- an...@apple.com
- Date
- 2015-03-03 12:10:07 -0800 (Tue, 03 Mar 2015)
Log Message
Cache shrink leaves behind empty partition directories
https://bugs.webkit.org/show_bug.cgi?id=142217
Reviewed by Andreas Kling.
* NetworkProcess/cache/NetworkCacheFileSystemPosix.h:
(WebKit::traverseCacheFiles):
No need for std::function.
* NetworkProcess/cache/NetworkCacheStorageCocoa.mm:
(WebKit::NetworkCacheStorage::shrinkIfNeeded):
After shrink traverse through the partition directories and try to delete them.
System knows if they are actually empty.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (180946 => 180947)
--- trunk/Source/WebKit2/ChangeLog 2015-03-03 19:56:32 UTC (rev 180946)
+++ trunk/Source/WebKit2/ChangeLog 2015-03-03 20:10:07 UTC (rev 180947)
@@ -1,3 +1,21 @@
+2015-03-03 Antti Koivisto <an...@apple.com>
+
+ Cache shrink leaves behind empty partition directories
+ https://bugs.webkit.org/show_bug.cgi?id=142217
+
+ Reviewed by Andreas Kling.
+
+ * NetworkProcess/cache/NetworkCacheFileSystemPosix.h:
+ (WebKit::traverseCacheFiles):
+
+ No need for std::function.
+
+ * NetworkProcess/cache/NetworkCacheStorageCocoa.mm:
+ (WebKit::NetworkCacheStorage::shrinkIfNeeded):
+
+ After shrink traverse through the partition directories and try to delete them.
+ System knows if they are actually empty.
+
2015-03-03 Anders Carlsson <ander...@apple.com>
Use the correct display name for website data for local files
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystemPosix.h (180946 => 180947)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystemPosix.h 2015-03-03 19:56:32 UTC (rev 180946)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystemPosix.h 2015-03-03 20:10:07 UTC (rev 180947)
@@ -53,7 +53,8 @@
closedir(dir);
}
-inline void traverseCacheFiles(const String& cachePath, std::function<void (const String& fileName, const String& partitionPath)> function)
+template <typename Function>
+inline void traverseCacheFiles(const String& cachePath, const Function& function)
{
traverseDirectory(cachePath, DT_DIR, [&cachePath, &function](const String& subdirName) {
String partitionPath = WebCore::pathByAppendingComponent(cachePath, subdirName);
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm (180946 => 180947)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm 2015-03-03 19:56:32 UTC (rev 180946)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm 2015-03-03 20:10:07 UTC (rev 180947)
@@ -695,6 +695,13 @@
m_contentsFilter.remove(shortHash);
});
});
+
+ // Let system figure out if they are really empty.
+ traverseDirectory(cachePath, DT_DIR, [&cachePath](const String& subdirName) {
+ auto partitionPath = WebCore::pathByAppendingComponent(cachePath, subdirName);
+ WebCore::deleteEmptyDirectory(partitionPath);
+ });
+
m_shrinkInProgress = false;
LOG(NetworkCacheStorage, "(NetworkProcess) cache shrink completed approximateSize=%d", static_cast<size_t>(m_approximateSize));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes