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

Unified Diff: content/child/web_url_loader_impl.cc

Issue 2797443005: PlzNavigate data pipe
Patch Set: cleanup Created 3 years, 8 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/web_url_loader_impl.h ('k') | content/common/content_param_traits.h » ('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 3b5126aea04bd0e021f38aba6e4f2318b8745f87..9068db120a2f6bbe35352a27d10f6cf71f4c47b7 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -605,11 +605,12 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
// PlzNavigate: during navigation, the renderer should request a stream which
// contains the body of the response. The network request has already been
// made by the browser.
+ mojo::ScopedDataPipeConsumerHandle consumer_handle;
if (stream_override_.get()) {
CHECK(IsBrowserSideNavigationEnabled());
DCHECK(!sync_load_response);
DCHECK_NE(WebURLRequest::FrameTypeNone, request.getFrameType());
- resource_request->resource_body_stream_url = stream_override_->stream_url;
+ consumer_handle = std::move(stream_override_->consumer_handle);
}
const RequestExtraData empty_extra_data;
@@ -634,7 +635,8 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
std::move(resource_request), request.requestorID(), task_runner_,
extra_data->frame_origin(),
base::MakeUnique<WebURLLoaderImpl::RequestPeerImpl>(this),
- request.getLoadingIPCType(), url_loader_factory_);
+ request.getLoadingIPCType(), url_loader_factory_,
+ std::move(consumer_handle));
if (defers_loading_ != NOT_DEFERRING)
resource_dispatcher_->SetDefersLoading(request_id_, true);
@@ -801,6 +803,9 @@ void WebURLLoaderImpl::Context::OnReceivedData(
if (!client_)
return;
+ if (stream_override_.get())
+ stream_override_->total_transferred += data_length;
+
TRACE_EVENT_WITH_FLOW0(
"loading", "WebURLLoaderImpl::Context::OnReceivedData",
this, TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT);
@@ -843,6 +848,12 @@ void WebURLLoaderImpl::Context::OnCompletedRequest(
const base::TimeTicks& completion_time,
int64_t total_transfer_size,
int64_t encoded_body_size) {
+ if (stream_override_.get()) {
+ // XXX This is wrong.
+ total_transfer_size = stream_override_->total_transferred;
+ encoded_body_size = stream_override_->total_transferred;
+ }
+
if (ftp_listing_delegate_) {
ftp_listing_delegate_->OnCompletedRequest();
ftp_listing_delegate_.reset(NULL);
« no previous file with comments | « content/child/web_url_loader_impl.h ('k') | content/common/content_param_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698