Unreviewed, rolling out r118618 and r119353.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Jun 2012 23:03:25 +0000 (23:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Jun 2012 23:03:25 +0000 (23:03 +0000)
http://trac.webkit.org/changeset/118618
http://trac.webkit.org/changeset/119353
https://bugs.webkit.org/show_bug.cgi?id=88720

Caused at least 30 different crashes on ClusterFuzz (Requested
by inferno-sec on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-06-09

Source/WebCore:

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::checkForHTTPStatusCodeError):
* loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::allClientsRemoved):
* loader/cache/CachedFont.cpp:
(WebCore::CachedFont::allClientsRemoved):
* loader/cache/CachedFont.h:
(WebCore::CachedFontClient::resourceClientType):
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::removeClientForRenderer):
(WebCore):
(WebCore::CachedImage::allClientsRemoved):
(WebCore::CachedImage::lookupOrCreateImageForRenderer):
* loader/cache/CachedImage.h:
(CachedImage):
(WebCore::CachedImageClient::resourceClientType):
* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::allClientsRemoved):
(WebCore):
* loader/cache/CachedRawResource.h:
(CachedRawResource):
(WebCore::CachedRawResourceClient::resourceClientType):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::removeClient):
* loader/cache/CachedResource.h:
(WebCore::CachedResource::allClientsRemoved):
* loader/cache/CachedResourceClient.h:
(WebCore::CachedResourceClient::resourceClientType):
* loader/cache/CachedSVGDocument.h:
(WebCore::CachedSVGDocumentClient::resourceClientType):
* loader/cache/CachedScript.cpp:
(WebCore::CachedScript::allClientsRemoved):
* loader/cache/CachedStyleSheetClient.h:
(WebCore::CachedStyleSheetClient::resourceClientType):
* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::removeClient):
* rendering/style/StyleCachedImageSet.cpp:
(WebCore::StyleCachedImageSet::removeClient):
* svg/graphics/SVGImageCache.cpp:
(WebCore::SVGImageCache::~SVGImageCache):
(WebCore::SVGImageCache::removeRendererFromCache):
(WebCore::SVGImageCache::setRequestedSizeAndScales):
(WebCore::SVGImageCache::requestedSizeAndScales):
(WebCore::SVGImageCache::lookupOrCreateBitmapImageForRenderer):
* svg/graphics/SVGImageCache.h:
(WebCore):
(SVGImageCache):

LayoutTests:

* http/tests/cache/cancel-in-progress-load-expected.txt: Removed.
* http/tests/cache/cancel-in-progress-load.html: Removed.
* http/tests/misc/write-while-waiting.html:
* svg/as-image/svg-image-leak-cached-data-expected.txt: Removed.
* svg/as-image/svg-image-leak-cached-data.html: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119918 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/cache/cancel-in-progress-load-expected.txt [deleted file]
LayoutTests/http/tests/cache/cancel-in-progress-load.html [deleted file]
LayoutTests/http/tests/misc/write-while-waiting.html
LayoutTests/svg/as-image/svg-image-leak-cached-data-expected.txt [deleted file]
LayoutTests/svg/as-image/svg-image-leak-cached-data.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp
Source/WebCore/loader/cache/CachedFont.cpp
Source/WebCore/loader/cache/CachedFont.h
Source/WebCore/loader/cache/CachedImage.cpp
Source/WebCore/loader/cache/CachedImage.h
Source/WebCore/loader/cache/CachedRawResource.cpp
Source/WebCore/loader/cache/CachedRawResource.h
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/loader/cache/CachedResource.h
Source/WebCore/loader/cache/CachedResourceClient.h
Source/WebCore/loader/cache/CachedSVGDocument.h
Source/WebCore/loader/cache/CachedScript.cpp
Source/WebCore/loader/cache/CachedStyleSheetClient.h
Source/WebCore/rendering/style/StyleCachedImage.cpp
Source/WebCore/rendering/style/StyleCachedImageSet.cpp
Source/WebCore/svg/graphics/SVGImageCache.cpp
Source/WebCore/svg/graphics/SVGImageCache.h

