| Index: net/url_request/url_request.cc
|
| diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
|
| index 07af22f7b7b94f032fa0d8e7d84021c4a2614232..f18a4e3960d5833f06d7efc399c01e3f0d0efc84 100644
|
| --- a/net/url_request/url_request.cc
|
| +++ b/net/url_request/url_request.cc
|
| @@ -140,6 +140,7 @@ URLRequest::URLRequest(const GURL& url, Delegate* delegate)
|
| final_upload_progress_(0),
|
| priority_(LOWEST),
|
| identifier_(GenerateURLRequestIdentifier()),
|
| + blocked_on_delegate_(false),
|
| ALLOW_THIS_IN_INITIALIZER_LIST(
|
| before_request_callback_(this, &URLRequest::BeforeRequestComplete)),
|
| has_notified_completion_(false) {
|
| @@ -253,8 +254,13 @@ void URLRequest::SetExtraRequestHeaders(
|
| // for request headers are implemented.
|
| }
|
|
|
| -LoadState URLRequest::GetLoadState() const {
|
| - return job_ ? job_->GetLoadState() : LOAD_STATE_IDLE;
|
| +LoadStateWithParam URLRequest::GetLoadState() const {
|
| + if (blocked_on_delegate_) {
|
| + return net::LoadStateWithParam(LOAD_STATE_WAITING_FOR_DELEGATE,
|
| + load_state_param_);
|
| + }
|
| + return net::LoadStateWithParam(job_ ? job_->GetLoadState() : LOAD_STATE_IDLE,
|
| + "");
|
| }
|
|
|
| uint64 URLRequest::GetUploadProgress() const {
|
| @@ -399,7 +405,7 @@ void URLRequest::Start() {
|
| if (context_->network_delegate()->NotifyBeforeURLRequest(
|
| this, &before_request_callback_, &delegate_redirect_url_) ==
|
| net::ERR_IO_PENDING) {
|
| - net_log_.BeginEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL);
|
| + SetBlockedOnDelegate();
|
| return; // paused
|
| }
|
| }
|
| @@ -413,7 +419,7 @@ void URLRequest::BeforeRequestComplete(int error) {
|
| DCHECK(!job_);
|
| DCHECK_NE(ERR_IO_PENDING, error);
|
|
|
| - net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL);
|
| + SetUnblockedOnDelegate();
|
| if (error != OK) {
|
| net_log_.AddEvent(NetLog::TYPE_CANCELLED,
|
| make_scoped_refptr(new NetLogStringParameter("source", "delegate")));
|
| @@ -801,4 +807,15 @@ void URLRequest::NotifyRequestCompleted() {
|
| context_->network_delegate()->NotifyCompleted(this);
|
| }
|
|
|
| +void URLRequest::SetBlockedOnDelegate() {
|
| + blocked_on_delegate_ = true;
|
| + net_log_.BeginEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL);
|
| +}
|
| +
|
| +void URLRequest::SetUnblockedOnDelegate() {
|
| + blocked_on_delegate_ = false;
|
| + load_state_param_.clear();
|
| + net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL);
|
| +}
|
| +
|
| } // namespace net
|
|
|