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 fb32fc9cb99bbfe20480f148aad71201944379dc..02bbcd6bf51327b8497d40a78f3b0e7769541f28 100644 |
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp |
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp |
@@ -594,10 +594,9 @@ static bool shouldSendCachedDataSynchronouslyForType(Resource::Type type) |
return false; |
} |
-void Resource::addClient(ResourceClient* client) |
+void Resource::willAddClient() |
{ |
ASSERT(!isPurgeable()); |
- |
if (m_preloadResult == PreloadNotReferenced) { |
if (isLoaded()) |
m_preloadResult = PreloadReferencedWhileComplete; |
@@ -608,6 +607,11 @@ void Resource::addClient(ResourceClient* client) |
} |
if (!hasClients()) |
memoryCache()->makeLive(this); |
+} |
+ |
+void Resource::addClient(ResourceClient* client) |
+{ |
+ willAddClient(); |
if (!m_revalidatingRequest.isNull()) { |
m_clients.add(client); |
@@ -636,11 +640,15 @@ void Resource::removeClient(ResourceClient* client) |
else |
m_clients.remove(client); |
- didRemoveClient(client); |
- |
if (m_clientsAwaitingCallback.isEmpty()) |
ResourceCallback::callbackHandler()->cancel(this); |
+ didRemoveClient(); |
+ // This object may be dead here. |
+} |
+ |
+void Resource::didRemoveClient() |
+{ |
if (!hasClients()) { |
RefPtrWillBeRawPtr<Resource> protect(this); |
memoryCache()->makeDead(this); |
@@ -914,20 +922,6 @@ void Resource::didChangePriority(ResourceLoadPriority loadPriority, int intraPri |
m_loader->didChangePriority(loadPriority, intraPriorityValue); |
} |
-ResourcePriority Resource::priorityFromClients() |
-{ |
- ResourcePriority priority; |
- ResourceClientWalker<ResourceClient> walker(m_clients); |
- while (ResourceClient* c = walker.next()) { |
- ResourcePriority nextPriority = c->computeResourcePriority(); |
- if (nextPriority.visibility == ResourcePriority::NotVisible) |
- continue; |
- priority.visibility = ResourcePriority::Visible; |
- priority.intraPriorityValue += nextPriority.intraPriorityValue; |
- } |
- return priority; |
-} |
- |
Resource::ResourceCallback* Resource::ResourceCallback::callbackHandler() |
{ |
// Oilpan + LSan: as the callbackHandler() singleton is used by Resource |