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

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: Cancellation delay now settable at command line 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..9f2e5cfcc70863a0d3bff05c92dcbe2d6b274c85 100644
--- a/content/browser/loader/async_resource_handler.cc
+++ b/content/browser/loader/async_resource_handler.cc
@@ -87,7 +87,8 @@ AsyncResourceHandler::AsyncResourceHandler(
did_defer_(false),
has_checked_for_sufficient_resources_(false),
sent_received_response_msg_(false),
- sent_first_data_msg_(false) {
+ sent_first_data_msg_(false),
+ detached_reads_(false) {
InitializeResourceBufferConstants();
}
@@ -247,6 +248,11 @@ bool AsyncResourceHandler::OnReadCompleted(int request_id, int bytes_read,
if (!bytes_read)
return true;
+ if (detached_reads_) {
+ buffer_->RecycleLeastRecentlyAllocated();
+ return true;
+ }
+
const ResourceRequestInfoImpl* info =
ResourceRequestInfoImpl::ForRequest(request_);
if (!info->filter())
@@ -384,4 +390,8 @@ void AsyncResourceHandler::ResumeIfDeferred() {
}
}
+void AsyncResourceHandler::DetachReads() {
+ detached_reads_ = true;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698