Title: [91725] trunk/Source/WebCore
Revision
91725
Author
[email protected]
Date
2011-07-25 16:57:43 -0700 (Mon, 25 Jul 2011)

Log 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 <[email protected]> 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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (91724 => 91725)


--- trunk/Source/WebCore/ChangeLog	2011-07-25 23:56:52 UTC (rev 91724)
+++ trunk/Source/WebCore/ChangeLog	2011-07-25 23:57:43 UTC (rev 91725)
@@ -1,3 +1,18 @@
+2011-07-25  Scott Graham  <[email protected]>
+
+        REGRESSION (r39725?): Resources removed from document can not be freed until the document is deleted
+        https://bugs.webkit.org/show_bug.cgi?id=61006
+
+        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:
+
 2011-07-25  Chris Rogers  <[email protected]>
 
         Deprecate AudioBufferSourceNode .looping attribute and implement .loop

Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (91724 => 91725)


--- trunk/Source/WebCore/loader/cache/CachedResource.h	2011-07-25 23:56:52 UTC (rev 91724)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h	2011-07-25 23:57:43 UTC (rev 91725)
@@ -182,7 +182,6 @@
     CachedMetadata* cachedMetadata(unsigned dataTypeID) const;
 
     bool canDelete() const { return !hasClients() && !m_request && !m_preloadCount && !m_handleCount && !m_resourceToRevalidate && !m_proxyResource; }
-    bool hasOneHandle() const { return m_handleCount == 1; }
 
     bool isExpired() const;
 

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (91724 => 91725)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2011-07-25 23:56:52 UTC (rev 91724)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2011-07-25 23:57:43 UTC (rev 91725)
@@ -86,7 +86,6 @@
 CachedResourceLoader::CachedResourceLoader(Document* document)
     : m_document(document)
     , m_requestCount(0)
-    , m_garbageCollectDocumentResourcesTimer(this, &CachedResourceLoader::garbageCollectDocumentResourcesTimerFired)
     , m_autoLoadImages(true)
     , m_loadFinishing(false)
     , m_allowStaleResources(false)
@@ -573,32 +572,8 @@
     if (frame())
         frame()->loader()->loadDone();
     performPostLoadActions();
-
-    if (!m_garbageCollectDocumentResourcesTimer.isActive())
-        m_garbageCollectDocumentResourcesTimer.startOneShot(0);
 }
 
-// Garbage collecting m_documentResources is a workaround for the
-// CachedResourceHandles on the RHS being strong references. Ideally this
-// would be a weak map, however CachedResourceHandles perform additional
-// bookkeeping on CachedResources, so instead pseudo-GC them -- when the
-// reference count reaches 1, m_documentResources is the only reference, so
-// remove it from the map.
-void CachedResourceLoader::garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>* timer)
-{
-    ASSERT_UNUSED(timer, timer == &m_garbageCollectDocumentResourcesTimer);
-
-    Vector<String, 10> toDelete;
-
-    for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != m_documentResources.end(); ++it) {
-        if (it->second->hasOneHandle())
-            toDelete.append(it->first);
-    }
-
-    for (Vector<String, 10>::const_iterator idel = toDelete.begin(); idel != toDelete.end(); ++idel)
-        m_documentResources.remove(*idel);
-}
-
 void CachedResourceLoader::performPostLoadActions()
 {
     checkForPendingPreloads();

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.h (91724 => 91725)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.h	2011-07-25 23:56:52 UTC (rev 91724)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.h	2011-07-25 23:57:43 UTC (rev 91725)
@@ -30,7 +30,6 @@
 #include "CachedResourceHandle.h"
 #include "CachePolicy.h"
 #include "ResourceLoadPriority.h"
-#include "Timer.h"
 #include <wtf/Deque.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
@@ -118,7 +117,6 @@
     void notifyLoadedFromMemoryCache(CachedResource*);
     bool canRequest(CachedResource::Type, const KURL&, bool forPreload = false);
 
-    void garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>*);
     void performPostLoadActions();
     
     HashSet<String> m_validatedURLs;
@@ -135,8 +133,6 @@
     };
     Deque<PendingPreload> m_pendingPreloads;
 
-    Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer;
-    
     //29 bits left
     bool m_autoLoadImages : 1;
     bool m_loadFinishing : 1;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to