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