Title: [257041] trunk/Source/WebKit
Revision
257041
Author
cdu...@apple.com
Date
2020-02-19 22:08:12 -0800 (Wed, 19 Feb 2020)

Log Message

Resources larger than 10MB are not stored in the disk cache
https://bugs.webkit.org/show_bug.cgi?id=207967
<rdar://problem/59572084>

Reviewed by Darin Adler.

This patch makes two policy changes to our disk cache:
1. The capacity of the disk cache is now doubled. Based on available disk space, it could
   previously use up to 500MB of disk space. The limit is now 1GB.
2. The per cache-entry limit is raised from 10MB to 1/8 of the disk cache capacity (so
   up to 128MB based on new maximum capacity).

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::didReceiveBuffer):
* Shared/CacheModel.cpp:
(WebKit::calculateURLCacheSizes):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (257040 => 257041)


--- trunk/Source/WebKit/ChangeLog	2020-02-20 05:36:56 UTC (rev 257040)
+++ trunk/Source/WebKit/ChangeLog	2020-02-20 06:08:12 UTC (rev 257041)
@@ -1,3 +1,22 @@
+2020-02-19  Chris Dumez  <cdu...@apple.com>
+
+        Resources larger than 10MB are not stored in the disk cache
+        https://bugs.webkit.org/show_bug.cgi?id=207967
+        <rdar://problem/59572084>
+
+        Reviewed by Darin Adler.
+
+        This patch makes two policy changes to our disk cache:
+        1. The capacity of the disk cache is now doubled. Based on available disk space, it could
+           previously use up to 500MB of disk space. The limit is now 1GB.
+        2. The per cache-entry limit is raised from 10MB to 1/8 of the disk cache capacity (so
+           up to 128MB based on new maximum capacity).
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::didReceiveBuffer):
+        * Shared/CacheModel.cpp:
+        (WebKit::calculateURLCacheSizes):
+
 2020-02-19  Maciej Stachowiak  <m...@apple.com>
 
         Use consistent capitalization and spacing in process-related feature names

Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (257040 => 257041)


--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2020-02-20 05:36:56 UTC (rev 257040)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2020-02-20 06:08:12 UTC (rev 257041)
@@ -584,8 +584,8 @@
     ASSERT(!m_cacheEntryForValidation);
 
     if (m_bufferedDataForCache) {
-        // Prevent memory growth in case of streaming data.
-        const size_t maximumCacheBufferSize = 10 * 1024 * 1024;
+        // Prevent memory growth in case of streaming data and limit size of entries in the cache.
+        const size_t maximumCacheBufferSize = m_cache->capacity() / 8;
         if (m_bufferedDataForCache->size() + buffer->size() <= maximumCacheBufferSize)
             m_bufferedDataForCache->append(buffer.get());
         else

Modified: trunk/Source/WebKit/Shared/CacheModel.cpp (257040 => 257041)


--- trunk/Source/WebKit/Shared/CacheModel.cpp	2020-02-20 05:36:56 UTC (rev 257040)
+++ trunk/Source/WebKit/Shared/CacheModel.cpp	2020-02-20 06:08:12 UTC (rev 257041)
@@ -185,17 +185,17 @@
 
         // Disk cache capacity (in bytes)
         if (diskFreeSize >= 16384)
+            urlCacheDiskCapacity = 1 * GB;
+        else if (diskFreeSize >= 8192)
             urlCacheDiskCapacity = 500 * MB;
-        else if (diskFreeSize >= 8192)
+        else if (diskFreeSize >= 4096)
             urlCacheDiskCapacity = 250 * MB;
-        else if (diskFreeSize >= 4096)
-            urlCacheDiskCapacity = 125 * MB;
         else if (diskFreeSize >= 2048)
-            urlCacheDiskCapacity = 100 * MB;
+            urlCacheDiskCapacity = 200 * MB;
         else if (diskFreeSize >= 1024)
-            urlCacheDiskCapacity = 75 * MB;
+            urlCacheDiskCapacity = 150 * MB;
         else
-            urlCacheDiskCapacity = 50 * MB;
+            urlCacheDiskCapacity = 100 * MB;
 
         break;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to