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
29 files changed