From 73201e419d9985fb8a4de55d4d33cc922030af84 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Mon, 28 Mar 2016 02:09:56 +0530 Subject: [PATCH] protocol: return status of ReadRawData instead of relying on SetStatus --- atom/browser/net/url_request_fetch_job.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/atom/browser/net/url_request_fetch_job.cc b/atom/browser/net/url_request_fetch_job.cc index d58ea3fe9f..2f907314ca 100644 --- a/atom/browser/net/url_request_fetch_job.cc +++ b/atom/browser/net/url_request_fetch_job.cc @@ -167,8 +167,6 @@ void URLRequestFetchJob::HeadersCompleted() { } int URLRequestFetchJob::DataAvailable(net::IOBuffer* buffer, int num_bytes) { - // Clear the IO_PENDING status. - SetStatus(net::URLRequestStatus()); // Do nothing if pending_buffer_ is empty, i.e. there's no ReadRawData() // operation waiting for IO completion. if (!pending_buffer_.get()) @@ -176,7 +174,6 @@ int URLRequestFetchJob::DataAvailable(net::IOBuffer* buffer, int num_bytes) { // pending_buffer_ is set to the IOBuffer instance provided to ReadRawData() // by URLRequestJob. - int bytes_read = std::min(num_bytes, pending_buffer_size_); memcpy(pending_buffer_->data(), buffer->data(), bytes_read); @@ -197,12 +194,11 @@ void URLRequestFetchJob::Kill() { int URLRequestFetchJob::ReadRawData(net::IOBuffer* dest, int dest_size) { if (GetResponseCode() == 204) { request()->set_received_response_content_length(prefilter_bytes_read()); - return 0; + return net::OK; } pending_buffer_ = dest; pending_buffer_size_ = dest_size; - SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0)); - return dest_size; + return net::ERR_IO_PENDING; } bool URLRequestFetchJob::GetMimeType(std::string* mime_type) const {