index 797d819..de39090 100644 (file)
@@ -1,3 +1,19 @@
+2012-06-09  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r118618 and r119353.
+        http://trac.webkit.org/changeset/118618
+        http://trac.webkit.org/changeset/119353
+        https://bugs.webkit.org/show_bug.cgi?id=88720
+
+        Caused at least 30 different crashes on ClusterFuzz (Requested
+        by inferno-sec on #webkit).
+
+        * http/tests/cache/cancel-in-progress-load-expected.txt: Removed.
+        * http/tests/cache/cancel-in-progress-load.html: Removed.
+        * http/tests/misc/write-while-waiting.html:
+        * svg/as-image/svg-image-leak-cached-data-expected.txt: Removed.
+        * svg/as-image/svg-image-leak-cached-data.html: Removed.
+
 2012-06-09  Ryosuke Niwa  <rniwa@webkit.org>
 
         Fix Chromium test expectations after my previous commit (r119916).
diff --git a/LayoutTests/http/tests/cache/cancel-in-progress-load-expected.txt b/LayoutTests/http/tests/cache/cancel-in-progress-load-expected.txt
deleted file mode 100644 (file)
index e379617..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-http://127.0.0.1:8000/cache/resources/random.cgi - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/cache/resources/random.cgi, main document URL http://127.0.0.1:8000/cache/cancel-in-progress-load.html, http method GET> redirectResponse (null)
-<unknown> - didFinishLoading
-http://127.0.0.1:8000/cache/resources/random.cgi - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/cache/resources/random.cgi, http status code 200>
-<unknown> - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -999, failing URL "http://127.0.0.1:8000/navigation/resources/slow-resource.pl">
-http://127.0.0.1:8000/cache/resources/random.cgi - didFinishLoading
-
diff --git a/LayoutTests/http/tests/cache/cancel-in-progress-load.html b/LayoutTests/http/tests/cache/cancel-in-progress-load.html
deleted file mode 100644 (file)
index 23c070d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<html>
-<body>
-<img id="img" onload="finish()"; onerror="finish();" src="../navigation/resources/slow-resource.pl"></img>
-<script>
-if (window.layoutTestController) {
-    layoutTestController.dumpAsText();
-    layoutTestController.waitUntilDone();
-    layoutTestController.dumpResourceLoadCallbacks();
-}
-
-function finish() {
-     (window.layoutTestController)
-        layoutTestController.notifyDone();
-}
-
-document.getElementById("img").src = "resources/random.cgi";
-</script>
-</body>
-</html>
index 7bbc0f9..0c715d8 100644 (file)
@@ -2,12 +2,10 @@
 <body>
 FAIL
 <script>
-if (window.layoutTestController) {
+if (window.layoutTestController)
     layoutTestController.dumpAsText();
-    layoutTestController.waitUntilDone();
-}
 
-setTimeout("document.write('PASS');document.close(); if (window.layoutTestController) layoutTestController.notifyDone();", 100);
+setTimeout("document.write('PASS');document.close();", 100);
 </script>
 <script src="resources/script-slow1.pl"></script>
 </body>
diff --git a/LayoutTests/svg/as-image/svg-image-leak-cached-data-expected.txt b/LayoutTests/svg/as-image/svg-image-leak-cached-data-expected.txt
deleted file mode 100644 (file)
index 15e3711..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-This test checks if SVGImageCache leaks SVG image data as reported in https://bugs.webkit.org/show_bug.cgi?id=87792. Its layout has no particular meaning. The test will cause crash of debug version when leaks of SVG image data is detected.
-
-Note: the code detects leaks of SVG image data on destruction of SVGImageCache, which doesn't work on platforms that DumpRenderTree leaks the cache itself.
-
-
diff --git a/LayoutTests/svg/as-image/svg-image-leak-cached-data.html b/LayoutTests/svg/as-image/svg-image-leak-cached-data.html
deleted file mode 100644 (file)
index 0752243..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<html>
-<head>
-<script>
-if (window.layoutTestController) {
-    layoutTestController.dumpAsText();
-    layoutTestController.waitUntilDone();
-}
-
-var count = 0;
-function test() {
-    var img = document.getElementById('img');
-    document.body.replaceChild(img.cloneNode(), img);
-    if (++count < 10)
-        setTimeout(test, 0);
-    else if (window.layoutTestController)
-        layoutTestController.notifyDone();
-}
-</script>
-</head>
-
-<body onload='test()'>
-    <p>This test checks if SVGImageCache leaks SVG image data as reported in
-    https://bugs.webkit.org/show_bug.cgi?id=87792. Its layout has no particular meaning.
-    The test will cause crash of debug version when leaks of SVG image data is detected.</p>
-    <p>Note: the code detects leaks of SVG image data on destruction of SVGImageCache,
-    which doesn't work on platforms that DumpRenderTree leaks the cache itself.</p>
-    <img id='img' src='resources/circle.svg'>
-</body>
-</html>
index d3ee270..071ad0d 100644 (file)
@@ -1,3 +1,61 @@
+2012-06-09  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r118618 and r119353.
+        http://trac.webkit.org/changeset/118618
+        http://trac.webkit.org/changeset/119353
+        https://bugs.webkit.org/show_bug.cgi?id=88720
+
+        Caused at least 30 different crashes on ClusterFuzz (Requested
+        by inferno-sec on #webkit).
+
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::checkForHTTPStatusCodeError):
+        * loader/cache/CachedCSSStyleSheet.cpp:
+        (WebCore::CachedCSSStyleSheet::allClientsRemoved):
+        * loader/cache/CachedFont.cpp:
+        (WebCore::CachedFont::allClientsRemoved):
+        * loader/cache/CachedFont.h:
+        (WebCore::CachedFontClient::resourceClientType):
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::removeClientForRenderer):
+        (WebCore):
+        (WebCore::CachedImage::allClientsRemoved):
+        (WebCore::CachedImage::lookupOrCreateImageForRenderer):
+        * loader/cache/CachedImage.h:
+        (CachedImage):
+        (WebCore::CachedImageClient::resourceClientType):
+        * loader/cache/CachedRawResource.cpp:
+        (WebCore::CachedRawResource::allClientsRemoved):
+        (WebCore):
+        * loader/cache/CachedRawResource.h:
+        (CachedRawResource):
+        (WebCore::CachedRawResourceClient::resourceClientType):
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::removeClient):
+        * loader/cache/CachedResource.h:
+        (WebCore::CachedResource::allClientsRemoved):
+        * loader/cache/CachedResourceClient.h:
+        (WebCore::CachedResourceClient::resourceClientType):
+        * loader/cache/CachedSVGDocument.h:
+        (WebCore::CachedSVGDocumentClient::resourceClientType):
+        * loader/cache/CachedScript.cpp:
+        (WebCore::CachedScript::allClientsRemoved):
+        * loader/cache/CachedStyleSheetClient.h:
+        (WebCore::CachedStyleSheetClient::resourceClientType):
+        * rendering/style/StyleCachedImage.cpp:
+        (WebCore::StyleCachedImage::removeClient):
+        * rendering/style/StyleCachedImageSet.cpp:
+        (WebCore::StyleCachedImageSet::removeClient):
+        * svg/graphics/SVGImageCache.cpp:
+        (WebCore::SVGImageCache::~SVGImageCache):
+        (WebCore::SVGImageCache::removeRendererFromCache):
+        (WebCore::SVGImageCache::setRequestedSizeAndScales):
+        (WebCore::SVGImageCache::requestedSizeAndScales):
+        (WebCore::SVGImageCache::lookupOrCreateBitmapImageForRenderer):
+        * svg/graphics/SVGImageCache.h:
+        (WebCore):
+        (SVGImageCache):
+
 2012-06-09  Florin Malita  <fmalita@chromium.org>
 
         Fixed-position foreignObject descendants should be relative to the foreignObject viewport
