| Index: Source/core/fetch/Resource.cpp
|
| diff --git a/Source/core/fetch/Resource.cpp b/Source/core/fetch/Resource.cpp
|
| index 8de53059160fd0e7cf8cb2198f29297b80c8bb0f..a58d4e3819ecf82bf45a6d62c936a9f4f387ce1a 100644
|
| --- a/Source/core/fetch/Resource.cpp
|
| +++ b/Source/core/fetch/Resource.cpp
|
| @@ -364,6 +364,11 @@ bool Resource::unlock()
|
| return true;
|
| }
|
|
|
| +bool Resource::hasRightHandleCountApartFromCache(unsigned targetCount) const
|
| +{
|
| + return m_handleCount == targetCount + memoryCache()->contains(this);
|
| +}
|
| +
|
| void Resource::responseReceived(const ResourceResponse& response)
|
| {
|
| setResponse(response);
|
| @@ -403,6 +408,17 @@ void Resource::setCachedMetadata(unsigned dataTypeID, const char* data, size_t s
|
| blink::Platform::current()->cacheMetadata(m_response.url(), m_response.responseTime(), serializedData.data(), serializedData.size());
|
| }
|
|
|
| +bool Resource::canDelete() const
|
| +{
|
| + return !hasClients() && !m_loader && !m_preloadCount && hasRightHandleCountApartFromCache(0)
|
| + && !m_protectorCount && !m_resourceToRevalidate && !m_proxyResource;
|
| +}
|
| +
|
| +bool Resource::hasOneHandleApartFromCache() const
|
| +{
|
| + return hasRightHandleCountApartFromCache(1);
|
| +}
|
| +
|
| CachedMetadata* Resource::cachedMetadata(unsigned dataTypeID) const
|
| {
|
| if (!m_cachedMetadata || m_cachedMetadata->dataTypeID() != dataTypeID)
|
| @@ -771,6 +787,8 @@ void Resource::unregisterHandle(ResourcePtrBase* h)
|
| unlock();
|
| } else if (m_handleCount == 1 && memoryCache()->contains(this)) {
|
| unlock();
|
| + if (!hasClients())
|
| + memoryCache()->prune(this);
|
| }
|
| }
|
|
|
|
|