Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(678)

Unified Diff: third_party/WebKit/Source/core/fetch/ImageResource.h

Issue 1706083002: Split ImageResourceClient into ResourceClient and ImageResourceObserver [1/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/ImageResource.h
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.h b/third_party/WebKit/Source/core/fetch/ImageResource.h
index db8c6abf680b25e6e1f25d513f8593a089d87b8a..74849d11100ab7b7f7cf75db72ba5faf588d9bd9 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);
« no previous file with comments | « third_party/WebKit/Source/core/fetch/FontResource.cpp ('k') | third_party/WebKit/Source/core/fetch/ImageResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698