index 40ea985..34b7065 100644 (file)
@@ -234,8 +234,8 @@ bool SubresourceLoader::checkForHTTPStatusCodeError()
     if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnoreHTTPStatusCodeErrors())
         return false;
 
-    m_state = Finishing;
     m_resource->error(CachedResource::LoadError);
+    m_state = Finishing;
     cancel();
     return true;
 }
index e991397..2dbe75e 100644 (file)
@@ -66,7 +66,6 @@ void CachedCSSStyleSheet::allClientsRemoved()
 {
     if (!MemoryCache::shouldMakeResourcePurgeableOnEviction() && isSafeToMakePurgeable())
         makePurgeable(true);
-    CachedResource::allClientsRemoved();
 }
 
 void CachedCSSStyleSheet::setEncoding(const String& chs)
index 9e2cdca..fddd79d 100644 (file)
@@ -185,7 +185,6 @@ void CachedFont::allClientsRemoved()
         m_fontData = 0;
     }
 #endif
-    CachedResource::allClientsRemoved();
 }
 
 void CachedFont::checkNotify()
index 3cafc1e..e0b5b7d 100644 (file)
@@ -85,7 +85,7 @@ class CachedFontClient : public CachedResourceClient {
 public:
     virtual ~CachedFontClient() { }
     static CachedResourceClientType expectedType() { return FontType; }
-    virtual CachedResourceClientType resourceClientType() const { return expectedType(); }
+    virtual CachedResourceClientType resourceClientType() { return expectedType(); }
     virtual void fontLoaded(CachedFont*) { }
 };
 
