diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-21 18:02:59 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-21 18:02:59 +0000 |
commit | 22b30544a4070f147b78f3ea7975fec887df7fb6 (patch) | |
tree | d077a8b204b3412f908fd8eeb78cde3714aee114 /content/browser/renderer_host/async_resource_handler.cc | |
parent | 65429f2a4fd3fa373c1fd7e0c3e9c053fb5ed760 (diff) | |
download | chromium_src-22b30544a4070f147b78f3ea7975fec887df7fb6.zip chromium_src-22b30544a4070f147b78f3ea7975fec887df7fb6.tar.gz chromium_src-22b30544a4070f147b78f3ea7975fec887df7fb6.tar.bz2 |
Add defer out params to ResourceHandler's OnResponseStarted
and OnReadCompleted methods. Use that to pause the request
instead of directly calling ResourceDispatcherHostImpl's
PauseRequest function.
Eliminate direct calls to PauseRequest, with the exception of
resource_dispatcher_host_unittest.cc and some uses internal to
ResourceDispatcherHostImpl. Those should ultimately be
changed to use the defer out-param approach too.
This CL also changes the DownloadRequestHandle to talk back to
the DownloadResourceHandler in order to pause / resume / cancel
the URLRequest. The handle keeps a reference to the handler,
which may extend the lifetime of the handler, but that should be
OK given that the handler already supports having its lifetime
extended beyond the URLRequest.
Now, instead of the DownloadFileManager calling PauseRequest, we
just wait for the SetDownloadID call to resume the URLRequest.
This simplifies some of the logic. The Pause/ResumeRequest
issued on a DownloadRequestHandle gets its own pause counter,
which has nothing to do with the internal pausing that the
DownloadResourceHandler does when it is waiting for a DownloadId.
See DownloadResourceHandler::MaybeResumeRequest for the logic
that handles the conditions for resuming the URLRequest.
Review URL: https://chromiumcodereview.appspot.com/10332130
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/async_resource_handler.cc')
-rw-r--r-- | content/browser/renderer_host/async_resource_handler.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/content/browser/renderer_host/async_resource_handler.cc b/content/browser/renderer_host/async_resource_handler.cc index b73fb29..75762ac 100644 --- a/content/browser/renderer_host/async_resource_handler.cc +++ b/content/browser/renderer_host/async_resource_handler.cc @@ -120,7 +120,8 @@ bool AsyncResourceHandler::OnRequestRedirected( bool AsyncResourceHandler::OnResponseStarted( int request_id, - content::ResourceResponse* response) { + content::ResourceResponse* response, + bool* defer) { // For changes to the main frame, inform the renderer of the new URL's // per-host settings before the request actually commits. This way the // renderer will be able to set these precisely at the time the @@ -195,7 +196,8 @@ bool AsyncResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, return true; } -bool AsyncResourceHandler::OnReadCompleted(int request_id, int* bytes_read) { +bool AsyncResourceHandler::OnReadCompleted(int request_id, int* bytes_read, + bool* defer) { if (!*bytes_read) return true; DCHECK(read_buffer_.get()); |