Changeset 91725 in webkit


Ignore:
Timestamp:
Jul 25, 2011 4:57:43 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

REGRESSION (r39725?): Resources removed from document can not be freed until the document is deleted
https://bugs.webkit.org/show_bug.cgi?id=61006

Patch by Scott Graham <scottmg@chromium.org> on 2011-07-25
Reviewed by Nate Chapin.

Rollback previous patch. Occasional crashes seen caused by
CachedResource being deleted twice.

  • loader/cache/CachedResourceLoader.cpp:

(WebCore::CachedResourceLoader::CachedResourceLoader):
(WebCore::CachedResourceLoader::loadDone):

  • loader/cache/CachedResourceLoader.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r91723 r91725  
     12011-07-25  Scott Graham  <scottmg@chromium.org>
     2
     3        REGRESSION (r39725?): Resources removed from document can not be freed until the document is deleted
     4        https://bugs.webkit.org/show_bug.cgi?id=61006
     5
     6        Reviewed by Nate Chapin.
     7
     8        Rollback previous patch. Occasional crashes seen caused by
     9        CachedResource being deleted twice.
     10
     11        * loader/cache/CachedResourceLoader.cpp:
     12        (WebCore::CachedResourceLoader::CachedResourceLoader):
     13        (WebCore::CachedResourceLoader::loadDone):
     14        * loader/cache/CachedResourceLoader.h:
     15
    1162011-07-25  Chris Rogers  <crogers@google.com>
    217
  • trunk/Source/WebCore/loader/cache/CachedResource.h

    r91384 r91725  
    183183
    184184    bool canDelete() const { return !hasClients() && !m_request && !m_preloadCount && !m_handleCount && !m_resourceToRevalidate && !m_proxyResource; }
    185     bool hasOneHandle() const { return m_handleCount == 1; }
    186185
    187186    bool isExpired() const;
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp

    r91626 r91725  
    8787    : m_document(document)
    8888    , m_requestCount(0)
    89     , m_garbageCollectDocumentResourcesTimer(this, &CachedResourceLoader::garbageCollectDocumentResourcesTimerFired)
    9089    , m_autoLoadImages(true)
    9190    , m_loadFinishing(false)
     
    574573        frame()->loader()->loadDone();
    575574    performPostLoadActions();
    576 
    577     if (!m_garbageCollectDocumentResourcesTimer.isActive())
    578         m_garbageCollectDocumentResourcesTimer.startOneShot(0);
    579 }
    580 
    581 // Garbage collecting m_documentResources is a workaround for the
    582 // CachedResourceHandles on the RHS being strong references. Ideally this
    583 // would be a weak map, however CachedResourceHandles perform additional
    584 // bookkeeping on CachedResources, so instead pseudo-GC them -- when the
    585 // reference count reaches 1, m_documentResources is the only reference, so
    586 // remove it from the map.
    587 void CachedResourceLoader::garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>* timer)
    588 {
    589     ASSERT_UNUSED(timer, timer == &m_garbageCollectDocumentResourcesTimer);
    590 
    591     Vector<String, 10> toDelete;
    592 
    593     for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != m_documentResources.end(); ++it) {
    594         if (it->second->hasOneHandle())
    595             toDelete.append(it->first);
    596     }
    597 
    598     for (Vector<String, 10>::const_iterator idel = toDelete.begin(); idel != toDelete.end(); ++idel)
    599         m_documentResources.remove(*idel);
    600575}
    601576
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.h

    r91626 r91725  
    3131#include "CachePolicy.h"
    3232#include "ResourceLoadPriority.h"
    33 #include "Timer.h"
    3433#include <wtf/Deque.h>
    3534#include <wtf/HashMap.h>
     
    119118    bool canRequest(CachedResource::Type, const KURL&, bool forPreload = false);
    120119
    121     void garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>*);
    122120    void performPostLoadActions();
    123121   
     
    136134    Deque<PendingPreload> m_pendingPreloads;
    137135
    138     Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer;
    139    
    140136    //29 bits left
    141137    bool m_autoLoadImages : 1;
Note: See TracChangeset for help on using the changeset viewer.