Changeset 50213 in webkit


Ignore:
Timestamp:
Oct 28, 2009 4:44:23 AM (15 years ago)
Author:
zecke@webkit.org
Message:

Document a feature of the m_liveDecodedResources list.

https://bugs.webkit.org/show_bug.cgi?id=30209
Reviewed by Darin Adler.

Document a feature of the m_liveDecodedResources list.
https://bugs.webkit.org/show_bug.cgi?id=30209

The code made the assumption that the list is sorted by
the m_lastDecodedAccessTime property of the CachedResource.
The above is not true when CachedResource::setDecodedSize
is called and the item is inserted the first time. In this
case the m_lastDecodedAccessTime is still zero and the
m_liveDecodedResources list becomes unsorted.

It is impossible that Cache::pruneLiveResources will
stop to process the list too early due this feature and
the alternatives of updating m_lastDecodedAccessTime in
CachedResource::setDecodedSize or changing the insert
to search the right position have a negative impact on
performance. The best solution for now is to document
this feature.

  • loader/Cache.cpp:

(WebCore::Cache::pruneLiveResources):

  • loader/CachedResource.cpp:

(WebCore::CachedResource::setDecodedSize):

Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r50208 r50213  
     12009-10-26  Holger Hans Peter Freyther  <zecke@selfish.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Document a feature of the m_liveDecodedResources list.
     6        https://bugs.webkit.org/show_bug.cgi?id=30209
     7
     8        The code made the assumption that the list is sorted by
     9        the m_lastDecodedAccessTime property of the CachedResource.
     10        The above is not true when CachedResource::setDecodedSize
     11        is called and the item is inserted the first time. In this
     12        case the m_lastDecodedAccessTime is still zero and the
     13        m_liveDecodedResources list becomes unsorted.
     14
     15        It is impossible that Cache::pruneLiveResources will
     16        stop to process the list too early due this feature and
     17        the alternatives of updating m_lastDecodedAccessTime in
     18        CachedResource::setDecodedSize or changing the insert
     19        to search the right position have a negative impact on
     20        performance. The best solution for now is to document
     21        this feature.
     22
     23        * loader/Cache.cpp:
     24        (WebCore::Cache::pruneLiveResources):
     25        * loader/CachedResource.cpp:
     26        (WebCore::CachedResource::setDecodedSize):
     27
    1282009-10-28  Xan Lopez  <xlopez@igalia.com>
    229
  • trunk/WebCore/loader/Cache.cpp

    r49212 r50213  
    276276    // Destroy any decoded data in live objects that we can.
    277277    // Start from the tail, since this is the least recently accessed of the objects.
     278
     279    // The list might not be sorted by the m_lastDecodedAccessTime. The impact
     280    // of this weaker invariant is minor as the below if statement to check the
     281    // elapsedTime will evaluate to false as the currentTime will be a lot
     282    // greater than the current->m_lastDecodedAccessTime.
     283    // For more details see: https://bugs.webkit.org/show_bug.cgi?id=30209
    278284    CachedResource* current = m_liveDecodedResources.m_tail;
    279285    while (current) {
  • trunk/WebCore/loader/CachedResource.cpp

    r47624 r50213  
    243243       
    244244        // Insert into or remove from the live decoded list if necessary.
     245        // When inserting into the LiveDecodedResourcesList it is possible
     246        // that the m_lastDecodedAccessTime is still zero or smaller than
     247        // the m_lastDecodedAccessTime of the current list head. This is a
     248        // violation of the invariant that the list is to be kept sorted
     249        // by access time. The weakening of the invariant does not pose
     250        // a problem. For more details please see: https://bugs.webkit.org/show_bug.cgi?id=30209
    245251        if (m_decodedSize && !m_inLiveDecodedResourcesList && hasClients())
    246252            cache()->insertInLiveDecodedResourcesList(this);
Note: See TracChangeset for help on using the changeset viewer.