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 6e6887e0ec428ecc9050444895f085767a74369f..ecb936c44e5669fdafb3a5fcaa83c663ec335f6d 100644 |
--- a/third_party/WebKit/Source/core/fetch/Resource.h |
+++ b/third_party/WebKit/Source/core/fetch/Resource.h |
@@ -87,6 +87,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()) |
{ |
@@ -132,7 +139,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(); } |
@@ -263,7 +273,7 @@ protected: |
void finishPendingClients(); |
virtual void didAddClient(ResourceClient*); |
- void willAddClientOrObserver(); |
+ void willAddClientOrObserver(PreloadReferencePolicy); |
// |this| object may be dead after didRemoveClientOrObserver(). |
void didRemoveClientOrObserver(); |