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 c24152b112d4d4a7d46fc4813869e50f68556857..d67dd4596d28ddef69fa9392b8daee81c93e1a01 100644 |
--- a/third_party/WebKit/Source/core/fetch/Resource.h |
+++ b/third_party/WebKit/Source/core/fetch/Resource.h |
@@ -86,6 +86,13 @@ public: |
DecodeError |
}; |
+ // Whether a resource client for a preload should mark the preload as |
+ // referenced. |
+ enum PreloadReferencePolicy { |
+ MarkAsReferenced, |
+ DontMarkAsReferenced, |
+ }; |
+ |
// Exposed for testing. |
static Resource* create(const ResourceRequest& request, Type type, const ResourceLoaderOptions& options = ResourceLoaderOptions()) |
{ |
@@ -131,7 +138,10 @@ public: |
void didChangePriority(ResourceLoadPriority, int intraPriorityValue); |
virtual ResourcePriority priorityFromObservers() { return ResourcePriority(); } |
- void addClient(ResourceClient*); |
+ // The reference policy indicates that the client should not affect whether |
+ // a preload is considered referenced or not. This allows for "passive" |
+ // resource clients that simply observe the resource. |
+ void addClient(ResourceClient*, PreloadReferencePolicy = MarkAsReferenced); |
void removeClient(ResourceClient*); |
virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() || !m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); } |
@@ -258,7 +268,7 @@ protected: |
void finishPendingClients(); |
virtual void didAddClient(ResourceClient*); |
- void willAddClientOrObserver(); |
+ void willAddClientOrObserver(PreloadReferencePolicy); |
// |this| object may be dead after didRemoveClientOrObserver(). |
void didRemoveClientOrObserver(); |