Changeset 91725 in webkit
- Timestamp:
- Jul 25, 2011 4:57:43 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r91723 r91725 1 2011-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 1 16 2011-07-25 Chris Rogers <crogers@google.com> 2 17 -
trunk/Source/WebCore/loader/cache/CachedResource.h
r91384 r91725 183 183 184 184 bool canDelete() const { return !hasClients() && !m_request && !m_preloadCount && !m_handleCount && !m_resourceToRevalidate && !m_proxyResource; } 185 bool hasOneHandle() const { return m_handleCount == 1; }186 185 187 186 bool isExpired() const; -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r91626 r91725 87 87 : m_document(document) 88 88 , m_requestCount(0) 89 , m_garbageCollectDocumentResourcesTimer(this, &CachedResourceLoader::garbageCollectDocumentResourcesTimerFired)90 89 , m_autoLoadImages(true) 91 90 , m_loadFinishing(false) … … 574 573 frame()->loader()->loadDone(); 575 574 performPostLoadActions(); 576 577 if (!m_garbageCollectDocumentResourcesTimer.isActive())578 m_garbageCollectDocumentResourcesTimer.startOneShot(0);579 }580 581 // Garbage collecting m_documentResources is a workaround for the582 // CachedResourceHandles on the RHS being strong references. Ideally this583 // would be a weak map, however CachedResourceHandles perform additional584 // bookkeeping on CachedResources, so instead pseudo-GC them -- when the585 // reference count reaches 1, m_documentResources is the only reference, so586 // 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);600 575 } 601 576 -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.h
r91626 r91725 31 31 #include "CachePolicy.h" 32 32 #include "ResourceLoadPriority.h" 33 #include "Timer.h"34 33 #include <wtf/Deque.h> 35 34 #include <wtf/HashMap.h> … … 119 118 bool canRequest(CachedResource::Type, const KURL&, bool forPreload = false); 120 119 121 void garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>*);122 120 void performPostLoadActions(); 123 121 … … 136 134 Deque<PendingPreload> m_pendingPreloads; 137 135 138 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer;139 140 136 //29 bits left 141 137 bool m_autoLoadImages : 1;
Note: See TracChangeset
for help on using the changeset viewer.