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: Source/core/fetch/Resource.h

Issue 929953002: CachedMetadata support for ServiceWorker script. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated tkent's comment Created 5 years, 10 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
« no previous file with comments | « Source/core/fetch/CachedMetadataHandler.h ('k') | Source/core/fetch/Resource.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/core/fetch/CachedMetadataHandler.h ('k') | Source/core/fetch/Resource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698