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

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

Issue 2510333002: Send encoded_body_length to renderer when response completed (2/3) (Closed)
Patch Set: rebase Created 4 years, 1 month 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 38a79ac10119a0df586b9a2b230f1d4b56bf2417..a83cd453053d88060185af201bb7af19a8ec27f8 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp
@@ -219,11 +219,9 @@ void ResourceLoader::didReceiveResponse(WebURLLoader* loader,
void ResourceLoader::didReceiveData(WebURLLoader*,
const char* data,
int length,
- int encodedDataLength,
- int encodedBodyLength) {
+ int encodedDataLength) {
CHECK_GE(length, 0);
m_fetcher->didReceiveData(m_resource.get(), data, length, encodedDataLength);
- m_resource->addToEncodedBodyLength(encodedBodyLength);
m_resource->addToDecodedBodyLength(length);
m_resource->appendData(data, length);
}
@@ -235,8 +233,10 @@ void ResourceLoader::didFinishLoadingFirstPartInMultipart() {
void ResourceLoader::didFinishLoading(WebURLLoader*,
double finishTime,
- int64_t encodedDataLength) {
+ int64_t encodedDataLength,
+ int64_t encodedBodyLength) {
m_resource->setEncodedDataLength(encodedDataLength);
+ m_resource->addToEncodedBodyLength(encodedBodyLength);
m_loader.reset();
m_fetcher->didFinishLoading(m_resource.get(), finishTime,
ResourceFetcher::DidFinishLoading);
@@ -244,8 +244,10 @@ void ResourceLoader::didFinishLoading(WebURLLoader*,
void ResourceLoader::didFail(WebURLLoader*,
const WebURLError& error,
- int64_t encodedDataLength) {
+ int64_t encodedDataLength,
+ int64_t encodedBodyLength) {
m_resource->setEncodedDataLength(encodedDataLength);
+ m_resource->addToEncodedBodyLength(encodedBodyLength);
didFail(error);
}
@@ -275,15 +277,16 @@ void ResourceLoader::requestSynchronously(const ResourceRequest& request) {
WebURLError errorOut;
WebData dataOut;
int64_t encodedDataLength = WebURLLoaderClient::kUnknownEncodedDataLength;
+ int64_t encodedBodyLength = 0;
m_loader->loadSynchronously(requestIn, responseOut, errorOut, dataOut,
- encodedDataLength);
+ encodedDataLength, encodedBodyLength);
// A message dispatched while synchronously fetching the resource
// can bring about the cancellation of this load.
if (!m_loader)
return;
if (errorOut.reason) {
- didFail(0, errorOut, encodedDataLength);
+ didFail(0, errorOut, encodedDataLength, encodedBodyLength);
return;
}
didReceiveResponse(0, responseOut);
@@ -300,7 +303,8 @@ void ResourceLoader::requestSynchronously(const ResourceRequest& request) {
encodedDataLength);
m_resource->setResourceBuffer(dataOut);
}
- didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength);
+ didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength,
+ encodedBodyLength);
}
void ResourceLoader::activateCacheAwareLoadingIfNeeded(
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceLoader.h ('k') | third_party/WebKit/Source/core/loader/PingLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698