index bcf1ff8..e0c81a1 100644 (file)
@@ -92,6 +92,15 @@ void CachedImage::load(CachedResourceLoader* cachedResourceLoader, const Resourc
         setLoading(false);
 }
 
+void CachedImage::removeClientForRenderer(RenderObject* renderer)
+{
+#if ENABLE(SVG)
+    if (m_svgImageCache)
+        m_svgImageCache->removeRendererFromCache(renderer);
+#endif
+    removeClient(renderer);
+}
+
 void CachedImage::didAddClient(CachedResourceClient* c)
 {
     if (m_decodedDataDeletionTimer.isActive())
@@ -109,24 +118,12 @@ void CachedImage::didAddClient(CachedResourceClient* c)
     CachedResource::didAddClient(c);
 }
 
-void CachedImage::didRemoveClient(CachedResourceClient* c)
-{
-    ASSERT(c->resourceClientType() == CachedImageClient::expectedType());
-#if ENABLE(SVG)
-    if (m_svgImageCache)
-        m_svgImageCache->removeClientFromCache(static_cast<CachedImageClient*>(c));
-#endif
-
-    CachedResource::didRemoveClient(c);
-}
-
 void CachedImage::allClientsRemoved()
 {
     if (m_image && !errorOccurred())
         m_image->resetAnimation();
     if (double interval = memoryCache()->deadDecodedDataDeletionInterval())
         m_decodedDataDeletionTimer.startOneShot(interval);
-    CachedResource::allClientsRemoved();
 }
 
 pair<Image*, float> CachedImage::brokenImage(float deviceScaleFactor) const
@@ -152,7 +149,7 @@ inline Image* CachedImage::lookupOrCreateImageForRenderer(const RenderObject* re
         return 0;
     if (!m_image->isSVGImage())
         return m_image.get();
-    Image* useImage = m_svgImageCache->lookupOrCreateBitmapImageForClient(renderer);
+    Image* useImage = m_svgImageCache->lookupOrCreateBitmapImageForRenderer(renderer);
     if (useImage == Image::nullImage())
         return m_image.get();
     return useImage;
index 1ed9ff0..89f019d 100644 (file)
@@ -67,9 +67,9 @@ public:
     IntSize imageSizeForRenderer(const RenderObject*, float multiplier); // returns the size of the complete image.
     void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);
 
+    void removeClientForRenderer(RenderObject*);
     virtual void didAddClient(CachedResourceClient*);
-    virtual void didRemoveClient(CachedResourceClient*);
-
+    
     virtual void allClientsRemoved();
     virtual void destroyDecodedData();
 
@@ -118,7 +118,7 @@ class CachedImageClient : public CachedResourceClient {
 public:
     virtual ~CachedImageClient() { }
     static CachedResourceClientType expectedType() { return ImageType; }
-    virtual CachedResourceClientType resourceClientType() const { return expectedType(); }
+    virtual CachedResourceClientType resourceClientType() { return expectedType(); }
 
     // Called whenever a frame of an image changes, either because we got more data from the network or
     // because we are animating. If not null, the IntRect is the changed rect of the image.
index 3ec544a..b0a7033 100644 (file)
@@ -87,6 +87,12 @@ void CachedRawResource::didAddClient(CachedResourceClient* c)
     CachedResource::didAddClient(client);
 }
 
