Chromium Code Reviews| Index: content/browser/download/download_manager_impl.cc |
| diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc |
| index 9bdb48aa7bfbe2382d1e3b34056dbf0f6c79d308..22b4ea4416781811b6f36ce25a4a641e0e6ea991 100644 |
| --- a/content/browser/download/download_manager_impl.cc |
| +++ b/content/browser/download/download_manager_impl.cc |
| @@ -639,7 +639,12 @@ void DownloadManagerImpl::MaybeCompleteDownload(DownloadItem* download) { |
| DCHECK_EQ(1u, history_downloads_.count(download->GetDbHandle())); |
| // Give the delegate a chance to override. |
| - if (!delegate_->ShouldCompleteDownload(download)) |
| + // It's ok to keep re-setting the delegate's |maybe_complete_download| cb as |
| + // long as there isn't another call-point trying to set it to a different cb. |
| + // TODO(benjhayden): Change the callback to point directly to the item instead |
| + // of |this| when DownloadItem supports weak-ptrs. |
| + if (!delegate_->ShouldCompleteDownload(download, base::Bind( |
| + &DownloadManagerImpl::MaybeCompleteDownload, this, download))) |
|
asanka
2012/05/01 15:54:10
The download item could go away before the callbac
benjhayden
2012/05/01 18:02:52
Done.
|
| return; |
| VLOG(20) << __FUNCTION__ << "()" << " executing: download = " |