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

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

Issue 1928823002: Simplifying finishing a load on Resource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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/ResourceLoader.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp
index 048e1018c6cec0784fa2077e199aeb2a61249805..adacfcb35e94fdcefeea1ec8e005821e01227ddc 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp
@@ -180,7 +180,6 @@ void ResourceLoader::cancel(const ResourceError& error)
WTF_LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().getString().latin1().data());
m_state = ConnectionStateCanceled;
- m_resource->setResourceError(nonNullError);
// If we don't immediately clear m_loader when cancelling, we might get
// unexpected reentrancy. m_resource->error() can trigger JS events, which
@@ -200,7 +199,7 @@ void ResourceLoader::cancel(const ResourceError& error)
}
if (m_state != ConnectionStateReleased)
- m_resource->error(Resource::LoadError);
+ m_resource->error(nonNullError);
if (m_state != ConnectionStateReleased)
releaseResources();
}
@@ -287,14 +286,6 @@ void ResourceLoader::didReceiveResponse(WebURLLoader*, const WebURLResponse& res
if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnoreHTTPStatusCodeErrors())
return;
-
- if (!m_notifiedLoadComplete) {
- m_notifiedLoadComplete = true;
- m_fetcher->didFailLoading(m_resource.get(), ResourceError::cancelledError(resourceResponse.url()));
- }
-
- ASSERT(m_state != ConnectionStateReleased);
- m_resource->error(Resource::LoadError);
cancel(ResourceError::cancelledError(resourceResponse.url()));
}
@@ -329,12 +320,10 @@ void ResourceLoader::didFinishLoading(WebURLLoader*, double finishTime, int64_t
RELEASE_ASSERT(m_state == ConnectionStateReceivedResponse || m_state == ConnectionStateReceivingData);
m_state = ConnectionStateFinishedLoading;
WTF_LOG(ResourceLoading, "Received '%s'.", m_resource->url().getString().latin1().data());
-
- m_resource->setLoadFinishTime(finishTime);
didFinishLoadingOnePart(finishTime, encodedDataLength);
if (m_state == ConnectionStateReleased)
return;
- m_resource->finish();
+ m_resource->finish(finishTime);
// If the load has been cancelled by a delegate in response to didFinishLoad(), do not release
// the resources a second time, they have been released by cancel.
@@ -349,9 +338,6 @@ void ResourceLoader::didFail(WebURLLoader*, const WebURLError& error)
ASSERT(m_state != ConnectionStateReleased);
m_state = ConnectionStateFailed;
WTF_LOG(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().getString().latin1().data());
-
- m_resource->setResourceError(error);
-
if (!m_notifiedLoadComplete) {
m_notifiedLoadComplete = true;
m_fetcher->didFailLoading(m_resource.get(), error);
@@ -359,7 +345,7 @@ void ResourceLoader::didFail(WebURLLoader*, const WebURLError& error)
if (m_state == ConnectionStateReleased)
return;
- m_resource->error(Resource::LoadError);
+ m_resource->error(error);
if (m_state == ConnectionStateReleased)
return;
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | third_party/WebKit/Source/core/fetch/ResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698