| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/url_request/url_request_job.h" | 5 #include "net/url_request/url_request_job.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 if (request_) { | 405 if (request_) { |
| 406 request_->set_is_pending(false); | 406 request_->set_is_pending(false); |
| 407 // With async IO, it's quite possible to have a few outstanding | 407 // With async IO, it's quite possible to have a few outstanding |
| 408 // requests. We could receive a request to Cancel, followed shortly | 408 // requests. We could receive a request to Cancel, followed shortly |
| 409 // by a successful IO. For tracking the status(), once there is | 409 // by a successful IO. For tracking the status(), once there is |
| 410 // an error, we do not change the status back to success. To | 410 // an error, we do not change the status back to success. To |
| 411 // enforce this, only set the status if the job is so far | 411 // enforce this, only set the status if the job is so far |
| 412 // successful. | 412 // successful. |
| 413 if (request_->status().is_success()) { | 413 if (request_->status().is_success()) { |
| 414 if (status.status() == URLRequestStatus::FAILED) { | 414 if (status.status() == URLRequestStatus::FAILED) { |
| 415 request_->net_log().AddEvent( | 415 request_->net_log().AddEventWithNetErrorCode(NetLog::TYPE_FAILED, |
| 416 NetLog::TYPE_FAILED, | 416 status.error()); |
| 417 make_scoped_refptr(new NetLogIntegerParameter("net_error", | |
| 418 status.error()))); | |
| 419 } | 417 } |
| 420 request_->set_status(status); | 418 request_->set_status(status); |
| 421 } | 419 } |
| 422 } | 420 } |
| 423 | 421 |
| 424 // Complete this notification later. This prevents us from re-entering the | 422 // Complete this notification later. This prevents us from re-entering the |
| 425 // delegate if we're done because of a synchronous call. | 423 // delegate if we're done because of a synchronous call. |
| 426 MessageLoop::current()->PostTask( | 424 MessageLoop::current()->PostTask( |
| 427 FROM_HERE, | 425 FROM_HERE, |
| 428 base::Bind(&URLRequestJob::CompleteNotifyDone, | 426 base::Bind(&URLRequestJob::CompleteNotifyDone, |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 } | 698 } |
| 701 | 699 |
| 702 bool URLRequestJob::FilterHasData() { | 700 bool URLRequestJob::FilterHasData() { |
| 703 return filter_.get() && filter_->stream_data_len(); | 701 return filter_.get() && filter_->stream_data_len(); |
| 704 } | 702 } |
| 705 | 703 |
| 706 void URLRequestJob::UpdatePacketReadTimes() { | 704 void URLRequestJob::UpdatePacketReadTimes() { |
| 707 } | 705 } |
| 708 | 706 |
| 709 } // namespace net | 707 } // namespace net |
| OLD | NEW |