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

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

Issue 2105713002: Render process changes for ResourceTiming sizes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resource_timing_sizes_browser_process
Patch Set: Initialise encoded_body_length for sync XHR to data: URLs Created 4 years, 5 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 3bb812e74bd488515e8f3c607bc36f8e2ef46098..8fa0dfd9e57d4d779bc06f1542787b0b5f8a8e54 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();
@@ -205,10 +205,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);
}
@@ -255,6 +257,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
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceLoader.h ('k') | third_party/WebKit/Source/core/loader/BeaconLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698