diff options
author | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-24 21:25:53 +0000 |
---|---|---|
committer | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-24 21:25:53 +0000 |
commit | 3c9481d85927a107c1caae8fcab96e975840de47 (patch) | |
tree | db4c9c677aacc99b05c358f634d66a3e0ada13db /chrome/browser/renderer_host/buffered_resource_handler.cc | |
parent | 271deed863100722af77d371ac87b77b31279472 (diff) | |
download | chromium_src-3c9481d85927a107c1caae8fcab96e975840de47.zip chromium_src-3c9481d85927a107c1caae8fcab96e975840de47.tar.gz chromium_src-3c9481d85927a107c1caae8fcab96e975840de47.tar.bz2 |
Clean up WebKit resources after starting a download.
Downloads initiated in the renderer process have associated
resources that need to be cleaned up properly. Since we handle
downloads in the browser process, the renderer was not receiving
the completion notification and thus hanging on to resources.
We now send the renderer a completion notification once we detect
that a resource request is a download, so that the renderer can
properly clean up.
BUG=6531 (http://crbug.com/6531)
Review URL: http://codereview.chromium.org/20524
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10291 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/buffered_resource_handler.cc')
-rw-r--r-- | chrome/browser/renderer_host/buffered_resource_handler.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/chrome/browser/renderer_host/buffered_resource_handler.cc b/chrome/browser/renderer_host/buffered_resource_handler.cc index 0f4f3d7..f70ac9e 100644 --- a/chrome/browser/renderer_host/buffered_resource_handler.cc +++ b/chrome/browser/renderer_host/buffered_resource_handler.cc @@ -264,11 +264,15 @@ bool BufferedResourceHandler::CompleteResponseStarted(int request_id, CHECK((buf_len >= bytes_read_) && (bytes_read_ >= 0)); memcpy(buf->data(), read_buffer_->data(), bytes_read_); } - // Update the renderer with the response headers which will cause it to - // cancel the request. - // TODO(paulg): Send the renderer a response that indicates that the request - // will be handled by an external source (the browser). + + // Send the renderer a response that indicates that the request will be + // handled by an external source (the browser's DownloadManager). real_handler_->OnResponseStarted(info->request_id, response_); + URLRequestStatus status(URLRequestStatus::HANDLED_EXTERNALLY, 0); + real_handler_->OnResponseCompleted(info->request_id, status); + + // Ditch the old async handler that talks to the renderer for the new + // download handler that talks to the DownloadManager. real_handler_ = download_handler; } return real_handler_->OnResponseStarted(request_id, response_); |