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

Unified Diff: net/proxy/proxy_script_fetcher_impl.cc

Issue 2313013002: Revert of Adjust callers and networking delegates in net/ to modified APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@URLRequestRead
Patch Set: Created 4 years, 3 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 | « net/proxy/proxy_script_fetcher_impl.h ('k') | net/proxy/proxy_script_fetcher_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_script_fetcher_impl.cc
diff --git a/net/proxy/proxy_script_fetcher_impl.cc b/net/proxy/proxy_script_fetcher_impl.cc
index d78c9feb65a5df03252977a2594e24f285fd4cc1..bd3c46a9f28888cb6f74df40e661853ac8209c8e 100644
--- a/net/proxy/proxy_script_fetcher_impl.cc
+++ b/net/proxy/proxy_script_fetcher_impl.cc
@@ -104,14 +104,13 @@
return prev;
}
-void ProxyScriptFetcherImpl::OnResponseCompleted(URLRequest* request,
- int net_error) {
+void ProxyScriptFetcherImpl::OnResponseCompleted(URLRequest* request) {
DCHECK_EQ(request, cur_request_.get());
// Use |result_code_| as the request's error if we have already set it to
// something specific.
- if (result_code_ == OK && net_error != OK)
- result_code_ = net_error;
+ if (result_code_ == OK && !request->status().is_success())
+ result_code_ = request->status().error();
FetchCompleted();
}
@@ -207,13 +206,11 @@
request->Cancel();
}
-void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request,
- int net_error) {
- DCHECK_EQ(request, cur_request_.get());
- DCHECK_NE(ERR_IO_PENDING, net_error);
-
- if (net_error != OK) {
- OnResponseCompleted(request, net_error);
+void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) {
+ DCHECK_EQ(request, cur_request_.get());
+
+ if (!request->status().is_success()) {
+ OnResponseCompleted(request);
return;
}
@@ -245,8 +242,6 @@
void ProxyScriptFetcherImpl::OnReadCompleted(URLRequest* request,
int num_bytes) {
- DCHECK_NE(ERR_IO_PENDING, num_bytes);
-
DCHECK_EQ(request, cur_request_.get());
if (ConsumeBytesRead(request, num_bytes)) {
// Keep reading.
@@ -257,15 +252,13 @@
void ProxyScriptFetcherImpl::ReadBody(URLRequest* request) {
// Read as many bytes as are available synchronously.
while (true) {
- int num_bytes = request->Read(buf_.get(), kBufSize);
- if (num_bytes == ERR_IO_PENDING)
- return;
-
- if (num_bytes < 0) {
- OnResponseCompleted(request, num_bytes);
+ int num_bytes;
+ if (!request->Read(buf_.get(), kBufSize, &num_bytes)) {
+ // Check whether the read failed synchronously.
+ if (!request->status().is_io_pending())
+ OnResponseCompleted(request);
return;
}
-
if (!ConsumeBytesRead(request, num_bytes))
return;
}
@@ -275,7 +268,7 @@
int num_bytes) {
if (num_bytes <= 0) {
// Error while reading, or EOF.
- OnResponseCompleted(request, num_bytes);
+ OnResponseCompleted(request);
return false;
}
« no previous file with comments | « net/proxy/proxy_script_fetcher_impl.h ('k') | net/proxy/proxy_script_fetcher_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698