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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 bool from_renderer) { | 1180 bool from_renderer) { |
1181 PendingRequestList::iterator i = pending_requests_.find( | 1181 PendingRequestList::iterator i = pending_requests_.find( |
1182 GlobalRequestID(child_id, request_id)); | 1182 GlobalRequestID(child_id, request_id)); |
1183 if (i == pending_requests_.end()) { | 1183 if (i == pending_requests_.end()) { |
1184 // We probably want to remove this warning eventually, but I wanted to be | 1184 // We probably want to remove this warning eventually, but I wanted to be |
1185 // able to notice when this happens during initial development since it | 1185 // able to notice when this happens during initial development since it |
1186 // should be rare and may indicate a bug. | 1186 // should be rare and may indicate a bug. |
1187 DLOG(WARNING) << "Canceling a request that wasn't found"; | 1187 DLOG(WARNING) << "Canceling a request that wasn't found"; |
1188 return; | 1188 return; |
1189 } | 1189 } |
1190 CancelRequestInternal(i->second, from_renderer); | 1190 net::URLRequest* request = i->second; |
| 1191 const bool started_before_cancel = request->is_pending(); |
| 1192 CancelRequestInternal(request, from_renderer); |
| 1193 // If the request isn't in flight, then we won't get asyncronous notification, |
| 1194 // so we have to signal ourselves to finish this request. |
| 1195 if (!started_before_cancel) |
| 1196 OnResponseCompleted(request); |
1191 } | 1197 } |
1192 | 1198 |
1193 void ResourceDispatcherHost::CancelRequestInternal(net::URLRequest* request, | 1199 void ResourceDispatcherHost::CancelRequestInternal(net::URLRequest* request, |
1194 bool from_renderer) { | 1200 bool from_renderer) { |
1195 VLOG(1) << "CancelRequest: " << request->url().spec(); | 1201 VLOG(1) << "CancelRequest: " << request->url().spec(); |
1196 | 1202 |
1197 // WebKit will send us a cancel for downloads since it no longer handles them. | 1203 // WebKit will send us a cancel for downloads since it no longer handles them. |
1198 // In this case, ignore the cancel since we handle downloads in the browser. | 1204 // In this case, ignore the cancel since we handle downloads in the browser. |
1199 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 1205 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
1200 if (!from_renderer || !info->is_download()) { | 1206 if (!from_renderer || !info->is_download()) { |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1954 return is_prefetch_enabled_; | 1960 return is_prefetch_enabled_; |
1955 } | 1961 } |
1956 | 1962 |
1957 // static | 1963 // static |
1958 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1964 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
1959 is_prefetch_enabled_ = value; | 1965 is_prefetch_enabled_ = value; |
1960 } | 1966 } |
1961 | 1967 |
1962 // static | 1968 // static |
1963 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1969 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
OLD | NEW |