| Index: content/browser/renderer_host/resource_dispatcher_host.cc
|
| diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc
|
| index 0f26b2c13a2e41d627faa06be4666a27475df179..f376e09f1dd574657cf1220689ef2677a3017102 100644
|
| --- a/content/browser/renderer_host/resource_dispatcher_host.cc
|
| +++ b/content/browser/renderer_host/resource_dispatcher_host.cc
|
| @@ -304,6 +304,18 @@ void OnSwapOutACKHelper(int render_process_id, int render_view_id) {
|
| rvh->OnSwapOutACK();
|
| }
|
|
|
| +net::Error CallbackAndReturn(
|
| + const DownloadResourceHandler::OnStartedCallback& started_cb,
|
| + net::Error net_error) {
|
| + if (started_cb.is_null())
|
| + return net_error;
|
| + BrowserThread::PostTask(
|
| + BrowserThread::UI, FROM_HERE,
|
| + base::Bind(started_cb, content::DownloadId::Invalid(), net_error));
|
| +
|
| + return net_error;
|
| +}
|
| +
|
| } // namespace
|
|
|
| ResourceDispatcherHost* ResourceDispatcherHost::Get() {
|
| @@ -924,7 +936,7 @@ net::Error ResourceDispatcherHost::BeginDownload(
|
| int route_id,
|
| content::ResourceContext* context) {
|
| if (is_shutdown_)
|
| - return net::ERR_INSUFFICIENT_RESOURCES;
|
| + return CallbackAndReturn(started_cb, net::ERR_INSUFFICIENT_RESOURCES);
|
|
|
| const GURL& url = request->original_url();
|
| #if defined(OS_CHROMEOS)
|
| @@ -953,11 +965,13 @@ net::Error ResourceDispatcherHost::BeginDownload(
|
| CanRequestURL(child_id, url)) {
|
| VLOG(1) << "Denied unauthorized download request for "
|
| << url.possibly_invalid_spec();
|
| - return net::ERR_ACCESS_DENIED;
|
| + return CallbackAndReturn(started_cb, net::ERR_ACCESS_DENIED);
|
| }
|
|
|
| request_id_--;
|
|
|
| + // From this point forward, the |DownloadResourceHandler| is responsible for
|
| + // |started_cb|.
|
| scoped_refptr<ResourceHandler> handler(
|
| CreateResourceHandlerForDownload(request.get(), context, child_id,
|
| route_id, request_id_, save_info,
|
|
|