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

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

Issue 82273002: Fix various issues in RedirectToFileResourceHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename test fixture Created 6 years, 9 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/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 5b2e78b7ab60308e817d8af3f819a0effcc4d6d4..ed4a7b0877529ba6e7fc90812cc897f5794103b1 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1150,18 +1150,20 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler(
handler.reset(new SyncResourceHandler(request, sync_result, this));
} else {
handler.reset(new AsyncResourceHandler(request, this));
- if (IsDetachableResourceType(request_data.resource_type)) {
- handler.reset(new DetachableResourceHandler(
- request,
- base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs),
- handler.Pass()));
- }
}
// The RedirectToFileResourceHandler depends on being next in the chain.
if (request_data.download_to_file) {
handler.reset(
- new RedirectToFileResourceHandler(handler.Pass(), request, this));
+ new RedirectToFileResourceHandler(handler.Pass(), request));
+ }
+
+ // Prefetches and <a ping> requests outlive their child process.
+ if (!sync_result && IsDetachableResourceType(request_data.resource_type)) {
+ handler.reset(new DetachableResourceHandler(
+ request,
+ base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs),
+ handler.Pass()));
}
// Install a CrossSiteResourceHandler for all main frame requests. This will
@@ -1216,7 +1218,11 @@ void ResourceDispatcherHostImpl::OnDataDownloadedACK(int request_id) {
}
void ResourceDispatcherHostImpl::RegisterDownloadedTempFile(
- int child_id, int request_id, ShareableFileReference* reference) {
+ int child_id, int request_id, const base::FilePath& file_path) {
+ scoped_refptr<ShareableFileReference> reference =
+ ShareableFileReference::Get(file_path);
+ DCHECK(reference);
+
registered_temp_files_[child_id][request_id] = reference;
ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
child_id, reference->path());
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.h ('k') | content/browser/loader/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698