+void CachedRawResource::allClientsRemoved()
+{
+    if (m_loader)
+        m_loader->cancelIfNotFinishing();
+}
+
 void CachedRawResource::willSendRequest(ResourceRequest& request, const ResourceResponse& response)
 {
     if (!response.isNull()) {
index 80ad1be..ed0ff95 100644 (file)
@@ -49,6 +49,7 @@ private:
     virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived);
 
     virtual bool shouldIgnoreHTTPStatusCodeErrors() const { return true; }
+    virtual void allClientsRemoved();
 
     virtual void willSendRequest(ResourceRequest&, const ResourceResponse&);
     virtual void setResponse(const ResourceResponse&);
@@ -65,7 +66,7 @@ class CachedRawResourceClient : public CachedResourceClient {
 public:
     virtual ~CachedRawResourceClient() { }
     static CachedResourceClientType expectedType() { return RawResourceType; }
-    virtual CachedResourceClientType resourceClientType() const { return expectedType(); }
+    virtual CachedResourceClientType resourceClientType() { return expectedType(); }
 
     virtual void dataSent(CachedResource*, unsigned long long /* bytesSent */, unsigned long long /* totalBytesToBeSent */) { }
     virtual void responseReceived(CachedResource*, const ResourceResponse&) { }
index 9ac4610..c95abed 100755 (executable)
@@ -387,12 +387,6 @@ void CachedResource::didAddClient(CachedResourceClient* c)
         c->notifyFinished(this);
 }
 
-void CachedResource::allClientsRemoved()
-{
-    if (m_loader)
-        m_loader->cancelIfNotFinishing();
-}
-
 bool CachedResource::addClientToSet(CachedResourceClient* client)
 {
     ASSERT(!isPurgeable());
@@ -432,7 +426,6 @@ void CachedResource::removeClient(CachedResourceClient* client)
     } else {
         ASSERT(m_clients.contains(client));
         m_clients.remove(client);
-        didRemoveClient(client);
     }
 
     if (canDelete() && !inCache())
index 0b76064..b4f55c0 100644 (file)
@@ -126,8 +126,7 @@ public:
     PreloadResult preloadResult() const { return static_cast<PreloadResult>(m_preloadResult); }
 
     virtual void didAddClient(CachedResourceClient*);
-    virtual void didRemoveClient(CachedResourceClient*) { }
-    virtual void allClientsRemoved();
+    virtual void allClientsRemoved() { }
 
     unsigned count() const { return m_clients.size(); }
 
index ff1deac..df6bdd1 100644 (file)
@@ -50,7 +50,7 @@ public:
     virtual void didReceiveData(CachedResource*) { };
     
     static CachedResourceClientType expectedType() { return BaseResourceType; }
-    virtual CachedResourceClientType resourceClientType() const { return expectedType(); }
+    virtual CachedResourceClientType resourceClientType() { return expectedType(); }
 
 protected:
     CachedResourceClient() { }
index b05ef67..84389ed 100755 (executable)
@@ -52,7 +52,7 @@ class CachedSVGDocumentClient : public CachedResourceClient {
 public:
     virtual ~CachedSVGDocumentClient() { }
     static CachedResourceClientType expectedType() { return SVGDocumentType; }
-    virtual CachedResourceClientType resourceClientType() const { return expectedType(); }
+    virtual CachedResourceClientType resourceClientType() { return expectedType(); }
 };
 
 }
index decaa90..8c83bca 100644 (file)
@@ -67,7 +67,6 @@ void CachedScript::allClientsRemoved()
 {
     if (double interval = memoryCache()->deadDecodedDataDeletionInterval())
         m_decodedDataDeletionTimer.startOneShot(interval);
-    CachedResource::allClientsRemoved();
 }
 
 void CachedScript::setEncoding(const String& chs)
