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

Unified Diff: content/network/url_loader_impl.cc

Issue 2919413003: Fix network service hanging with empty bodies. (Closed)
Patch Set: review comments Created 3 years, 6 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/network/url_loader_impl.h ('k') | content/network/url_loader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/network/url_loader_impl.cc
diff --git a/content/network/url_loader_impl.cc b/content/network/url_loader_impl.cc
index 7d015c0563499f2130295d6d2f5fb0b6d6058fb8..77f7fc857362b11911b254404adbd6c90a1462b0 100644
--- a/content/network/url_loader_impl.cc
+++ b/content/network/url_loader_impl.cc
@@ -271,7 +271,8 @@ void URLLoaderImpl::OnResponseStarted(net::URLRequest* url_request,
mojo::DataPipe data_pipe(kDefaultAllocationSize);
response_body_stream_ = std::move(data_pipe.producer_handle);
- response_body_consumer_handle_ = std::move(data_pipe.consumer_handle);
+ url_loader_client_->OnStartLoadingResponseBody(
+ std::move(data_pipe.consumer_handle));
peer_closed_handle_watcher_.Watch(
response_body_stream_.get(), MOJO_HANDLE_SIGNAL_PEER_CLOSED,
base::Bind(&URLLoaderImpl::OnResponseBodyStreamClosed,
@@ -314,7 +315,6 @@ void URLLoaderImpl::ReadMore() {
if (url_request_->status().is_io_pending()) {
// Wait for OnReadCompleted.
} else if (url_request_->status().is_success() && bytes_read > 0) {
- SendDataPipeIfNecessary();
DidRead(static_cast<uint32_t>(bytes_read), true);
} else {
NotifyCompleted(net::OK);
@@ -350,8 +350,6 @@ void URLLoaderImpl::OnReadCompleted(net::URLRequest* url_request,
return;
}
- SendDataPipeIfNecessary();
-
DidRead(static_cast<uint32_t>(bytes_read), false);
}
@@ -369,14 +367,6 @@ void URLLoaderImpl::NotifyCompleted(int error_code) {
DeleteIfNeeded();
}
-void URLLoaderImpl::SendDataPipeIfNecessary() {
- if (response_body_consumer_handle_.is_valid()) {
- // Send the data pipe on the first OnReadCompleted call.
- url_loader_client_->OnStartLoadingResponseBody(
- std::move(response_body_consumer_handle_));
- }
-}
-
void URLLoaderImpl::OnConnectionError() {
connected_ = false;
DeleteIfNeeded();
« no previous file with comments | « content/network/url_loader_impl.h ('k') | content/network/url_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698