Index: Source/core/fetch/Resource.h |
diff --git a/Source/core/fetch/Resource.h b/Source/core/fetch/Resource.h |
index 24db9ae9e8a6fde1f9911486acacebe495eaa289..8bf27cd6791602b91b610269e4969227ba28592e 100644 |
--- a/Source/core/fetch/Resource.h |
+++ b/Source/core/fetch/Resource.h |
@@ -23,6 +23,7 @@ |
#ifndef Resource_h |
#define Resource_h |
+#include "core/fetch/CachedMetadataHandler.h" |
#include "core/fetch/ResourceLoaderOptions.h" |
#include "platform/Timer.h" |
#include "platform/network/ResourceError.h" |
@@ -83,11 +84,6 @@ public: |
DecodeError |
}; |
- enum MetadataCacheType { |
- SendToPlatform, // send cache data to blink::Platform::cacheMetadata |
- CacheLocally // cache only in Resource's member variables |
- }; |
- |
Resource(const ResourceRequest&, Type); |
#if ENABLE(OILPAN) |
virtual ~Resource(); |
@@ -198,16 +194,8 @@ public: |
// Sets the serialized metadata retrieved from the platform's cache. |
virtual void setSerializedCachedMetadata(const char*, size_t); |
- // Caches the given metadata in association with this resource and suggests |
- // that the platform persist it. The dataTypeID is a pseudo-randomly chosen |
- // identifier that is used to distinguish data generated by the caller. |
- void setCachedMetadata(unsigned dataTypeID, const char*, size_t, MetadataCacheType = SendToPlatform); |
- |
- // Reset existing metadata, to allow setting new data. |
- void clearCachedMetadata(MetadataCacheType = CacheLocally); |
- |
- // Returns cached metadata of the given type associated with this resource. |
- CachedMetadata* cachedMetadata(unsigned dataTypeID) const; |
+ // This may return nullptr when the resource isn't cacheable. |
+ CachedMetadataHandler* cacheHandler(); |
bool hasOneHandle() const; |
bool canDelete() const; |
@@ -351,6 +339,7 @@ protected: |
Timer<Resource> m_cancelTimer; |
private: |
+ class CacheHandler; |
bool addClientToSet(ResourceClient*); |
void cancelTimerFired(Timer<Resource>*); |
@@ -363,9 +352,14 @@ private: |
void failBeforeStarting(); |
+ void setCachedMetadata(unsigned dataTypeID, const char*, size_t, CachedMetadataHandler::CacheType); |
+ void clearCachedMetadata(CachedMetadataHandler::CacheType); |
+ CachedMetadata* cachedMetadata(unsigned dataTypeID) const; |
+ |
String m_fragmentIdentifierForRequest; |
RefPtr<CachedMetadata> m_cachedMetadata; |
+ OwnPtr<CacheHandler> m_cacheHandler; |
ResourceError m_error; |