index 4c87530..1a29258 100644 (file)
@@ -36,7 +36,7 @@ class CachedStyleSheetClient : public CachedResourceClient {
 public:
     virtual ~CachedStyleSheetClient() { }
     static CachedResourceClientType expectedType() { return StyleSheetType; }
-    virtual CachedResourceClientType resourceClientType() const { return expectedType(); }
+    virtual CachedResourceClientType resourceClientType() { return expectedType(); }
     virtual void setCSSStyleSheet(const String& /* href */, const KURL& /* baseURL */, const String& /* charset */, const CachedCSSStyleSheet*) { }
     virtual void setXSLStyleSheet(const String& /* href */, const KURL& /* baseURL */, const String& /* sheet */) { }
 };
index 2e3abb9..a7a1996 100644 (file)
@@ -97,7 +97,7 @@ void StyleCachedImage::addClient(RenderObject* renderer)
 
 void StyleCachedImage::removeClient(RenderObject* renderer)
 {
-    m_image->removeClient(renderer);
+    m_image->removeClientForRenderer(renderer);
 }
 
 PassRefPtr<Image> StyleCachedImage::image(RenderObject* renderer, const IntSize&) const
index c0a9f5e..f5071d1 100644 (file)
@@ -108,7 +108,7 @@ void StyleCachedImageSet::addClient(RenderObject* renderer)
 
 void StyleCachedImageSet::removeClient(RenderObject* renderer)
 {
-    m_bestFitImage->removeClient(renderer);
+    m_bestFitImage->removeClientForRenderer(renderer);
 }
 
 PassRefPtr<Image> StyleCachedImageSet::image(RenderObject* renderer, const IntSize&) const
index 91fea0b..e560293 100644 (file)
@@ -21,7 +21,6 @@
 #include "SVGImageCache.h"
 
 #if ENABLE(SVG)
-#include "CachedImage.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
 #include "ImageBuffer.h"
@@ -42,23 +41,18 @@ SVGImageCache::~SVGImageCache()
     m_sizeAndScalesMap.clear();
 
     ImageDataMap::iterator end = m_imageDataMap.end();
-    for (ImageDataMap::iterator it = m_imageDataMap.begin(); it != end; ++it) {
-        // Checks if the client (it->first) is still valid. The client should remove itself from this
-        // cache before its end of life, otherwise the following ASSERT will crash on pure virtual
-        // function call or a general crash.
-        ASSERT(it->first->resourceClientType() == CachedImageClient::expectedType());
+    for (ImageDataMap::iterator it = m_imageDataMap.begin(); it != end; ++it)
         delete it->second.buffer;
-    }
 
     m_imageDataMap.clear();
 }
 
-void SVGImageCache::removeClientFromCache(const CachedImageClient* client)
+void SVGImageCache::removeRendererFromCache(const RenderObject* renderer)
 {
-    ASSERT(client);
-    m_sizeAndScalesMap.remove(client);
+    ASSERT(renderer);
+    m_sizeAndScalesMap.remove(renderer);
 
-    ImageDataMap::iterator it = m_imageDataMap.find(client);
+    ImageDataMap::iterator it = m_imageDataMap.find(renderer);
     if (it == m_imageDataMap.end())
         return;
 
@@ -66,17 +60,17 @@ void SVGImageCache::removeClientFromCache(const CachedImageClient* client)
     m_imageDataMap.remove(it);
 }
 
-void SVGImageCache::setRequestedSizeAndScales(const CachedImageClient* client, const SizeAndScales& sizeAndScales)
+void SVGImageCache::setRequestedSizeAndScales(const RenderObject* renderer, const SizeAndScales& sizeAndScales)
 {
-    ASSERT(client);
+    ASSERT(renderer);
     ASSERT(!sizeAndScales.size.isEmpty());
-    m_sizeAndScalesMap.set(client, sizeAndScales);
+    m_sizeAndScalesMap.set(renderer, sizeAndScales);
 }
 
-SVGImageCache::SizeAndScales SVGImageCache::requestedSizeAndScales(const CachedImageClient* client) const
+SVGImageCache::SizeAndScales SVGImageCache::requestedSizeAndScales(const RenderObject* renderer) const
 {
-    ASSERT(client);
-    SizeAndScalesMap::const_iterator it = m_sizeAndScalesMap.find(client);
+    ASSERT(renderer);
+    SizeAndScalesMap::const_iterator it = m_sizeAndScalesMap.find(renderer);
     if (it == m_sizeAndScalesMap.end())
         return SizeAndScales();
     return it->second;
@@ -128,12 +122,12 @@ void SVGImageCache::redrawTimerFired(Timer<SVGImageCache>*)
        redraw();
 }
 
