Index: content/child/web_url_loader_impl.cc |
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc |
index 3274fb49d9e6324f9a215761b9145cac1950be93..485477bcbf607b080d54c9090f72cb6d76d003b2 100644 |
--- a/content/child/web_url_loader_impl.cc |
+++ b/content/child/web_url_loader_impl.cc |
@@ -373,8 +373,11 @@ WebURLLoaderImpl::Context::Context( |
} |
void WebURLLoaderImpl::Context::Cancel() { |
- if (resource_dispatcher_) // NULL in unittest. |
+ if (resource_dispatcher_ && // NULL in unittest. |
+ request_id_ != -1) { |
resource_dispatcher_->Cancel(request_id_); |
Ken Russell (switch to Gerrit)
2015/02/20 17:52:51
Is it OK that we'll potentially send a -1 request_
jam
2015/02/20 17:56:29
How could that happen? This if statement is guarde
Ken Russell (switch to Gerrit)
2015/02/20 17:57:30
Ah, sorry, I read the diffs backward and thought y
|
+ request_id_ = -1; |
+ } |
// Ensure that we do not notify the multipart delegate anymore as it has |
// its own pointer to the client. |
@@ -390,7 +393,8 @@ void WebURLLoaderImpl::Context::Cancel() { |
} |
void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { |
- resource_dispatcher_->SetDefersLoading(request_id_, value); |
+ if (request_id_ != -1) |
+ resource_dispatcher_->SetDefersLoading(request_id_, value); |
if (value && defers_loading_ == NOT_DEFERRING) { |
defers_loading_ = SHOULD_DEFER; |
} else if (!value && defers_loading_ != NOT_DEFERRING) { |
@@ -404,22 +408,27 @@ void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { |
void WebURLLoaderImpl::Context::DidChangePriority( |
WebURLRequest::Priority new_priority, int intra_priority_value) { |
- resource_dispatcher_->DidChangePriority( |
- request_id_, |
- ConvertWebKitPriorityToNetPriority(new_priority), |
- intra_priority_value); |
+ if (request_id_ != -1) { |
+ resource_dispatcher_->DidChangePriority( |
+ request_id_, |
+ ConvertWebKitPriorityToNetPriority(new_priority), |
+ intra_priority_value); |
+ } |
} |
bool WebURLLoaderImpl::Context::AttachThreadedDataReceiver( |
blink::WebThreadedDataReceiver* threaded_data_receiver) { |
- resource_dispatcher_->AttachThreadedDataReceiver( |
- request_id_, threaded_data_receiver); |
+ if (request_id_ != -1) { |
+ resource_dispatcher_->AttachThreadedDataReceiver( |
+ request_id_, threaded_data_receiver); |
+ } |
return false; |
} |
void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, |
SyncLoadResponse* sync_load_response) { |
+ DCHECK(request_id_ == -1); |
request_ = request; // Save the request. |
if (request.extraData()) { |
RequestExtraData* extra_data = |