summaryrefslogtreecommitdiffstats
path: root/content/browser/loader/resource_loader.cc
diff options
context:
space:
mode:
authordavidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 03:59:18 +0000
committerdavidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 03:59:18 +0000
commit146b8b276bc5388c25482c78d270e7fa773e3cc5 (patch)
treefa6608a7bbb88a7b71e146b6cfa642be51493d92 /content/browser/loader/resource_loader.cc
parentf967658e63c06a3fe1b505375d14bead8b35eb0b (diff)
downloadchromium_src-146b8b276bc5388c25482c78d270e7fa773e3cc5.zip
chromium_src-146b8b276bc5388c25482c78d270e7fa773e3cc5.tar.gz
chromium_src-146b8b276bc5388c25482c78d270e7fa773e3cc5.tar.bz2
Allow prefetches to outlive their owning RenderViewHost.
This is a rework of r231910. Instead of putting the detachable logic in AsyncResourceHandler, move it to a wrapper DetachableResourceHandler. On detach, it simulates a cancel to the ResourceHandler it wraps and then continues to drain the request itself. This should have fewer buffering complications. BUG=286186 TEST=ResourceDispatcherHostTest.Cancel, ResourceDispatcherHostTest.DetachedResourceTimesOut, ResourceDispatcherHostTest.DeletedFilterDetached, ResourceDispatcherHostTest.DeletedFilterDetachedRedirect, ResourceDispatcherHostTest.DetachWhileStartIsDeferred ResourceDispatcherHostTest.TestProcessCancelDetachedTimeout, ResourceDispatcherHostTest.CancelRequestsForContextDetached, ResourceDispatcherHostTest.DataSentBeforeDetach Review URL: https://codereview.chromium.org/59783003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/loader/resource_loader.cc')
-rw-r--r--content/browser/loader/resource_loader.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/content/browser/loader/resource_loader.cc b/content/browser/loader/resource_loader.cc
index 94561ba..4993c82 100644
--- a/content/browser/loader/resource_loader.cc
+++ b/content/browser/loader/resource_loader.cc
@@ -10,6 +10,7 @@
#include "base/time/time.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/loader/cross_site_resource_handler.h"
+#include "content/browser/loader/detachable_resource_handler.h"
#include "content/browser/loader/resource_loader_delegate.h"
#include "content/browser/loader/resource_request_info_impl.h"
#include "content/browser/ssl/ssl_client_auth_handler.h"
@@ -439,6 +440,13 @@ void ResourceLoader::CancelRequestInternal(int error, bool from_renderer) {
if (from_renderer && (info->is_download() || info->is_stream()))
return;
+ if (from_renderer && info->detachable_handler()) {
+ // TODO(davidben): Fix Blink handling of prefetches so they are not
+ // cancelled on navigate away and end up in the local cache.
+ info->detachable_handler()->Detach();
+ return;
+ }
+
// TODO(darin): Perhaps we should really be looking to see if the status is
// IO_PENDING?
bool was_pending = request_->is_pending();