summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--third_party/WebKit/Source/core/core.gypi4
-rw-r--r--third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp12
-rw-r--r--third_party/WebKit/Source/core/css/CSSCrossfadeValue.h4
-rw-r--r--third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp2
-rw-r--r--third_party/WebKit/Source/core/fetch/FontResource.cpp6
-rw-r--r--third_party/WebKit/Source/core/fetch/FontResource.h2
-rw-r--r--third_party/WebKit/Source/core/fetch/ImageResource.cpp84
-rw-r--r--third_party/WebKit/Source/core/fetch/ImageResource.h17
-rw-r--r--third_party/WebKit/Source/core/fetch/ImageResourceObserver.h (renamed from third_party/WebKit/Source/core/fetch/ImageResourceClient.h)24
-rw-r--r--third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp7
-rw-r--r--third_party/WebKit/Source/core/fetch/MemoryCache.cpp16
-rw-r--r--third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp10
-rw-r--r--third_party/WebKit/Source/core/fetch/MockResourceClients.cpp (renamed from third_party/WebKit/Source/core/fetch/MockImageResourceClient.cpp)36
-rw-r--r--third_party/WebKit/Source/core/fetch/MockResourceClients.h (renamed from third_party/WebKit/Source/core/fetch/MockImageResourceClient.h)44
-rw-r--r--third_party/WebKit/Source/core/fetch/RawResource.cpp2
-rw-r--r--third_party/WebKit/Source/core/fetch/RawResourceTest.cpp10
-rw-r--r--third_party/WebKit/Source/core/fetch/Resource.cpp48
-rw-r--r--third_party/WebKit/Source/core/fetch/Resource.h15
-rw-r--r--third_party/WebKit/Source/core/fetch/ResourceClient.h4
-rw-r--r--third_party/WebKit/Source/core/fetch/ResourceClientOrObserverWalker.h (renamed from third_party/WebKit/Source/core/fetch/ResourceClientWalker.h)24
-rw-r--r--third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp6
-rw-r--r--third_party/WebKit/Source/core/fetch/ScriptResource.cpp2
-rw-r--r--third_party/WebKit/Source/core/fetch/XSLStyleSheetResource.cpp2
-rw-r--r--third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp2
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutImage.cpp2
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutImage.h4
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutImageResource.cpp22
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutImageResource.h3
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp4
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.h2
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutObject.cpp7
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutObject.h14
-rw-r--r--third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp2
-rw-r--r--third_party/WebKit/Source/core/loader/ImageLoader.cpp24
-rw-r--r--third_party/WebKit/Source/core/loader/ImageLoader.h7
-rw-r--r--third_party/WebKit/Source/core/loader/LinkPreloadResourceClients.h5
-rw-r--r--third_party/WebKit/Source/core/style/StyleFetchedImage.cpp4
-rw-r--r--third_party/WebKit/Source/core/style/StyleFetchedImage.h4
-rw-r--r--third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp4
-rw-r--r--third_party/WebKit/Source/core/style/StyleFetchedImageSet.h4
-rw-r--r--third_party/WebKit/Source/core/svg/SVGFEImageElement.h4
41 files changed, 284 insertions, 215 deletions
diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi
index b993993..9a40587 100644
--- a/third_party/WebKit/Source/core/core.gypi
+++ b/third_party/WebKit/Source/core/core.gypi
@@ -1633,7 +1633,7 @@
'fetch/RawResource.h',
'fetch/Resource.cpp',
'fetch/Resource.h',
- 'fetch/ResourceClientWalker.h',
+ 'fetch/ResourceClientOrObserverWalker.h',
'fetch/ResourceFetcher.cpp',
'fetch/ResourceFetcher.h',
'fetch/ResourceLoader.cpp',
@@ -3975,7 +3975,7 @@
'fetch/FetchUtilsTest.cpp',
'fetch/ImageResourceTest.cpp',
'fetch/MemoryCacheTest.cpp',
- 'fetch/MockImageResourceClient.cpp',
+ 'fetch/MockResourceClients.cpp',
'fetch/MultipartImageResourceParserTest.cpp',
'fetch/RawResourceTest.cpp',
'fetch/ResourceFetcherTest.cpp',
diff --git a/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp b/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp
index 6eeb562..bf557f5 100644
--- a/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp
+++ b/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp
@@ -126,11 +126,11 @@ CSSCrossfadeValue::~CSSCrossfadeValue()
void CSSCrossfadeValue::dispose()
{
if (m_cachedFromImage) {
- m_cachedFromImage->removeClient(&m_crossfadeSubimageObserver);
+ m_cachedFromImage->removeObserver(&m_crossfadeSubimageObserver);
m_cachedFromImage = nullptr;
}
if (m_cachedToImage) {
- m_cachedToImage->removeClient(&m_crossfadeSubimageObserver);
+ m_cachedToImage->removeObserver(&m_crossfadeSubimageObserver);
m_cachedToImage = nullptr;
}
}
@@ -208,16 +208,16 @@ void CSSCrossfadeValue::loadSubimages(Document* document)
if (m_cachedFromImage != oldCachedFromImage) {
if (oldCachedFromImage)
- oldCachedFromImage->removeClient(&m_crossfadeSubimageObserver);
+ oldCachedFromImage->removeObserver(&m_crossfadeSubimageObserver);
if (m_cachedFromImage)
- m_cachedFromImage->addClient(&m_crossfadeSubimageObserver);
+ m_cachedFromImage->addObserver(&m_crossfadeSubimageObserver);
}
if (m_cachedToImage != oldCachedToImage) {
if (oldCachedToImage)
- oldCachedToImage->removeClient(&m_crossfadeSubimageObserver);
+ oldCachedToImage->removeObserver(&m_crossfadeSubimageObserver);
if (m_cachedToImage)
- m_cachedToImage->addClient(&m_crossfadeSubimageObserver);
+ m_cachedToImage->addObserver(&m_crossfadeSubimageObserver);
}
m_crossfadeSubimageObserver.setReady(true);
diff --git a/third_party/WebKit/Source/core/css/CSSCrossfadeValue.h b/third_party/WebKit/Source/core/css/CSSCrossfadeValue.h
index 8949409..9839551 100644
--- a/third_party/WebKit/Source/core/css/CSSCrossfadeValue.h
+++ b/third_party/WebKit/Source/core/css/CSSCrossfadeValue.h
@@ -30,7 +30,7 @@
#include "core/css/CSSImageGeneratorValue.h"
#include "core/css/CSSPrimitiveValue.h"
#include "core/fetch/ImageResource.h"
-#include "core/fetch/ImageResourceClient.h"
+#include "core/fetch/ImageResourceObserver.h"
#include "platform/graphics/Image.h"
namespace blink {
@@ -74,7 +74,7 @@ private:
void dispose();
- class CrossfadeSubimageObserverProxy final : public ImageResourceClient {
+ class CrossfadeSubimageObserverProxy final : public ImageResourceObserver {
DISALLOW_NEW();
public:
explicit CrossfadeSubimageObserverProxy(CSSCrossfadeValue* ownerValue)
diff --git a/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp b/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp
index 5f1bf13..20bd626 100644
--- a/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp
@@ -29,7 +29,7 @@
#include "core/css/StyleSheetContents.h"
#include "core/fetch/FetchRequest.h"
#include "core/fetch/MemoryCache.h"
-#include "core/fetch/ResourceClientWalker.h"
+#include "core/fetch/ResourceClientOrObserverWalker.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/StyleSheetResourceClient.h"
#include "platform/SharedBuffer.h"
diff --git a/third_party/WebKit/Source/core/fetch/FontResource.cpp b/third_party/WebKit/Source/core/fetch/FontResource.cpp
index 73b1083..331c44e 100644
--- a/third_party/WebKit/Source/core/fetch/FontResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/FontResource.cpp
@@ -27,7 +27,7 @@
#include "core/fetch/FontResource.h"
#include "core/fetch/FetchRequest.h"
-#include "core/fetch/ResourceClientWalker.h"
+#include "core/fetch/ResourceClientOrObserverWalker.h"
#include "core/fetch/ResourceFetcher.h"
#include "platform/Histogram.h"
#include "platform/SharedBuffer.h"
@@ -183,10 +183,10 @@ void FontResource::fontLoadLongLimitCallback(Timer<FontResource>*)
client->fontLoadLongLimitExceeded(this);
}
-void FontResource::allClientsRemoved()
+void FontResource::allClientsAndObserversRemoved()
{
m_fontData.clear();
- Resource::allClientsRemoved();
+ Resource::allClientsAndObserversRemoved();
}
void FontResource::checkNotify()
diff --git a/third_party/WebKit/Source/core/fetch/FontResource.h b/third_party/WebKit/Source/core/fetch/FontResource.h
index 9702c5e..e2d542f 100644
--- a/third_party/WebKit/Source/core/fetch/FontResource.h
+++ b/third_party/WebKit/Source/core/fetch/FontResource.h
@@ -51,7 +51,7 @@ public:
void didAddClient(ResourceClient*) override;
- void allClientsRemoved() override;
+ void allClientsAndObserversRemoved() override;
void beginLoadIfNeeded(ResourceFetcher* dl);
bool loadScheduled() const { return getStatus() == LoadStartScheduled; }
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
index bb21c47..60911b1 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -23,10 +23,10 @@
#include "core/fetch/ImageResource.h"
-#include "core/fetch/ImageResourceClient.h"
+#include "core/fetch/ImageResourceObserver.h"
#include "core/fetch/MemoryCache.h"
#include "core/fetch/ResourceClient.h"
-#include "core/fetch/ResourceClientWalker.h"
+#include "core/fetch/ResourceClientOrObserverWalker.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/ResourceLoader.h"
#include "core/svg/graphics/SVGImage.h"
@@ -41,6 +41,8 @@
namespace blink {
+using ImageResourceObserverWalker = ResourceClientOrObserverWalker<ImageResourceObserver, ImageResourceObserver>;
+
PassRefPtrWillBeRawPtr<ImageResource> ImageResource::fetch(FetchRequest& request, ResourceFetcher* fetcher)
{
if (request.resourceRequest().requestContext() == WebURLRequest::RequestContextUnspecified)
@@ -99,26 +101,44 @@ DEFINE_TRACE(ImageResource)
MultipartImageResourceParser::Client::trace(visitor);
}
-void ImageResource::didAddClient(ResourceClient* c)
+void ImageResource::addObserver(ImageResourceObserver* observer)
{
+ willAddClientOrObserver();
+
+ m_observers.add(observer);
+
+ if (!m_revalidatingRequest.isNull())
+ return;
+
if (m_data && !m_image && !errorOccurred()) {
createImage();
m_image->setData(m_data, true);
}
- ASSERT(ImageResourceClient::isExpectedType(c));
if (m_image && !m_image->isNull())
- static_cast<ImageResourceClient*>(c)->imageChanged(this);
-
- Resource::didAddClient(c);
+ observer->imageChanged(this);
}
-void ImageResource::didRemoveClient(ResourceClient* c)
+void ImageResource::removeObserver(ImageResourceObserver* observer)
{
- ASSERT(c);
- ASSERT(ImageResourceClient::isExpectedType(c));
+ ASSERT(observer);
+ ASSERT(m_observers.contains(observer));
+ m_observers.remove(observer);
+ didRemoveClientOrObserver();
+}
- Resource::didRemoveClient(c);
+ResourcePriority ImageResource::priorityFromObservers()
+{
+ ResourcePriority priority;
+ ImageResourceObserverWalker w(m_observers);
+ while (const auto* observer = w.next()) {
+ ResourcePriority nextPriority = observer->computeResourcePriority();
+ if (nextPriority.visibility == ResourcePriority::NotVisible)
+ continue;
+ priority.visibility = ResourcePriority::Visible;
+ priority.intraPriorityValue += nextPriority.intraPriorityValue;
+ }
+ return priority;
}
bool ImageResource::isSafeToUnlock() const
@@ -135,7 +155,7 @@ void ImageResource::destroyDecodedDataForFailedRevalidation()
void ImageResource::destroyDecodedDataIfPossible()
{
- if (!hasClients() && !isLoading() && (!m_image || (m_image->hasOneRef() && m_image->isBitmapImage()))) {
+ if (!hasClientsOrObservers() && !isLoading() && (!m_image || (m_image->hasOneRef() && m_image->isBitmapImage()))) {
m_image = nullptr;
setDecodedSize(0);
} else if (m_image && !errorOccurred()) {
@@ -143,13 +163,13 @@ void ImageResource::destroyDecodedDataIfPossible()
}
}
-void ImageResource::allClientsRemoved()
+void ImageResource::allClientsAndObserversRemoved()
{
if (m_image && !errorOccurred())
m_image->resetAnimation();
if (m_multipartParser)
m_multipartParser->cancel();
- Resource::allClientsRemoved();
+ Resource::allClientsAndObserversRemoved();
}
void ImageResource::appendData(const char* data, size_t length)
@@ -241,13 +261,10 @@ LayoutSize ImageResource::imageSize(RespectImageOrientationEnum shouldRespectIma
void ImageResource::notifyObservers(const IntRect* changeRect)
{
- ResourceClientWalker<ImageResourceClient> w(m_clients);
- while (ImageResourceClient* c = w.next())
- c->imageChanged(this, changeRect);
-
- ResourceClientWalker<ImageResourceClient> w2(m_finishedClients);
- while (ImageResourceClient* c = w2.next())
- c->imageChanged(this, changeRect);
+ ImageResourceObserverWalker w(m_observers);
+ while (auto* observer = w.next()) {
+ observer->imageChanged(this, changeRect);
+ }
}
void ImageResource::clear()
@@ -388,18 +405,11 @@ bool ImageResource::shouldPauseAnimation(const blink::Image* image)
if (!image || image != m_image)
return false;
- ResourceClientWalker<ImageResourceClient> w(m_clients);
- while (ImageResourceClient* c = w.next()) {
- if (c->willRenderImage(this))
- return false;
- }
-
- ResourceClientWalker<ImageResourceClient> w2(m_finishedClients);
- while (ImageResourceClient* c = w2.next()) {
- if (c->willRenderImage(this))
+ ImageResourceObserverWalker w(m_observers);
+ while (auto* observer = w.next()) {
+ if (observer->willRenderImage())
return false;
}
-
return true;
}
@@ -416,15 +426,9 @@ void ImageResource::updateImageAnimationPolicy()
return;
ImageAnimationPolicy newPolicy = ImageAnimationPolicyAllowed;
- ResourceClientWalker<ImageResourceClient> w(m_clients);
- while (ImageResourceClient* c = w.next()) {
- if (c->getImageAnimationPolicy(this, newPolicy))
- break;
- }
-
- ResourceClientWalker<ImageResourceClient> w2(m_finishedClients);
- while (ImageResourceClient* c = w2.next()) {
- if (c->getImageAnimationPolicy(this, newPolicy))
+ ImageResourceObserverWalker w(m_observers);
+ while (auto* observer = w.next()) {
+ if (observer->getImageAnimationPolicy(newPolicy))
break;
}
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.h b/third_party/WebKit/Source/core/fetch/ImageResource.h
index db8c6ab..74849d1 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.h
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.h
@@ -35,19 +35,20 @@
namespace blink {
-class ImageResourceClient;
class FetchRequest;
-class ResourceFetcher;
class FloatSize;
+class ImageResourceObserver;
class Length;
class MemoryCache;
+class ResourceClient;
+class ResourceFetcher;
class SecurityOrigin;
class CORE_EXPORT ImageResource final : public Resource, public ImageObserver, public MultipartImageResourceParser::Client {
friend class MemoryCache;
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ImageResource);
public:
- using ClientType = ImageResourceClient;
+ using ClientType = ResourceClient;
static PassRefPtrWillBeRawPtr<ImageResource> fetch(FetchRequest&, ResourceFetcher*);
@@ -91,10 +92,13 @@ public:
// the Lo-Fi state set to off and bypassing the cache.
void reloadIfLoFi(ResourceFetcher*);
- void didAddClient(ResourceClient*) override;
- void didRemoveClient(ResourceClient*) override;
+ void addObserver(ImageResourceObserver*);
+ void removeObserver(ImageResourceObserver*);
+ bool hasClientsOrObservers() const override { return Resource::hasClientsOrObservers() || !m_observers.isEmpty(); }
+
+ ResourcePriority priorityFromObservers() override;
- void allClientsRemoved() override;
+ void allClientsAndObserversRemoved() override;
void appendData(const char*, size_t) override;
void error(Resource::Status) override;
@@ -162,6 +166,7 @@ private:
RefPtr<blink::Image> m_image;
MultipartParsingState m_multipartParsingState = MultipartParsingState::WaitingForFirstPart;
bool m_hasDevicePixelRatioHeaderValue;
+ HashCountedSet<ImageResourceObserver*> m_observers;
};
DEFINE_RESOURCE_TYPE_CASTS(Image);
diff --git a/third_party/WebKit/Source/core/fetch/ImageResourceClient.h b/third_party/WebKit/Source/core/fetch/ImageResourceObserver.h
index cc69a3d..9a002c4 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResourceClient.h
+++ b/third_party/WebKit/Source/core/fetch/ImageResourceObserver.h
@@ -20,23 +20,22 @@
Boston, MA 02110-1301, USA.
*/
-#ifndef ImageResourceClient_h
-#define ImageResourceClient_h
+#ifndef ImageResourceObserver_h
+#define ImageResourceObserver_h
#include "core/CoreExport.h"
-#include "core/fetch/ResourceClient.h"
#include "platform/graphics/ImageAnimationPolicy.h"
+#include "platform/network/ResourceLoadPriority.h"
+#include "wtf/Forward.h"
namespace blink {
class ImageResource;
class IntRect;
-class CORE_EXPORT ImageResourceClient : public ResourceClient {
+class CORE_EXPORT ImageResourceObserver {
public:
- ~ImageResourceClient() override {}
- static bool isExpectedType(ResourceClient* client) { return client->getResourceClientType() == ImageType; }
- ResourceClientType getResourceClientType() const final { return ImageType; }
+ virtual ~ImageResourceObserver() {}
// 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.
@@ -46,10 +45,17 @@ public:
// can halt animation. Content nodes that hold image refs for example would not render the image,
// but LayoutImages would (assuming they have visibility: visible and their layout tree isn't hidden
// e.g., in the b/f cache or in a background tab).
- virtual bool willRenderImage(ImageResource*) { return false; }
+ virtual bool willRenderImage() { return false; }
// Called to get imageAnimation policy from settings
- virtual bool getImageAnimationPolicy(ImageResource*, ImageAnimationPolicy&) { return false; }
+ virtual bool getImageAnimationPolicy(ImageAnimationPolicy&) { return false; }
+
+ virtual ResourcePriority computeResourcePriority() const { return ResourcePriority(); }
+
+ // Name for debugging, e.g. shown in memory-infra.
+ virtual String debugName() const = 0;
+
+ static bool isExpectedType(ImageResourceObserver*) { return true; }
};
} // namespace blink
diff --git a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
index c3ecd53..4e7a570 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
@@ -30,9 +30,8 @@
#include "core/fetch/ImageResource.h"
-#include "core/fetch/ImageResourceClient.h"
#include "core/fetch/MemoryCache.h"
-#include "core/fetch/MockImageResourceClient.h"
+#include "core/fetch/MockResourceClients.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/ResourceLoader.h"
#include "core/fetch/UniqueIdentifier.h"
@@ -195,14 +194,14 @@ TEST(ImageResourceTest, DecodedDataRemainsWhileHasClients)
// The prune comes when the ImageResource still has clients. The image should not be deleted.
cachedImage->prune();
- ASSERT_TRUE(cachedImage->hasClients());
+ ASSERT_TRUE(cachedImage->hasClientsOrObservers());
ASSERT_TRUE(cachedImage->hasImage());
ASSERT_FALSE(cachedImage->getImage()->isNull());
// The ImageResource no longer has clients. The image should be deleted by prune.
client.removeAsClient();
cachedImage->prune();
- ASSERT_FALSE(cachedImage->hasClients());
+ ASSERT_FALSE(cachedImage->hasClientsOrObservers());
ASSERT_FALSE(cachedImage->hasImage());
ASSERT_TRUE(cachedImage->getImage()->isNull());
}
diff --git a/third_party/WebKit/Source/core/fetch/MemoryCache.cpp b/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
index 4a9dfe0..059fe31 100644
--- a/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
+++ b/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
@@ -253,7 +253,7 @@ void MemoryCache::pruneLiveResources(PruneStrategy strategy)
MemoryCacheEntry* current = m_liveDecodedResources.m_tail;
while (current) {
MemoryCacheEntry* previous = current->m_previousInLiveResourcesList;
- ASSERT(current->m_resource->hasClients());
+ ASSERT(current->m_resource->hasClientsOrObservers());
if (current->m_resource->isLoaded() && current->m_resource->decodedSize()) {
// Check to see if the remaining resources are too new to prune.
double elapsedTime = m_pruneFrameTimeStamp - current->m_lastDecodedAccessTime;
@@ -301,7 +301,7 @@ void MemoryCache::pruneDeadResources(PruneStrategy strategy)
// TODO(leon.han@intel.com): We shouldn't be hitting the case
// that current->m_resource is null here, would turn the case into
// ASSERT(current->m_resource) after crbug.com/594644 got resolved.
- if (current->m_resource && !current->m_resource->hasClients() && !current->m_resource->isPreloaded() && current->m_resource->isLoaded()) {
+ if (current->m_resource && !current->m_resource->hasClientsOrObservers() && !current->m_resource->isPreloaded() && current->m_resource->isLoaded()) {
// Destroy our decoded data. This will remove us from
// m_liveDecodedResources, and possibly move us to a different
// LRU list in m_allResources.
@@ -328,7 +328,7 @@ void MemoryCache::pruneDeadResources(PruneStrategy strategy)
// TODO(leon.han@intel.com): We shouldn't be hitting the case
// that current->m_resource is null here, would turn the case into
// ASSERT(current->m_resource) after crbug.com/594644 got resolved.
- if (current->m_resource && !current->m_resource->hasClients() && !current->m_resource->isPreloaded()) {
+ if (current->m_resource && !current->m_resource->hasClientsOrObservers() && !current->m_resource->isPreloaded()) {
evict(current);
if (targetSize && m_deadSize <= targetSize)
return;
@@ -540,7 +540,7 @@ void MemoryCache::update(Resource* resource, size_t oldSize, size_t newSize, boo
insertInLRUList(entry, lruListFor(entry->m_accessCount, newSize));
ptrdiff_t delta = newSize - oldSize;
- if (resource->hasClients()) {
+ if (resource->hasClientsOrObservers()) {
ASSERT(delta >= 0 || m_liveSize >= static_cast<size_t>(-delta) );
m_liveSize += delta;
} else {
@@ -556,7 +556,7 @@ void MemoryCache::updateDecodedResource(Resource* resource, UpdateReason reason)
return;
removeFromLiveDecodedResourcesList(entry);
- if (resource->decodedSize() && resource->hasClients())
+ if (resource->decodedSize() && resource->hasClientsOrObservers())
insertInLiveDecodedResourcesList(entry);
if (reason != UpdateForAccess)
@@ -581,7 +581,7 @@ void MemoryCache::TypeStatistic::addResource(Resource* o)
size_t pageSize = (o->encodedSize() + o->overheadSize() + 4095) & ~4095;
count++;
size += o->size();
- liveSize += o->hasClients() ? o->size() : 0;
+ liveSize += o->hasClientsOrObservers() ? o->size() : 0;
decodedSize += o->decodedSize();
encodedSize += o->encodedSize();
encodedSizeDuplicatedInDataURLs += o->url().protocolIsData() ? o->encodedSize() : 0;
@@ -772,8 +772,8 @@ void MemoryCache::dumpLRULists(bool includeLive) const
MemoryCacheEntry* current = m_allResources[i].m_tail;
while (current) {
RefPtrWillBeRawPtr<Resource> currentResource = current->m_resource;
- if (includeLive || !currentResource->hasClients())
- printf("(%.1fK, %.1fK, %uA, %dR, %d); ", currentResource->decodedSize() / 1024.0f, (currentResource->encodedSize() + currentResource->overheadSize()) / 1024.0f, current->m_accessCount, currentResource->hasClients(), currentResource->isPurgeable());
+ if (includeLive || !currentResource->hasClientsOrObservers())
+ printf("(%.1fK, %.1fK, %uA, %dR, %d); ", currentResource->decodedSize() / 1024.0f, (currentResource->encodedSize() + currentResource->overheadSize()) / 1024.0f, current->m_accessCount, currentResource->hasClientsOrObservers(), currentResource->isPurgeable());
current = current->m_previousInAllResourcesList;
}
diff --git a/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp b/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp
index 57dcb78..efd29b4 100644
--- a/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp
@@ -30,7 +30,7 @@
#include "core/fetch/MemoryCache.h"
-#include "core/fetch/MockImageResourceClient.h"
+#include "core/fetch/MockResourceClients.h"
#include "core/fetch/RawResource.h"
#include "platform/network/ResourceRequest.h"
#include "platform/testing/UnitTestHelpers.h"
@@ -133,7 +133,7 @@ TEST_F(MemoryCacheTest, VeryLargeResourceAccounting)
ASSERT_EQ(cachedResource->size(), memoryCache()->deadSize());
ASSERT_EQ(0u, memoryCache()->liveSize());
- MockImageResourceClient client(cachedResource);
+ MockResourceClient client(cachedResource);
ASSERT_EQ(0u, memoryCache()->deadSize());
ASSERT_EQ(cachedResource->size(), memoryCache()->liveSize());
@@ -237,7 +237,7 @@ static void TestLiveResourceEvictionAtEndOfTask(Resource* cachedDeadResource, Re
const char data[6] = "abcde";
cachedDeadResource->appendData(data, 3u);
cachedDeadResource->finish();
- MockImageResourceClient client(cachedLiveResource);
+ MockResourceClient client(cachedLiveResource);
cachedLiveResource->appendData(data, 4u);
cachedLiveResource->finish();
@@ -294,9 +294,9 @@ TEST_F(MemoryCacheTest, LiveResourceEvictionAtEndOfTask_MultipleResourceMaps)
static void TestClientRemoval(Resource* resource1, Resource* resource2)
{
const char data[6] = "abcde";
- MockImageResourceClient client1(resource1);
+ MockResourceClient client1(resource1);
resource1->appendData(data, 4u);
- MockImageResourceClient client2(resource2);
+ MockResourceClient client2(resource2);
resource2->appendData(data, 4u);
const unsigned minDeadCapacity = 0;
diff --git a/third_party/WebKit/Source/core/fetch/MockImageResourceClient.cpp b/third_party/WebKit/Source/core/fetch/MockResourceClients.cpp
index b3d9d15..1894dab 100644
--- a/third_party/WebKit/Source/core/fetch/MockImageResourceClient.cpp
+++ b/third_party/WebKit/Source/core/fetch/MockResourceClients.cpp
@@ -2,37 +2,59 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "core/fetch/MockImageResourceClient.h"
+#include "core/fetch/MockResourceClients.h"
#include "core/fetch/ImageResource.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace blink {
-MockImageResourceClient::MockImageResourceClient(PassRefPtrWillBeRawPtr<Resource> resource)
+MockResourceClient::MockResourceClient(PassRefPtrWillBeRawPtr<Resource> resource)
: m_resource(resource.get())
- , m_imageChangedCount(0)
, m_notifyFinishedCalled(false)
{
m_resource->addClient(this);
}
-MockImageResourceClient::~MockImageResourceClient()
+MockResourceClient::~MockResourceClient()
{
if (m_resource)
m_resource->removeClient(this);
}
-
-void MockImageResourceClient::notifyFinished(Resource*)
+void MockResourceClient::notifyFinished(Resource*)
{
ASSERT_FALSE(m_notifyFinishedCalled);
m_notifyFinishedCalled = true;
}
-void MockImageResourceClient::removeAsClient()
+void MockResourceClient::removeAsClient()
{
m_resource->removeClient(this);
m_resource = nullptr;
}
+MockImageResourceClient::MockImageResourceClient(PassRefPtrWillBeRawPtr<ImageResource> resource)
+ : MockResourceClient(resource)
+ , m_imageChangedCount(0)
+{
+ toImageResource(m_resource.get())->addObserver(this);
+}
+
+MockImageResourceClient::~MockImageResourceClient()
+{
+ if (m_resource)
+ toImageResource(m_resource.get())->removeObserver(this);
+}
+
+void MockImageResourceClient::removeAsClient()
+{
+ toImageResource(m_resource.get())->removeObserver(this);
+ MockResourceClient::removeAsClient();
+}
+
+void MockImageResourceClient::imageChanged(ImageResource*, const IntRect*)
+{
+ m_imageChangedCount++;
+}
+
} // namespace blink
diff --git a/third_party/WebKit/Source/core/fetch/MockImageResourceClient.h b/third_party/WebKit/Source/core/fetch/MockResourceClients.h
index b877a92..6fa5351 100644
--- a/third_party/WebKit/Source/core/fetch/MockImageResourceClient.h
+++ b/third_party/WebKit/Source/core/fetch/MockResourceClients.h
@@ -28,40 +28,50 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef MockImageResourceClient_h
-#define MockImageResourceClient_h
+#ifndef MockResourceClients_h
+#define MockResourceClients_h
-#include "core/fetch/ImageResourceClient.h"
+#include "core/fetch/ImageResourceObserver.h"
#include "core/fetch/Resource.h"
+#include "core/fetch/ResourceClient.h"
#include "platform/heap/Handle.h"
namespace blink {
-class MockImageResourceClient final : public ImageResourceClient {
+class MockResourceClient : public ResourceClient {
public:
- explicit MockImageResourceClient(const PassRefPtrWillBeRawPtr<Resource>);
+ explicit MockResourceClient(const PassRefPtrWillBeRawPtr<Resource>);
+ ~MockResourceClient() override;
+
+ void notifyFinished(Resource*) override;
+ String debugName() const override { return "MockResourceClient"; }
+ bool notifyFinishedCalled() const { return m_notifyFinishedCalled; }
+
+ virtual void removeAsClient();
+
+protected:
+ // TODO(Oilpan): properly trace when ResourceClient is on the heap.
+ RawPtrWillBeUntracedMember<Resource> m_resource;
+ bool m_notifyFinishedCalled;
+};
+
+class MockImageResourceClient final : public MockResourceClient, public ImageResourceObserver {
+public:
+ explicit MockImageResourceClient(const PassRefPtrWillBeRawPtr<ImageResource>);
~MockImageResourceClient() override;
- void imageChanged(ImageResource*, const IntRect*) override
- {
- m_imageChangedCount++;
- }
+ void imageChanged(ImageResource*, const IntRect*) override;
- void notifyFinished(Resource*) override;
String debugName() const override { return "MockImageResourceClient"; }
- int imageChangedCount() const { return m_imageChangedCount; }
- bool notifyFinishedCalled() const { return m_notifyFinishedCalled; }
+ void removeAsClient() override;
- void removeAsClient();
+ int imageChangedCount() const { return m_imageChangedCount; }
private:
- // TODO(Oilpan): properly trace when ImageResourceClient is on the heap.
- RawPtrWillBeUntracedMember<Resource> m_resource;
int m_imageChangedCount;
- bool m_notifyFinishedCalled;
};
} // namespace blink
-#endif // MockImageResourceClient_h
+#endif // MockResourceClients_h
diff --git a/third_party/WebKit/Source/core/fetch/RawResource.cpp b/third_party/WebKit/Source/core/fetch/RawResource.cpp
index 39c9ef9..a2f924d 100644
--- a/third_party/WebKit/Source/core/fetch/RawResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/RawResource.cpp
@@ -27,7 +27,7 @@
#include "core/fetch/FetchRequest.h"
#include "core/fetch/MemoryCache.h"
-#include "core/fetch/ResourceClientWalker.h"
+#include "core/fetch/ResourceClientOrObserverWalker.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/ResourceLoader.h"
diff --git a/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp b/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp
index 9496674..1b7aab2 100644
--- a/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp
@@ -30,9 +30,7 @@
#include "core/fetch/RawResource.h"
-#include "core/fetch/ImageResourceClient.h"
#include "core/fetch/MemoryCache.h"
-#include "core/fetch/MockImageResourceClient.h"
#include "core/fetch/ResourceFetcher.h"
#include "platform/SharedBuffer.h"
#include "platform/testing/UnitTestHelpers.h"
@@ -138,7 +136,7 @@ TEST(RawResourceTest, RevalidationSucceeded)
memoryCache()->remove(resource.get());
resource->removeClient(client.get());
- EXPECT_FALSE(resource->hasClients());
+ EXPECT_FALSE(resource->hasClientsOrObservers());
EXPECT_FALSE(client->called());
EXPECT_EQ("abcd", String(client->data().data(), client->data().size()));
}
@@ -168,7 +166,7 @@ TEST(RawResourceTest, RevalidationSucceededForResourceWithoutBody)
memoryCache()->remove(resource.get());
resource->removeClient(client.get());
- EXPECT_FALSE(resource->hasClients());
+ EXPECT_FALSE(resource->hasClientsOrObservers());
EXPECT_FALSE(client->called());
EXPECT_EQ(0u, client->data().size());
}
@@ -190,7 +188,7 @@ TEST(RawResourceTest, AddClientDuringCallback)
testing::runPendingTasks();
raw->removeClient(addingClient.get());
EXPECT_FALSE(dummyClient->called());
- EXPECT_FALSE(raw->hasClients());
+ EXPECT_FALSE(raw->hasClientsOrObservers());
}
// This client removes another client when notified.
@@ -228,7 +226,7 @@ TEST(RawResourceTest, RemoveClientDuringCallback)
raw->addClient(dummyClient.get());
raw->addClient(removingClient.get());
testing::runPendingTasks();
- EXPECT_FALSE(raw->hasClients());
+ EXPECT_FALSE(raw->hasClientsOrObservers());
}
} // namespace blink
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index 05d2e40..a311e3f 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -28,7 +28,7 @@
#include "core/fetch/FetchInitiatorTypeNames.h"
#include "core/fetch/MemoryCache.h"
#include "core/fetch/ResourceClient.h"
-#include "core/fetch/ResourceClientWalker.h"
+#include "core/fetch/ResourceClientOrObserverWalker.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/ResourceLoader.h"
#include "core/inspector/InspectorInstrumentation.h"
@@ -426,7 +426,7 @@ bool Resource::unlock()
if (!m_data->isLocked())
return true;
- if (!memoryCache()->contains(this) || hasClients() || !m_revalidatingRequest.isNull() || !m_loadFinishTime || !isSafeToUnlock())
+ if (!memoryCache()->contains(this) || hasClientsOrObservers() || !m_revalidatingRequest.isNull() || !m_loadFinishTime || !isSafeToUnlock())
return false;
m_data->unlock();
@@ -506,7 +506,7 @@ WeakPtrWillBeRawPtr<Resource> Resource::asWeakPtr()
String Resource::reasonNotDeletable() const
{
StringBuilder builder;
- if (hasClients()) {
+ if (hasClientsOrObservers()) {
builder.append("hasClients(");
builder.appendNumber(m_clients.size());
if (!m_clientsAwaitingCallback.isEmpty()) {
@@ -581,10 +581,9 @@ static bool shouldSendCachedDataSynchronouslyForType(Resource::Type type)
return false;
}
-void Resource::addClient(ResourceClient* client)
+void Resource::willAddClientOrObserver()
{
ASSERT(!isPurgeable());
-
if (m_preloadResult == PreloadNotReferenced) {
if (isLoaded())
m_preloadResult = PreloadReferencedWhileComplete;
@@ -593,8 +592,13 @@ void Resource::addClient(ResourceClient* client)
else
m_preloadResult = PreloadReferenced;
}
- if (!hasClients())
+ if (!hasClientsOrObservers())
memoryCache()->makeLive(this);
+}
+
+void Resource::addClient(ResourceClient* client)
+{
+ willAddClientOrObserver();
if (!m_revalidatingRequest.isNull()) {
m_clients.add(client);
@@ -623,15 +627,19 @@ void Resource::removeClient(ResourceClient* client)
else
m_clients.remove(client);
- didRemoveClient(client);
-
if (m_clientsAwaitingCallback.isEmpty())
ResourceCallback::callbackHandler()->cancel(this);
- if (!hasClients()) {
+ didRemoveClientOrObserver();
+ // This object may be dead here.
+}
+
+void Resource::didRemoveClientOrObserver()
+{
+ if (!hasClientsOrObservers()) {
RefPtrWillBeRawPtr<Resource> protect(this);
memoryCache()->makeDead(this);
- allClientsRemoved();
+ allClientsAndObserversRemoved();
// RFC2616 14.9.2:
// "no-store: ... MUST make a best-effort attempt to remove the information from volatile storage as promptly as possible"
@@ -647,7 +655,7 @@ void Resource::removeClient(ResourceClient* client)
// This object may be dead here.
}
-void Resource::allClientsRemoved()
+void Resource::allClientsAndObserversRemoved()
{
if (!m_loader)
return;
@@ -662,7 +670,7 @@ void Resource::allClientsRemoved()
void Resource::cancelTimerFired(Timer<Resource>* timer)
{
ASSERT_UNUSED(timer, timer == &m_cancelTimer);
- if (hasClients() || !m_loader)
+ if (hasClientsOrObservers() || !m_loader)
return;
RefPtrWillBeRawPtr<Resource> protect(this);
m_loader->cancelIfNotFinishing();
@@ -877,7 +885,7 @@ bool Resource::lock()
if (m_data->isLocked())
return true;
- ASSERT(!hasClients());
+ ASSERT(!hasClientsOrObservers());
// If locking fails, our buffer has been purged. There's no point
// in leaving a purged resource in MemoryCache.
@@ -903,20 +911,6 @@ void Resource::didChangePriority(ResourceLoadPriority loadPriority, int intraPri
m_loader->didChangePriority(loadPriority, intraPriorityValue);
}
-ResourcePriority Resource::priorityFromClients()
-{
- ResourcePriority priority;
- ResourceClientWalker<ResourceClient> walker(m_clients);
- while (ResourceClient* c = walker.next()) {
- ResourcePriority nextPriority = c->computeResourcePriority();
- if (nextPriority.visibility == ResourcePriority::NotVisible)
- continue;
- priority.visibility = ResourcePriority::Visible;
- priority.intraPriorityValue += nextPriority.intraPriorityValue;
- }
- return priority;
-}
-
Resource::ResourceCallback* Resource::ResourceCallback::callbackHandler()
{
// Oilpan + LSan: as the callbackHandler() singleton is used by Resource
diff --git a/third_party/WebKit/Source/core/fetch/Resource.h b/third_party/WebKit/Source/core/fetch/Resource.h
index 68d1c6b..d6fb851 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.h
+++ b/third_party/WebKit/Source/core/fetch/Resource.h
@@ -127,11 +127,11 @@ public:
ResourceLoaderOptions& mutableOptions() { return m_options; }
void didChangePriority(ResourceLoadPriority, int intraPriorityValue);
- ResourcePriority priorityFromClients();
+ virtual ResourcePriority priorityFromObservers() { return ResourcePriority(); }
void addClient(ResourceClient*);
void removeClient(ResourceClient*);
- bool hasClients() const { return !m_clients.isEmpty() || !m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); }
+ virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() || !m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); }
enum PreloadResult {
PreloadNotReferenced,
@@ -141,10 +141,6 @@ public:
};
PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m_preloadResult); }
- virtual void didAddClient(ResourceClient*);
- virtual void didRemoveClient(ResourceClient*) { }
- virtual void allClientsRemoved();
-
unsigned count() const { return m_clients.size(); }
Status getStatus() const { return static_cast<Status>(m_status); }
@@ -266,6 +262,13 @@ protected:
void finishPendingClients();
+ virtual void didAddClient(ResourceClient*);
+ void willAddClientOrObserver();
+
+ // |this| object may be dead after didRemoveClientOrObserver().
+ void didRemoveClientOrObserver();
+ virtual void allClientsAndObserversRemoved();
+
HashCountedSet<ResourceClient*> m_clients;
HashCountedSet<ResourceClient*> m_clientsAwaitingCallback;
HashCountedSet<ResourceClient*> m_finishedClients;
diff --git a/third_party/WebKit/Source/core/fetch/ResourceClient.h b/third_party/WebKit/Source/core/fetch/ResourceClient.h
index 41fe1bc..545886d 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceClient.h
+++ b/third_party/WebKit/Source/core/fetch/ResourceClient.h
@@ -26,7 +26,6 @@
#define ResourceClient_h
#include "core/CoreExport.h"
-#include "platform/network/ResourceLoadPriority.h"
#include "wtf/Forward.h"
#include "wtf/text/WTFString.h"
@@ -37,7 +36,6 @@ class CORE_EXPORT ResourceClient {
public:
enum ResourceClientType {
BaseResourceType,
- ImageType,
FontType,
StyleSheetType,
DocumentType,
@@ -51,8 +49,6 @@ public:
static bool isExpectedType(ResourceClient*) { return true; }
virtual ResourceClientType getResourceClientType() const { return BaseResourceType; }
- virtual ResourcePriority computeResourcePriority() const { return ResourcePriority(); }
-
// Name for debugging, e.g. shown in memory-infra.
virtual String debugName() const = 0;
diff --git a/third_party/WebKit/Source/core/fetch/ResourceClientWalker.h b/third_party/WebKit/Source/core/fetch/ResourceClientOrObserverWalker.h
index 0dbbc23..24f5504 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceClientWalker.h
+++ b/third_party/WebKit/Source/core/fetch/ResourceClientOrObserverWalker.h
@@ -22,8 +22,8 @@
pages from the web. It has a memory cache for these objects.
*/
-#ifndef ResourceClientWalker_h
-#define ResourceClientWalker_h
+#ifndef ResourceClientOrObserverWalker_h
+#define ResourceClientOrObserverWalker_h
#include "core/fetch/ResourceClient.h"
#include "wtf/Allocator.h"
@@ -34,10 +34,13 @@ namespace blink {
// Call this "walker" instead of iterator so people won't expect Qt or STL-style iterator interface.
// Just keep calling next() on this. It's safe from deletions of items.
-template<typename T> class ResourceClientWalker {
+// ClientOrObserver is either ResourceClient or ImageResourceObserver, so that
+// this walker can be used both for ResourceClient and ImageResourceObserver.
+template<typename ClientOrObserver, typename T>
+class ResourceClientOrObserverWalker {
STACK_ALLOCATED();
public:
- ResourceClientWalker(const HashCountedSet<ResourceClient*>& set)
+ explicit ResourceClientOrObserverWalker(const HashCountedSet<ClientOrObserver*>& set)
: m_clientSet(set), m_clientVector(set.size()), m_index(0)
{
size_t clientIndex = 0;
@@ -49,7 +52,7 @@ public:
{
size_t size = m_clientVector.size();
while (m_index < size) {
- ResourceClient* next = m_clientVector[m_index++];
+ ClientOrObserver* next = m_clientVector[m_index++];
if (m_clientSet.contains(next)) {
ASSERT(T::isExpectedType(next));
return static_cast<T*>(next);
@@ -59,11 +62,18 @@ public:
return 0;
}
private:
- const HashCountedSet<ResourceClient*>& m_clientSet;
- Vector<ResourceClient*> m_clientVector;
+ const HashCountedSet<ClientOrObserver*>& m_clientSet;
+ Vector<ClientOrObserver*> m_clientVector;
size_t m_index;
};
+template<typename T>
+struct ResourceClientWalker : public ResourceClientOrObserverWalker<ResourceClient, T> {
+public:
+ explicit ResourceClientWalker(const HashCountedSet<ResourceClient*>& set)
+ : ResourceClientOrObserverWalker<ResourceClient, T>(set) { }
+};
+
} // namespace blink
#endif
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index a5cc982..010832c 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -391,7 +391,7 @@ void ResourceFetcher::updateMemoryCacheStats(Resource* resource, RevalidationPol
// would be dead if MemoryCache holds weak references to Resource).
// Currently we check references to Resource from ResourceClient and
// |m_preloads| only, because they are major sources of references.
- if (resource && !resource->hasClients() && (!m_preloads || !m_preloads->contains(resource))) {
+ if (resource && !resource->hasClientsOrObservers() && (!m_preloads || !m_preloads->contains(resource))) {
DEFINE_RESOURCE_HISTOGRAM("Dead.");
}
}
@@ -470,7 +470,7 @@ PassRefPtrWillBeRawPtr<Resource> ResourceFetcher::requestResource(FetchRequest&
return nullptr;
}
- if (!resource->hasClients())
+ if (!resource->hasClientsOrObservers())
m_deadStatsRecorder.update(policy);
if (policy != Use)
@@ -1089,7 +1089,7 @@ void ResourceFetcher::updateAllImageResourcePriorities()
if (!resource->isImage())
continue;
- ResourcePriority resourcePriority = resource->priorityFromClients();
+ ResourcePriority resourcePriority = resource->priorityFromObservers();
ResourceLoadPriority resourceLoadPriority = loadPriority(Resource::Image, FetchRequest(resource->resourceRequest(), FetchInitiatorInfo()), resourcePriority.visibility);
if (resourceLoadPriority == resource->resourceRequest().priority())
continue;
diff --git a/third_party/WebKit/Source/core/fetch/ScriptResource.cpp b/third_party/WebKit/Source/core/fetch/ScriptResource.cpp
index 504192d..261454f 100644
--- a/third_party/WebKit/Source/core/fetch/ScriptResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ScriptResource.cpp
@@ -28,7 +28,7 @@
#include "core/fetch/FetchRequest.h"
#include "core/fetch/IntegrityMetadata.h"
-#include "core/fetch/ResourceClientWalker.h"
+#include "core/fetch/ResourceClientOrObserverWalker.h"
#include "core/fetch/ResourceFetcher.h"
#include "platform/MIMETypeRegistry.h"
#include "platform/SharedBuffer.h"
diff --git a/third_party/WebKit/Source/core/fetch/XSLStyleSheetResource.cpp b/third_party/WebKit/Source/core/fetch/XSLStyleSheetResource.cpp
index 82f5f94..9d77f22 100644
--- a/third_party/WebKit/Source/core/fetch/XSLStyleSheetResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/XSLStyleSheetResource.cpp
@@ -27,7 +27,7 @@
#include "core/fetch/XSLStyleSheetResource.h"
#include "core/fetch/FetchRequest.h"
-#include "core/fetch/ResourceClientWalker.h"
+#include "core/fetch/ResourceClientOrObserverWalker.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/StyleSheetResourceClient.h"
#include "platform/RuntimeEnabledFeatures.h"
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
index 03f6bbd..68c9f93 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
@@ -35,7 +35,7 @@
#include "core/dom/Document.h"
#include "core/fetch/ImageResource.h"
#include "core/fetch/MemoryCache.h"
-#include "core/fetch/MockImageResourceClient.h"
+#include "core/fetch/MockResourceClients.h"
#include "core/html/HTMLCanvasElement.h"
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLVideoElement.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutImage.cpp b/third_party/WebKit/Source/core/layout/LayoutImage.cpp
index ddef161..bb23422 100644
--- a/third_party/WebKit/Source/core/layout/LayoutImage.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutImage.cpp
@@ -89,7 +89,7 @@ void LayoutImage::setImageResource(PassOwnPtrWillBeRawPtr<LayoutImageResource> i
{
ASSERT(!m_imageResource);
m_imageResource = imageResource;
- m_imageResource->initialize(this);
+ m_imageResource->initialize(this, this);
}
void LayoutImage::imageChanged(WrappedImagePtr newImage, const IntRect* rect)
diff --git a/third_party/WebKit/Source/core/layout/LayoutImage.h b/third_party/WebKit/Source/core/layout/LayoutImage.h
index b162c7e..c81ed4e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutImage.h
+++ b/third_party/WebKit/Source/core/layout/LayoutImage.h
@@ -26,6 +26,7 @@
#define LayoutImage_h
#include "core/CoreExport.h"
+#include "core/fetch/ResourceClient.h"
#include "core/layout/LayoutImageResource.h"
#include "core/layout/LayoutReplaced.h"
@@ -43,7 +44,7 @@ class HTMLMapElement;
//
// The class is image type agnostic as it only manipulates decoded images.
// See LayoutImageResource that holds this image.
-class CORE_EXPORT LayoutImage : public LayoutReplaced {
+class CORE_EXPORT LayoutImage : public LayoutReplaced, public ResourceClient {
public:
// These are the paddings to use when displaying either alt text or an image.
static const unsigned short paddingWidth = 4;
@@ -77,6 +78,7 @@ public:
}
const char* name() const override { return "LayoutImage"; }
+ String debugName() const final { return LayoutObject::debugName(); }
protected:
bool needsPreferredWidthsRecalculation() const final;
diff --git a/third_party/WebKit/Source/core/layout/LayoutImageResource.cpp b/third_party/WebKit/Source/core/layout/LayoutImageResource.cpp
index a873c99..ed4aab3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutImageResource.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutImageResource.cpp
@@ -36,6 +36,7 @@ namespace blink {
LayoutImageResource::LayoutImageResource()
: m_layoutObject(nullptr)
, m_cachedImage(nullptr)
+ , m_client(nullptr)
{
}
@@ -43,19 +44,23 @@ LayoutImageResource::~LayoutImageResource()
{
}
-void LayoutImageResource::initialize(LayoutObject* layoutObject)
+void LayoutImageResource::initialize(LayoutObject* layoutObject, ResourceClient* client)
{
ASSERT(!m_layoutObject);
ASSERT(layoutObject);
m_layoutObject = layoutObject;
+ m_client = client;
}
void LayoutImageResource::shutdown()
{
ASSERT(m_layoutObject);
- if (m_cachedImage)
- m_cachedImage->removeClient(m_layoutObject);
+ if (!m_cachedImage)
+ return;
+ if (m_client)
+ m_cachedImage->removeClient(m_client);
+ m_cachedImage->removeObserver(m_layoutObject);
}
void LayoutImageResource::setImageResource(ImageResource* newImage)
@@ -65,11 +70,16 @@ void LayoutImageResource::setImageResource(ImageResource* newImage)
if (m_cachedImage == newImage)
return;
- if (m_cachedImage)
- m_cachedImage->removeClient(m_layoutObject);
+ if (m_cachedImage) {
+ if (m_client)
+ m_cachedImage->removeClient(m_client);
+ m_cachedImage->removeObserver(m_layoutObject);
+ }
m_cachedImage = newImage;
if (m_cachedImage) {
- m_cachedImage->addClient(m_layoutObject);
+ if (m_client)
+ m_cachedImage->addClient(m_client);
+ m_cachedImage->addObserver(m_layoutObject);
if (m_cachedImage->errorOccurred())
m_layoutObject->imageChanged(m_cachedImage.get());
} else {
diff --git a/third_party/WebKit/Source/core/layout/LayoutImageResource.h b/third_party/WebKit/Source/core/layout/LayoutImageResource.h
index 9680c5a..9b87daf 100644
--- a/third_party/WebKit/Source/core/layout/LayoutImageResource.h
+++ b/third_party/WebKit/Source/core/layout/LayoutImageResource.h
@@ -44,7 +44,7 @@ public:
return adoptPtrWillBeNoop(new LayoutImageResource);
}
- virtual void initialize(LayoutObject*);
+ virtual void initialize(LayoutObject*, ResourceClient*);
virtual void shutdown();
void setImageResource(ImageResource*);
@@ -69,6 +69,7 @@ protected:
LayoutImageResource();
LayoutObject* m_layoutObject;
RefPtrWillBeMember<ImageResource> m_cachedImage;
+ ResourceClient* m_client;
};
} // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp b/third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp
index 390a214..017015c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp
@@ -44,9 +44,9 @@ LayoutImageResourceStyleImage::~LayoutImageResourceStyleImage()
ASSERT(!m_cachedImage);
}
-void LayoutImageResourceStyleImage::initialize(LayoutObject* layoutObject)
+void LayoutImageResourceStyleImage::initialize(LayoutObject* layoutObject, ResourceClient* client)
{
- LayoutImageResource::initialize(layoutObject);
+ LayoutImageResource::initialize(layoutObject, client);
if (m_styleImage->isImageResource())
m_cachedImage = toStyleFetchedImage(m_styleImage)->cachedImage();
diff --git a/third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.h b/third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.h
index 0cc4051..9ef29b1 100644
--- a/third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.h
+++ b/third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.h
@@ -42,7 +42,7 @@ public:
{
return adoptPtrWillBeNoop(new LayoutImageResourceStyleImage(styleImage));
}
- void initialize(LayoutObject*) override;
+ void initialize(LayoutObject*, ResourceClient*) override;
void shutdown() override;
bool hasImage() const override { return true; }
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index b2d442b..ebd750e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -245,8 +245,7 @@ static WTF::RefCountedLeakCounter& layoutObjectCounter()
#endif
LayoutObject::LayoutObject(Node* node)
- : ImageResourceClient()
- , m_style(nullptr)
+ : m_style(nullptr)
, m_node(node)
, m_parent(nullptr)
, m_previous(nullptr)
@@ -3221,7 +3220,7 @@ void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions)
regions.append(region);
}
-bool LayoutObject::willRenderImage(ImageResource*)
+bool LayoutObject::willRenderImage()
{
// Without visibility we won't render (and therefore don't care about animation).
if (style()->visibility() != VISIBLE)
@@ -3236,7 +3235,7 @@ bool LayoutObject::willRenderImage(ImageResource*)
return document().view()->isVisible();
}
-bool LayoutObject::getImageAnimationPolicy(ImageResource*, ImageAnimationPolicy& policy)
+bool LayoutObject::getImageAnimationPolicy(ImageAnimationPolicy& policy)
{
if (!document().settings())
return false;
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h
index 47360a2..61d5f92 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -31,7 +31,7 @@
#include "core/dom/DocumentLifecycle.h"
#include "core/dom/Element.h"
#include "core/editing/PositionWithAffinity.h"
-#include "core/fetch/ImageResourceClient.h"
+#include "core/fetch/ImageResourceObserver.h"
#include "core/html/HTMLElement.h"
#include "core/inspector/InspectorTraceEvents.h"
#include "core/layout/HitTestRequest.h"
@@ -155,7 +155,7 @@ const int showTreeCharacterOffset = 39;
// storage for children. Descendant classes that do allow children have to have a LayoutObjectChildList
// member that stores the actual children and override virtualChildren().
//
-// LayoutObject is an ImageResourceClient, which means that it gets notified when associated images
+// LayoutObject is an ImageResourceObserver, which means that it gets notified when associated images
// are changed. This is used for 2 main use cases:
// - reply to 'background-image' as we need to invalidate the background in this case.
// (See https://drafts.csswg.org/css-backgrounds-3/#the-background-image)
@@ -209,7 +209,7 @@ const int showTreeCharacterOffset = 39;
// preferredLogicalWidthsDirty.
//
// See the individual getters below for more details about what each width is.
-class CORE_EXPORT LayoutObject : public ImageResourceClient, public DisplayItemClient {
+class CORE_EXPORT LayoutObject : public ImageResourceObserver, public DisplayItemClient {
friend class LayoutObjectChildList;
WTF_MAKE_NONCOPYABLE(LayoutObject);
public:
@@ -227,7 +227,7 @@ public:
// DisplayItemClient methods.
LayoutRect visualRect() const override;
- String debugName() const final;
+ String debugName() const override;
LayoutObject* parent() const { return m_parent; }
bool isDescendantOf(const LayoutObject*) const;
@@ -1225,10 +1225,10 @@ public:
virtual int previousOffsetForBackwardDeletion(int current) const;
- // ImageResourceClient override.
+ // ImageResourceObserver override.
void imageChanged(ImageResource*, const IntRect* = nullptr) final;
- bool willRenderImage(ImageResource*) final;
- bool getImageAnimationPolicy(ImageResource*, ImageAnimationPolicy&) final;
+ bool willRenderImage() final;
+ bool getImageAnimationPolicy(ImageAnimationPolicy&) final;
// Sub-classes that have an associated image need to override this function
// to get notified of any image change.
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp
index ccb9c17..5a8bf3a 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp
@@ -47,7 +47,7 @@ LayoutSVGImage::LayoutSVGImage(SVGImageElement* impl)
, m_needsTransformUpdate(true)
, m_imageResource(LayoutImageResource::create())
{
- m_imageResource->initialize(this);
+ m_imageResource->initialize(this, nullptr);
}
LayoutSVGImage::~LayoutSVGImage()
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.cpp b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
index ad037d8..4c1b72a 100644
--- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
@@ -181,6 +181,7 @@ void ImageLoader::dispose()
if (m_image) {
m_image->removeClient(this);
+ m_image->removeObserver(this);
m_image = nullptr;
}
@@ -225,10 +226,14 @@ void ImageLoader::setImageWithoutConsideringPendingLoadEvent(ImageResource* newI
m_hasPendingErrorEvent = false;
}
m_imageComplete = true;
- if (newImage)
+ if (newImage) {
newImage->addClient(this);
- if (oldImage)
+ newImage->addObserver(this);
+ }
+ if (oldImage) {
oldImage->removeClient(this);
+ oldImage->removeObserver(this);
+ }
}
if (LayoutImageResource* imageResource = layoutImageResource())
@@ -367,11 +372,14 @@ void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, Up
updateLayoutObject();
// If newImage exists and is cached, addClient() will result in the load event
// being queued to fire. Ensure this happens after beforeload is dispatched.
- if (newImage)
+ if (newImage) {
newImage->addClient(this);
-
- if (oldImage)
+ newImage->addObserver(this);
+ }
+ if (oldImage) {
oldImage->removeClient(this);
+ oldImage->removeObserver(this);
+ }
}
if (LayoutImageResource* imageResource = layoutImageResource())
@@ -409,8 +417,10 @@ void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior, Re
// an asynchronous load completes.
if (imageSourceURL.isEmpty()) {
ImageResource* image = m_image.get();
- if (image)
+ if (image) {
image->removeClient(this);
+ image->removeObserver(this);
+ }
m_image = nullptr;
}
@@ -605,7 +615,7 @@ void ImageLoader::dispatchPendingErrorEvent()
updatedHasPendingEvent();
}
-bool ImageLoader::getImageAnimationPolicy(ImageResource*, ImageAnimationPolicy& policy)
+bool ImageLoader::getImageAnimationPolicy(ImageAnimationPolicy& policy)
{
if (!element()->document().settings())
return false;
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.h b/third_party/WebKit/Source/core/loader/ImageLoader.h
index 30ad783..abb6414 100644
--- a/third_party/WebKit/Source/core/loader/ImageLoader.h
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.h
@@ -25,7 +25,8 @@
#include "core/CoreExport.h"
#include "core/fetch/ImageResource.h"
-#include "core/fetch/ImageResourceClient.h"
+#include "core/fetch/ImageResourceObserver.h"
+#include "core/fetch/ResourceClient.h"
#include "platform/heap/Handle.h"
#include "wtf/HashSet.h"
#include "wtf/WeakPtr.h"
@@ -43,7 +44,7 @@ class LayoutImageResource;
template<typename T> class EventSender;
using ImageEventSender = EventSender<ImageLoader>;
-class CORE_EXPORT ImageLoader : public NoBaseWillBeGarbageCollectedFinalized<ImageLoader>, public ImageResourceClient {
+class CORE_EXPORT ImageLoader : public NoBaseWillBeGarbageCollectedFinalized<ImageLoader>, public ResourceClient, public ImageResourceObserver {
WILL_BE_USING_PRE_FINALIZER(ImageLoader, dispose);
USING_FAST_MALLOC_WILL_BE_REMOVED(ImageLoader);
public:
@@ -101,7 +102,7 @@ public:
static void dispatchPendingLoadEvents();
static void dispatchPendingErrorEvents();
- bool getImageAnimationPolicy(ImageResource*, ImageAnimationPolicy&) final;
+ bool getImageAnimationPolicy(ImageAnimationPolicy&) final;
protected:
void notifyFinished(Resource*) override;
diff --git a/third_party/WebKit/Source/core/loader/LinkPreloadResourceClients.h b/third_party/WebKit/Source/core/loader/LinkPreloadResourceClients.h
index fddaa2f..c9029c4 100644
--- a/third_party/WebKit/Source/core/loader/LinkPreloadResourceClients.h
+++ b/third_party/WebKit/Source/core/loader/LinkPreloadResourceClients.h
@@ -8,7 +8,6 @@
#include "core/fetch/CSSStyleSheetResource.h"
#include "core/fetch/FontResource.h"
#include "core/fetch/ImageResource.h"
-#include "core/fetch/ImageResourceClient.h"
#include "core/fetch/RawResource.h"
#include "core/fetch/ResourceLoader.h"
#include "core/fetch/ResourceOwner.h"
@@ -110,7 +109,7 @@ private:
}
};
-class LinkPreloadImageResourceClient: public LinkPreloadResourceClient, public ResourceOwner<ImageResource, ImageResourceClient> {
+class LinkPreloadImageResourceClient: public LinkPreloadResourceClient, public ResourceOwner<ImageResource> {
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LinkPreloadImageResourceClient);
USING_FAST_MALLOC_WILL_BE_REMOVED(LinkPreloadImageResourceClient);
public:
@@ -133,7 +132,7 @@ public:
DEFINE_INLINE_VIRTUAL_TRACE()
{
LinkPreloadResourceClient::trace(visitor);
- ResourceOwner<ImageResource, ImageResourceClient>::trace(visitor);
+ ResourceOwner<ImageResource>::trace(visitor);
}
private:
diff --git a/third_party/WebKit/Source/core/style/StyleFetchedImage.cpp b/third_party/WebKit/Source/core/style/StyleFetchedImage.cpp
index 135b2b44..853b899 100644
--- a/third_party/WebKit/Source/core/style/StyleFetchedImage.cpp
+++ b/third_party/WebKit/Source/core/style/StyleFetchedImage.cpp
@@ -116,12 +116,12 @@ bool StyleFetchedImage::usesImageContainerSize() const
void StyleFetchedImage::addClient(LayoutObject* layoutObject)
{
- m_image->addClient(layoutObject);
+ m_image->addObserver(layoutObject);
}
void StyleFetchedImage::removeClient(LayoutObject* layoutObject)
{
- m_image->removeClient(layoutObject);
+ m_image->removeObserver(layoutObject);
}
void StyleFetchedImage::notifyFinished(Resource* resource)
diff --git a/third_party/WebKit/Source/core/style/StyleFetchedImage.h b/third_party/WebKit/Source/core/style/StyleFetchedImage.h
index 4cf22ee..5bda657 100644
--- a/third_party/WebKit/Source/core/style/StyleFetchedImage.h
+++ b/third_party/WebKit/Source/core/style/StyleFetchedImage.h
@@ -24,7 +24,7 @@
#ifndef StyleFetchedImage_h
#define StyleFetchedImage_h
-#include "core/fetch/ImageResourceClient.h"
+#include "core/fetch/ResourceClient.h"
#include "core/style/StyleImage.h"
namespace blink {
@@ -32,7 +32,7 @@ namespace blink {
class Document;
class ImageResource;
-class StyleFetchedImage final : public StyleImage, private ImageResourceClient {
+class StyleFetchedImage final : public StyleImage, private ResourceClient {
USING_FAST_MALLOC_WILL_BE_REMOVED(StyleFetchedImage);
WILL_BE_USING_PRE_FINALIZER(StyleFetchedImage, dispose);
public:
diff --git a/third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp b/third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp
index 6c7b5e6..18158dd 100644
--- a/third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp
+++ b/third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp
@@ -120,12 +120,12 @@ bool StyleFetchedImageSet::usesImageContainerSize() const
void StyleFetchedImageSet::addClient(LayoutObject* layoutObject)
{
- m_bestFitImage->addClient(layoutObject);
+ m_bestFitImage->addObserver(layoutObject);
}
void StyleFetchedImageSet::removeClient(LayoutObject* layoutObject)
{
- m_bestFitImage->removeClient(layoutObject);
+ m_bestFitImage->removeObserver(layoutObject);
}
PassRefPtr<Image> StyleFetchedImageSet::image(const LayoutObject&, const IntSize& containerSize, float zoom) const
diff --git a/third_party/WebKit/Source/core/style/StyleFetchedImageSet.h b/third_party/WebKit/Source/core/style/StyleFetchedImageSet.h
index 0d6ba2c..f45652e 100644
--- a/third_party/WebKit/Source/core/style/StyleFetchedImageSet.h
+++ b/third_party/WebKit/Source/core/style/StyleFetchedImageSet.h
@@ -26,7 +26,7 @@
#ifndef StyleFetchedImageSet_h
#define StyleFetchedImageSet_h
-#include "core/fetch/ImageResourceClient.h"
+#include "core/fetch/ResourceClient.h"
#include "core/style/StyleImage.h"
#include "platform/geometry/LayoutSize.h"
@@ -37,7 +37,7 @@ class CSSImageSetValue;
// This class keeps one cached image and has access to a set of alternatives.
-class StyleFetchedImageSet final : public StyleImage, private ImageResourceClient {
+class StyleFetchedImageSet final : public StyleImage, private ResourceClient {
USING_FAST_MALLOC_WILL_BE_REMOVED(StyleFetchedImageSet);
WILL_BE_USING_PRE_FINALIZER(StyleFetchedImageSet, dispose);
public:
diff --git a/third_party/WebKit/Source/core/svg/SVGFEImageElement.h b/third_party/WebKit/Source/core/svg/SVGFEImageElement.h
index 4df7845..ae6b4f5 100644
--- a/third_party/WebKit/Source/core/svg/SVGFEImageElement.h
+++ b/third_party/WebKit/Source/core/svg/SVGFEImageElement.h
@@ -23,7 +23,7 @@
#include "core/SVGNames.h"
#include "core/fetch/ImageResource.h"
-#include "core/fetch/ImageResourceClient.h"
+#include "core/fetch/ResourceClient.h"
#include "core/svg/SVGAnimatedPreserveAspectRatio.h"
#include "core/svg/SVGFilterPrimitiveStandardAttributes.h"
#include "core/svg/SVGURIReference.h"
@@ -33,7 +33,7 @@ namespace blink {
class SVGFEImageElement final : public SVGFilterPrimitiveStandardAttributes,
public SVGURIReference,
- public ImageResourceClient {
+ public ResourceClient {
DEFINE_WRAPPERTYPEINFO();
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SVGFEImageElement);
public: