Title: [87344] trunk/Source/WebCore
Revision
87344
Author
jam...@google.com
Date
2011-05-25 18:07:57 -0700 (Wed, 25 May 2011)

Log Message

2011-05-25  James Robinson  <jam...@chromium.org>

        Reviewed by Geoffrey Garen

        CachedResource overhead size calculation ignores the actual size of the URL
        https://bugs.webkit.org/show_bug.cgi?id=61481

        CachedResource::overheadSize is used to determine the size of an entry in the memory cache to know when to evict
        it.  When the resource is a large data: URL, for example representing image or audio data, the URL size itself
        can be significant.

        This patch uses an estimate of actual number of bytes used by the URL that is valid for ASCII urls and close for
        other types of strings instead of a fixed number.

        * loader/cache/CachedResource.cpp:
        (WebCore::CachedResource::overheadSize):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87343 => 87344)


--- trunk/Source/WebCore/ChangeLog	2011-05-26 01:01:16 UTC (rev 87343)
+++ trunk/Source/WebCore/ChangeLog	2011-05-26 01:07:57 UTC (rev 87344)
@@ -1,3 +1,20 @@
+2011-05-25  James Robinson  <jam...@chromium.org>
+
+        Reviewed by Geoffrey Garen
+
+        CachedResource overhead size calculation ignores the actual size of the URL
+        https://bugs.webkit.org/show_bug.cgi?id=61481
+
+        CachedResource::overheadSize is used to determine the size of an entry in the memory cache to know when to evict
+        it.  When the resource is a large data: URL, for example representing image or audio data, the URL size itself
+        can be significant.
+
+        This patch uses an estimate of actual number of bytes used by the URL that is valid for ASCII urls and close for
+        other types of strings instead of a fixed number.
+
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::overheadSize):
+
 2011-05-25  Oliver Hunt  <oli...@apple.com>
 
         Reviewed by Geoffrey Garen.

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (87343 => 87344)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2011-05-26 01:01:16 UTC (rev 87343)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2011-05-26 01:07:57 UTC (rev 87344)
@@ -607,11 +607,8 @@
 
 unsigned CachedResource::overheadSize() const
 {
-    return sizeof(CachedResource) + m_response.memoryUsage() + 576;
-    /*
-        576 = 192 +                   // average size of m_url
-              384;                    // average size of m_clients hash map
-    */
+    static const int kAverageClientsHashMapSize = 384;
+    return sizeof(CachedResource) + m_response.memoryUsage() + kAverageClientsHashMapSize + m_resourceRequest.url().string().length() * 2;
 }
     
 void CachedResource::setLoadPriority(ResourceLoadPriority loadPriority) 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to