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

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

Issue 2130683002: [Experiment] purge-and-suspend Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 5 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.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index da4ad55da5b1c081add729780ce15ac690f786bc..22e0462b45fe97a13f322aa74fae3c4116c4dbcd 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -30,6 +30,7 @@
#include "core/fetch/ResourceClient.h"
#include "core/fetch/ResourceClientOrObserverWalker.h"
#include "core/fetch/ResourceLoader.h"
+#include "core/fetch/ScriptResource.h"
#include "core/inspector/InstanceCounters.h"
#include "platform/Histogram.h"
#include "platform/Logging.h"
@@ -109,6 +110,8 @@ public:
// Sets the serialized metadata retrieved from the platform's cache.
void setSerializedCachedMetadata(const char*, size_t);
+ void prune() override;
+
protected:
explicit CachedMetadataHandlerImpl(Resource*);
virtual void sendToPlatform();
@@ -180,6 +183,11 @@ void Resource::CachedMetadataHandlerImpl::sendToPlatform()
}
}
+void Resource::CachedMetadataHandlerImpl::prune()
+{
+ clearCachedMetadata(CachedMetadataHandler::CacheLocally);
+}
+
class Resource::ServiceWorkerResponseCachedMetadataHandler : public Resource::CachedMetadataHandlerImpl {
public:
static Resource::CachedMetadataHandlerImpl* create(Resource* resource, SecurityOrigin* securityOrigin)
@@ -831,6 +839,8 @@ void Resource::finishPendingClients()
void Resource::prune()
{
destroyDecodedDataIfPossible();
+ if (m_cacheHandler)
+ m_cacheHandler->prune();
unlock();
}

Powered by Google App Engine
This is Rietveld 408576698