Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(650)

Unified Diff: content/browser/loader/async_resource_handler.cc

Issue 25772002: Allows prefetch requests to live beyond the renderer by delaying (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed mmenke's comments Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/async_resource_handler.cc
diff --git a/content/browser/loader/async_resource_handler.cc b/content/browser/loader/async_resource_handler.cc
index f007a417fb8ffe997e20c439506d9f8a6834c367..f1f8278297ca84faa1c5c39dd8fba6cc129f7d57 100644
--- a/content/browser/loader/async_resource_handler.cc
+++ b/content/browser/loader/async_resource_handler.cc
@@ -137,8 +137,9 @@ bool AsyncResourceHandler::OnUploadProgress(int request_id,
uint64 size) {
const ResourceRequestInfoImpl* info =
ResourceRequestInfoImpl::ForRequest(request_);
+ // Cancel the request if the renderer is gone unless it's detachable.
if (!info->filter())
- return false;
+ return info->is_detachable();
return info->filter()->Send(
new ResourceMsg_UploadProgress(request_id, position, size));
}
@@ -149,8 +150,9 @@ bool AsyncResourceHandler::OnRequestRedirected(int request_id,
bool* defer) {
const ResourceRequestInfoImpl* info =
ResourceRequestInfoImpl::ForRequest(request_);
+ // Cancel the request if the renderer is gone unless it's detachable.
if (!info->filter())
- return false;
+ return info->is_detachable();
*defer = did_defer_ = true;
@@ -177,8 +179,9 @@ bool AsyncResourceHandler::OnResponseStarted(int request_id,
const ResourceRequestInfoImpl* info =
ResourceRequestInfoImpl::ForRequest(request_);
+ // Cancel the request if the renderer is gone unless it's detachable.
if (!info->filter())
- return false;
+ return info->is_detachable();
if (rdh_->delegate()) {
rdh_->delegate()->OnResponseStarted(
@@ -249,6 +252,11 @@ bool AsyncResourceHandler::OnReadCompleted(int request_id, int bytes_read,
const ResourceRequestInfoImpl* info =
ResourceRequestInfoImpl::ForRequest(request_);
+ // Don't send any data for detachable requests.
James Simonsen 2013/10/26 02:25:00 On face value, this doesn't sound right. It seems
jkarlin2 2013/10/28 19:25:41 Done. There is now a distinct "detached" state an
+ if (info->is_detachable()) {
+ buffer_->RecycleLeastRecentlyAllocated();
+ return true;
+ }
if (!info->filter())
return false;
@@ -311,8 +319,9 @@ bool AsyncResourceHandler::OnResponseCompleted(
const std::string& security_info) {
const ResourceRequestInfoImpl* info =
ResourceRequestInfoImpl::ForRequest(request_);
+ // Cancel the request if the renderer is gone unless it's detachable.
if (!info->filter())
- return false;
+ return info->is_detachable();
// If we crash here, figure out what URL the renderer was requesting.
// http://crbug.com/107692

Powered by Google App Engine
This is Rietveld 408576698