summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host/resource_dispatcher_host.h
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-28 22:52:55 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-28 22:52:55 +0000
commit7176ef1c7ada2da66a47ed38987c92a06f3bfb4a (patch)
tree2c634b56eccb0626448ee99cb3415ba1809499c0 /chrome/browser/renderer_host/resource_dispatcher_host.h
parentecc523f661dd66ab6dafa276971c84f491f2521e (diff)
downloadchromium_src-7176ef1c7ada2da66a47ed38987c92a06f3bfb4a.zip
chromium_src-7176ef1c7ada2da66a47ed38987c92a06f3bfb4a.tar.gz
chromium_src-7176ef1c7ada2da66a47ed38987c92a06f3bfb4a.tar.bz2
Flesh out URLLoader's download_to_file function.
* tie the lifetime of the resulting temp file to the lifetime of the URLLoader (the plan is to later extend the lifetime of the temp file to support xhr.responseBlob) * make it work in test_shell * make it work for sync requests * added OnDataDownloaded messages to report progress A related BlobURL loading change. * grab a reference to the blob early on to ensure it's still there when the 'job' is finally started. TEST=manual and deletable_file_reference_unittest.cc BUG=52486,56752 Review URL: http://codereview.chromium.org/3396029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60862 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/resource_dispatcher_host.h')
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h
index 1878177..95909d3be 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.h
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.h
@@ -47,6 +47,10 @@ struct GlobalRequestID;
struct ViewHostMsg_Resource_Request;
struct ViewMsg_ClosePage_Params;
+namespace webkit_blob {
+class DeletableFileReference;
+}
+
class ResourceDispatcherHost : public URLRequest::Delegate {
public:
// Implemented by the client of ResourceDispatcherHost to receive messages in
@@ -264,6 +268,15 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
// messages sent.
void DataReceivedACK(int process_unique_id, int request_id);
+ // Maintains a collection of temp files created in support of
+ // the download_to_file capability. Used to grant access to the
+ // child process and to defer deletion of the file until it's
+ // no longer needed.
+ void RegisterDownloadedTempFile(
+ int receiver_id, int request_id,
+ webkit_blob::DeletableFileReference* reference);
+ void UnregisterDownloadedTempFile(int receiver_id, int request_id);
+
// Needed for the sync IPC message dispatcher macros.
bool Send(IPC::Message* message);
@@ -397,11 +410,13 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
IPC::Message* sync_result, // only valid for sync
int route_id); // only valid for async
void OnDataReceivedACK(int request_id);
+ void OnDataDownloadedACK(int request_id);
void OnUploadProgressACK(int request_id);
void OnCancelRequest(int request_id);
void OnFollowRedirect(int request_id,
bool has_new_first_party_for_cookies,
const GURL& new_first_party_for_cookies);
+ void OnReleaseDownloadedFile(int request_id);
ResourceHandler* CreateSafeBrowsingResourceHandler(
ResourceHandler* handler, int child_id, int route_id,
@@ -432,6 +447,15 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
PendingRequestList pending_requests_;
+ // Collection of temp files downloaded for child processes via
+ // the download_to_file mechanism. We avoid deleting them until
+ // the client no longer needs them.
+ typedef std::map<int, scoped_refptr<webkit_blob::DeletableFileReference> >
+ DeletableFilesMap; // key is request id
+ typedef std::map<int, DeletableFilesMap>
+ RegisteredTempFiles; // key is child process id
+ RegisteredTempFiles registered_temp_files_;
+
// A timer that periodically calls UpdateLoadStates while pending_requests_
// is not empty.
base::RepeatingTimer<ResourceDispatcherHost> update_load_states_timer_;