-Image* SVGImageCache::lookupOrCreateBitmapImageForClient(const CachedImageClient* client)
+Image* SVGImageCache::lookupOrCreateBitmapImageForRenderer(const RenderObject* renderer)
 {
-    ASSERT(client);
+    ASSERT(renderer);
 
-    // The cache needs to know the size of the client before querying an image for it.
-    SizeAndScalesMap::iterator sizeIt = m_sizeAndScalesMap.find(client);
+    // The cache needs to know the size of the renderer before querying an image for it.
+    SizeAndScalesMap::iterator sizeIt = m_sizeAndScalesMap.find(renderer);
     if (sizeIt == m_sizeAndScalesMap.end())
         return Image::nullImage();
 
@@ -142,8 +136,8 @@ Image* SVGImageCache::lookupOrCreateBitmapImageForClient(const CachedImageClient
     float scale = sizeIt->second.scale;
     ASSERT(!size.isEmpty());
 
-    // Lookup image for client in cache and eventually update it.
-    ImageDataMap::iterator it = m_imageDataMap.find(client);
+    // Lookup image for renderer in cache and eventually update it.
+    ImageDataMap::iterator it = m_imageDataMap.find(renderer);
     if (it != m_imageDataMap.end()) {
         ImageData& data = it->second;
 
@@ -151,7 +145,7 @@ Image* SVGImageCache::lookupOrCreateBitmapImageForClient(const CachedImageClient
         if (data.sizeAndScales.size == size && data.sizeAndScales.zoom == zoom && data.sizeAndScales.scale == scale)
             return data.image.get();
 
-        // If the image size for the client changed, we have to delete the buffer, remove the item from the cache and recreate it.
+        // If the image size for the renderer changed, we have to delete the buffer, remove the item from the cache and recreate it.
         delete data.buffer;
         m_imageDataMap.remove(it);
     }
@@ -170,7 +164,7 @@ Image* SVGImageCache::lookupOrCreateBitmapImageForClient(const CachedImageClient
     Image* newImagePtr = newImage.get();
     ASSERT(newImagePtr);
 
-    m_imageDataMap.add(client, ImageData(newBuffer.leakPtr(), newImage.release(), sizeIt->second));
+    m_imageDataMap.add(renderer, ImageData(newBuffer.leakPtr(), newImage.release(), sizeIt->second));
     return newImagePtr;
 }
 
index 2ec7277..7f42f46 100644 (file)
@@ -31,8 +31,8 @@
 namespace WebCore {
 
 class CachedImage;
-class CachedImageClient;
 class ImageBuffer;
+class RenderObject;
 class SVGImage;
 
 class SVGImageCache {
@@ -63,12 +63,12 @@ public:
         float scale;
     };
 
-    void removeClientFromCache(const CachedImageClient*);
+    void removeRendererFromCache(const RenderObject*);
 
-    void setRequestedSizeAndScales(const CachedImageClient*, const SizeAndScales&);
-    SizeAndScales requestedSizeAndScales(const CachedImageClient*) const;
+    void setRequestedSizeAndScales(const RenderObject*, const SizeAndScales&);
+    SizeAndScales requestedSizeAndScales(const RenderObject*) const;
 
-    Image* lookupOrCreateBitmapImageForClient(const CachedImageClient*);
+    Image* lookupOrCreateBitmapImageForRenderer(const RenderObject*);
     void imageContentChanged();
 
 private:
@@ -98,8 +98,8 @@ private:
         RefPtr<Image> image;
     };
 
-    typedef HashMap<const CachedImageClient*, SizeAndScales> SizeAndScalesMap;
-    typedef HashMap<const CachedImageClient*, ImageData> ImageDataMap;
+    typedef HashMap<const RenderObject*, SizeAndScales> SizeAndScalesMap;
+    typedef HashMap<const RenderObject*, ImageData> ImageDataMap;
 
     SVGImage* m_svgImage;
     SizeAndScalesMap m_sizeAndScalesMap;