Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
CSSImageValue: Remove inheritance from CachedImageClient.
<http://webkit.org/b/71675>

Reviewed by Antti Koivisto.

CSSImageValue doesn't actually use any of the CachedImageClient
functionality, and holds a reference to the resource via the
CachedResourceHandle in StyleCachedImage.

So we can safely remove the multiple inheritance and simplify
the class.

* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::~CSSImageValue):
(WebCore::CSSImageValue::cachedImage):
(WebCore::CSSImageValue::clearCachedImage):
* css/CSSImageValue.h:


Canonical link: https://commits.webkit.org/87995@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@99415 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Andreas Kling committed Nov 7, 2011
1 parent 80349c3 commit d45eb38
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
20 changes: 20 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,23 @@
2011-11-07 Andreas Kling <kling@webkit.org>

CSSImageValue: Remove inheritance from CachedImageClient.
<http://webkit.org/b/71675>

Reviewed by Antti Koivisto.

CSSImageValue doesn't actually use any of the CachedImageClient
functionality, and holds a reference to the resource via the
CachedResourceHandle in StyleCachedImage.

So we can safely remove the multiple inheritance and simplify
the class.

* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::~CSSImageValue):
(WebCore::CSSImageValue::cachedImage):
(WebCore::CSSImageValue::clearCachedImage):
* css/CSSImageValue.h:

2011-11-07 Andreas Kling <kling@webkit.org>

CSSPrimitiveValue: Remove unused virtual function parseString().
Expand Down
8 changes: 1 addition & 7 deletions Source/WebCore/css/CSSImageValue.cpp
Expand Up @@ -45,8 +45,6 @@ CSSImageValue::CSSImageValue()

CSSImageValue::~CSSImageValue()
{
if (m_image && m_image->isCachedImage())
static_cast<StyleCachedImage*>(m_image.get())->cachedImage()->removeClient(this);
}

StyleImage* CSSImageValue::cachedOrPendingImage()
Expand All @@ -73,10 +71,8 @@ StyleCachedImage* CSSImageValue::cachedImage(CachedResourceLoader* loader, const
m_accessedImage = true;

ResourceRequest request(loader->document()->completeURL(url));
if (CachedImage* cachedImage = loader->requestImage(request)) {
cachedImage->addClient(this);
if (CachedImage* cachedImage = loader->requestImage(request))
m_image = StyleCachedImage::create(cachedImage);
}
}

return (m_image && m_image->isCachedImage()) ? static_cast<StyleCachedImage*>(m_image.get()) : 0;
Expand All @@ -91,8 +87,6 @@ String CSSImageValue::cachedImageURL()

void CSSImageValue::clearCachedImage()
{
if (m_image && m_image->isCachedImage())
static_cast<StyleCachedImage*>(m_image.get())->cachedImage()->removeClient(this);
m_image = 0;
m_accessedImage = false;
}
Expand Down
3 changes: 1 addition & 2 deletions Source/WebCore/css/CSSImageValue.h
Expand Up @@ -22,7 +22,6 @@
#define CSSImageValue_h

#include "CSSPrimitiveValue.h"
#include "CachedImage.h"
#include <wtf/RefPtr.h>

namespace WebCore {
Expand All @@ -31,7 +30,7 @@ class CachedResourceLoader;
class StyleCachedImage;
class StyleImage;

class CSSImageValue : public CSSPrimitiveValue, private CachedImageClient {
class CSSImageValue : public CSSPrimitiveValue {
WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<CSSImageValue> create() { return adoptRef(new CSSImageValue); }
Expand Down

0 comments on commit d45eb38

Please sign in to comment.