| Index: third_party/WebKit/Source/core/inspector/InspectorResourceAgent.cpp
|
| diff --git a/third_party/WebKit/Source/core/inspector/InspectorResourceAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorResourceAgent.cpp
|
| index e1ddb5588dc6f4207fd02cb1937250ef7f7babe2..473835c7598d44adbef87916c615ff6dc2ecbf91 100644
|
| --- a/third_party/WebKit/Source/core/inspector/InspectorResourceAgent.cpp
|
| +++ b/third_party/WebKit/Source/core/inspector/InspectorResourceAgent.cpp
|
| @@ -569,12 +569,11 @@ void InspectorResourceAgent::didReceiveResourceResponse(LocalFrame* frame, unsig
|
| if (type == InspectorPageAgent::DocumentResource && loader && loader->substituteData().isValid())
|
| return;
|
|
|
| - // It's only safe to reference a Resource in m_resourcesData if it's in the
|
| - // cache at this point. Resources are added to NetworkResourcesData here
|
| - // and removed in removedResourceFromMemoryCache(), so if the Resource isn't
|
| - // in the cache here, NetworkResourceData's strong reference to the
|
| - // Resource will keep it alive indefinitely.
|
| - if (cachedResource && memoryCache()->contains(cachedResource))
|
| + // Resources are added to NetworkResourcesData as a WeakMember here and
|
| + // removed in willDestroyResource() called in the prefinalizer of Resource.
|
| + // Because NetworkResourceData retains weak references only, it
|
| + // doesn't affect Resource lifetime.
|
| + if (cachedResource)
|
| m_resourcesData->addResource(requestId, cachedResource);
|
| String frameId = IdentifiersFactory::frameId(frame);
|
| String loaderId = loader ? IdentifiersFactory::loaderId(loader) : "";
|
| @@ -778,7 +777,7 @@ void InspectorResourceAgent::didFinishEventSourceRequest(ThreadableLoaderClient*
|
| clearPendingRequestData();
|
| }
|
|
|
| -void InspectorResourceAgent::removedResourceFromMemoryCache(Resource* cachedResource)
|
| +void InspectorResourceAgent::willDestroyResource(Resource* cachedResource)
|
| {
|
| // Mark loaded resources or resources without the buffer as loaded.
|
| if (cachedResource->isLoaded() || !cachedResource->resourceBuffer()) {
|
|
|