Chromium Code Reviews| Index: chrome/browser/predictors/resource_prefetcher.cc |
| diff --git a/chrome/browser/predictors/resource_prefetcher.cc b/chrome/browser/predictors/resource_prefetcher.cc |
| index 437068a636ea72c6a21558503e638f928bc1ce22..e78e7695b74d18624e4c448d0e3137096cd1cae5 100644 |
| --- a/chrome/browser/predictors/resource_prefetcher.cc |
| +++ b/chrome/browser/predictors/resource_prefetcher.cc |
| @@ -166,13 +166,15 @@ void ResourcePrefetcher::ReadFullResponse(net::URLRequest* request) { |
| int bytes_read = 0; |
| scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer( |
| kResourceBufferSizeBytes)); |
| - status = request->Read(buffer.get(), kResourceBufferSizeBytes, &bytes_read); |
| + bytes_read = request->Read(buffer.get(), kResourceBufferSizeBytes); |
| - if (status) { |
| + if (bytes_read >= 0) { |
| status = ShouldContinueReadingRequest(request, bytes_read); |
| - } else if (!request->status().is_success()) { |
| - FinishRequest(request, Request::PREFETCH_STATUS_FAILED); |
| - return; |
| + } else if (bytes_read < 0) { |
|
pasko
2016/09/21 18:14:02
why checking the condition again?
this equivalent
pasko
2016/09/29 13:51:40
please respond to this comment
maksims (do not use this acc)
2016/09/30 06:06:07
Sorry. Right, done!
|
| + if (bytes_read != net::ERR_IO_PENDING) { |
| + FinishRequest(request, Request::PREFETCH_STATUS_FAILED); |
| + return; |
| + } |
| } |
| } |
| } |
| @@ -214,8 +216,11 @@ void ResourcePrefetcher::OnSSLCertificateError(net::URLRequest* request, |
| FinishRequest(request, Request::PREFETCH_STATUS_CERT_ERROR); |
| } |
| -void ResourcePrefetcher::OnResponseStarted(net::URLRequest* request) { |
| - if (!request->status().is_success()) { |
| +void ResourcePrefetcher::OnResponseStarted(net::URLRequest* request, |
| + int net_error) { |
| + DCHECK_NE(net::ERR_IO_PENDING, net_error); |
|
pasko
2016/09/21 18:14:02
In what circumstances is net::ERR_IO_PENDING provi
maksims (do not use this acc)
2016/09/22 04:17:48
Because it was done like this in some clients. Wha
|
| + |
| + if (net_error != net::OK) { |
| FinishRequest(request, Request::PREFETCH_STATUS_FAILED); |
| return; |
| } |
| @@ -226,7 +231,9 @@ void ResourcePrefetcher::OnResponseStarted(net::URLRequest* request) { |
| void ResourcePrefetcher::OnReadCompleted(net::URLRequest* request, |
| int bytes_read) { |
| - if (!request->status().is_success()) { |
| + DCHECK_NE(net::ERR_IO_PENDING, bytes_read); |
| + |
| + if (bytes_read < 0) { |
| FinishRequest(request, Request::PREFETCH_STATUS_FAILED); |
| return; |
| } |