Chromium Code Reviews| Index: content/browser/download/download_resource_handler.cc |
| diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc |
| index 05d22a8ee73cfe46f093aa7503646ed3a2bb6f98..e3c15303132063e137b0c2607f1c4bc75e69e88c 100644 |
| --- a/content/browser/download/download_resource_handler.cc |
| +++ b/content/browser/download/download_resource_handler.cc |
| @@ -106,19 +106,6 @@ DownloadResourceHandler::DownloadResourceHandler(net::URLRequest* request) |
| : ResourceHandler(request), |
| tab_info_(new DownloadTabInfo()), |
| core_(request, this) { |
| - // Do UI thread initialization for tab_info_ asap after |
| - // DownloadResourceHandler creation since the tab could be navigated |
| - // before StartOnUIThread gets called. This is safe because deletion |
| - // will occur via PostTask() as well, which will serialized behind this |
| - // PostTask() |
| - const ResourceRequestInfoImpl* request_info = GetRequestInfo(); |
| - BrowserThread::PostTask( |
| - BrowserThread::UI, FROM_HERE, |
| - base::Bind( |
| - &InitializeDownloadTabInfoOnUIThread, |
| - DownloadRequestHandle(AsWeakPtr(), |
| - request_info->GetWebContentsGetterForRequest()), |
| - tab_info_.get())); |
| } |
| DownloadResourceHandler::~DownloadResourceHandler() { |
| @@ -146,6 +133,19 @@ bool DownloadResourceHandler::OnResponseStarted( |
| } |
| bool DownloadResourceHandler::OnWillStart(const GURL& url, bool* defer) { |
| + // Do UI thread initialization for tab_info_ asap after |
|
svaldez
2016/08/19 17:05:14
Comment should be updated.
ananta
2016/08/19 19:02:14
Done.
|
| + // DownloadResourceHandler creation since the tab could be navigated |
| + // before StartOnUIThread gets called. This is safe because deletion |
| + // will occur via PostTask() as well, which will serialized behind this |
| + // PostTask() |
| + const ResourceRequestInfoImpl* request_info = GetRequestInfo(); |
| + BrowserThread::PostTask( |
| + BrowserThread::UI, FROM_HERE, |
| + base::Bind( |
| + &InitializeDownloadTabInfoOnUIThread, |
| + DownloadRequestHandle(AsWeakPtr(), |
| + request_info->GetWebContentsGetterForRequest()), |
| + tab_info_.get())); |
| return true; |
| } |