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

Unified Diff: content/child/web_url_loader_impl.cc

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
« no previous file with comments | « content/child/sync_load_response.h ('k') | content/child/web_url_loader_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/web_url_loader_impl.cc
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index 6bc238d7608afd9bb18dcaa2348d733f057e2b55..07331795b744f45194624b9637088d738bdc12da 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -184,6 +184,7 @@ int GetInfoFromDataURL(const GURL& url,
info->security_info.clear();
info->content_length = data->length();
info->encoded_data_length = 0;
+ info->encoded_body_length = 0;
return net::OK;
}
@@ -615,7 +616,8 @@ bool WebURLLoaderImpl::Context::OnReceivedRedirect(
: blink::WebURLRequest::SkipServiceWorker::All,
&new_request);
- client_->willFollowRedirect(loader_, new_request, response);
+ client_->willFollowRedirect(loader_, new_request, response,
+ info.encoded_data_length);
request_ = new_request;
// Only follow the redirect if WebKit left the URL unmodified.
@@ -729,7 +731,7 @@ void WebURLLoaderImpl::Context::OnReceivedData(
std::unique_ptr<ReceivedData> data) {
const char* payload = data->payload();
int data_length = data->length();
- int encoded_data_length = data->encoded_length();
+ int encoded_data_length = data->encoded_data_length();
if (!client_)
return;
@@ -744,7 +746,8 @@ void WebURLLoaderImpl::Context::OnReceivedData(
} else {
// We dispatch the data even when |useStreamOnResponse()| is set, in order
// to make Devtools work.
- client_->didReceiveData(loader_, payload, data_length, encoded_data_length);
+ client_->didReceiveData(loader_, payload, data_length, encoded_data_length,
+ data->encoded_body_length());
if (request_.useStreamOnResponse()) {
// We don't support ftp_listening_delegate_ for now.
@@ -883,9 +886,10 @@ void WebURLLoaderImpl::Context::HandleDataURL() {
if (error_code == net::OK) {
OnReceivedResponse(info);
- if (!data.empty())
+ auto size = data.size();
+ if (size != 0)
OnReceivedData(
- base::WrapUnique(new FixedReceivedData(data.data(), data.size(), 0)));
+ base::WrapUnique(new FixedReceivedData(data.data(), size, 0, size)));
}
OnCompletedRequest(error_code, false, false, info.security_info,
@@ -1150,9 +1154,10 @@ void WebURLLoaderImpl::loadSynchronously(const WebURLRequest& request,
PopulateURLResponse(final_url, sync_load_response, &response,
request.reportRawHeaders());
+ response.addToEncodedBodyLength(sync_load_response.encoded_body_length);
+ response.addToDecodedBodyLength(sync_load_response.data.size());
- data.assign(sync_load_response.data.data(),
- sync_load_response.data.size());
+ data.assign(sync_load_response.data.data(), sync_load_response.data.size());
}
void WebURLLoaderImpl::loadAsynchronously(const WebURLRequest& request,
« no previous file with comments | « content/child/sync_load_response.h ('k') | content/child/web_url_loader_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698