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

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

Issue 1706083002: Split ImageResourceClient into ResourceClient and ImageResourceObserver [1/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reflect comments and 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/Resource.h
diff --git a/third_party/WebKit/Source/core/fetch/Resource.h b/third_party/WebKit/Source/core/fetch/Resource.h
index de7f4d70cc27b8cf8f3512838623d5e1cff7cd3a..351b78d568cf96e97c5a9b1b4ef020587018564d 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.h
+++ b/third_party/WebKit/Source/core/fetch/Resource.h
@@ -127,11 +127,11 @@ public:
void setOptions(const ResourceLoaderOptions& options) { m_options = 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,
@@ -142,8 +142,10 @@ public:
PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m_preloadResult); }
virtual void didAddClient(ResourceClient*);
yhirano 2016/03/17 04:44:57 I think placing these two functions and willAddCli
hiroshige 2016/03/23 18:47:25 Done. Also make them protected.
- virtual void didRemoveClient(ResourceClient*) { }
- virtual void allClientsRemoved();
+
+ // |this| object may be dead after didRemoveClientOrObserver().
+ void didRemoveClientOrObserver();
+ virtual void allClientsAndObserversRemoved();
unsigned count() const { return m_clients.size(); }
@@ -267,6 +269,8 @@ protected:
void finishPendingClients();
+ void willAddClientOrObserver();
+
HashCountedSet<ResourceClient*> m_clients;
HashCountedSet<ResourceClient*> m_clientsAwaitingCallback;
HashCountedSet<ResourceClient*> m_finishedClients;

Powered by Google App Engine
This is Rietveld 408576698