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 2be163c8007ac3cbd6c698124b132e8482bdc250..96c7a776b4fd5791380268393952386a040e5b5f 100644 |
--- a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp |
+++ b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp |
@@ -116,7 +116,7 @@ void ResourceLoader::cancel() |
didFail(nullptr, ResourceError::cancelledError(m_resource->lastResourceRequest().url())); |
} |
-void ResourceLoader::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewRequest, const WebURLResponse& passedRedirectResponse) |
+void ResourceLoader::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewRequest, const WebURLResponse& passedRedirectResponse, int64_t encodedDataLength) |
{ |
ASSERT(!passedNewRequest.isNull()); |
ASSERT(!passedRedirectResponse.isNull()); |
@@ -125,7 +125,7 @@ void ResourceLoader::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewR |
const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceResponse()); |
newRequest.setRedirectStatus(ResourceRequest::RedirectStatus::FollowedRedirect); |
- if (m_fetcher->willFollowRedirect(m_resource.get(), newRequest, redirectResponse)) { |
+ if (m_fetcher->willFollowRedirect(m_resource.get(), newRequest, redirectResponse, encodedDataLength)) { |
m_resource->willFollowRedirect(newRequest, redirectResponse); |
} else { |
m_resource->willNotFollowRedirect(); |
@@ -198,10 +198,12 @@ void ResourceLoader::didReceiveResponse(WebURLLoader* loader, const WebURLRespon |
didReceiveResponse(loader, response, nullptr); |
} |
-void ResourceLoader::didReceiveData(WebURLLoader*, const char* data, int length, int encodedDataLength) |
+void ResourceLoader::didReceiveData(WebURLLoader*, const char* data, int length, int encodedDataLength, int encodedBodyLength) |
{ |
RELEASE_ASSERT(length >= 0); |
m_fetcher->didReceiveData(m_resource.get(), data, length, encodedDataLength); |
+ m_resource->addToEncodedBodyLength(encodedBodyLength); |
+ m_resource->addToDecodedBodyLength(length); |
m_resource->appendData(data, length); |
} |
@@ -249,6 +251,7 @@ void ResourceLoader::requestSynchronously(const ResourceRequest& request) |
return; |
RefPtr<ResourceLoadInfo> resourceLoadInfo = responseOut.toResourceResponse().resourceLoadInfo(); |
int64_t encodedDataLength = resourceLoadInfo ? resourceLoadInfo->encodedDataLength : WebURLLoaderClient::kUnknownEncodedDataLength; |
+ DCHECK_GE(responseOut.toResourceResponse().encodedBodyLength(), 0); |
// Follow the async case convention of not calling didReceiveData or |
// appending data to m_resource if the response body is empty. Copying the |