Changeset 87344 in webkit


Ignore:
Timestamp:
May 25, 2011, 6:07:57 PM (14 years ago)
Author:
jamesr@google.com
Message:

2011-05-25 James Robinson <jamesr@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):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87343 r87344  
     12011-05-25  James Robinson  <jamesr@chromium.org>
     2
     3        Reviewed by Geoffrey Garen
     4
     5        CachedResource overhead size calculation ignores the actual size of the URL
     6        https://bugs.webkit.org/show_bug.cgi?id=61481
     7
     8        CachedResource::overheadSize is used to determine the size of an entry in the memory cache to know when to evict
     9        it.  When the resource is a large data: URL, for example representing image or audio data, the URL size itself
     10        can be significant.
     11
     12        This patch uses an estimate of actual number of bytes used by the URL that is valid for ASCII urls and close for
     13        other types of strings instead of a fixed number.
     14
     15        * loader/cache/CachedResource.cpp:
     16        (WebCore::CachedResource::overheadSize):
     17
    1182011-05-25  Oliver Hunt  <oliver@apple.com>
    219
  • trunk/Source/WebCore/loader/cache/CachedResource.cpp

    r87239 r87344  
    608608unsigned CachedResource::overheadSize() const
    609609{
    610     return sizeof(CachedResource) + m_response.memoryUsage() + 576;
    611     /*
    612         576 = 192 +                   // average size of m_url
    613               384;                    // average size of m_clients hash map
    614     */
     610    static const int kAverageClientsHashMapSize = 384;
     611    return sizeof(CachedResource) + m_response.memoryUsage() + kAverageClientsHashMapSize + m_resourceRequest.url().string().length() * 2;
    615612}
    616613   
Note: See TracChangeset for help on using the changeset viewer.