Index: chrome/browser/profiles/off_the_record_profile_impl.cc |
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc |
index b4ffcf48b4bd9073f1c5694436ca5ad411bd58dc..568ec29216f177078ea2d75bdd864bf14173ee96 100644 |
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc |
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc |
@@ -115,6 +115,16 @@ void OffTheRecordProfileImpl::Init() { |
} |
OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { |
+ // Shutdown the DownloadManager here in the dtor as ProfileImpl does to |
+ // guarantee that it happens before the last scoped_refptr<DM> is reaped. |
+ // DownloadManager is lazily created, so check before accessing it. |
+ if (download_manager_.get()) { |
+ // Drop our download manager so we forget about all the downloads made |
+ // in incognito mode. |
+ download_manager_->Shutdown(); |
+ download_manager_ = NULL; |
+ } |
+ |
NotificationService::current()->Notify( |
chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(this), |
NotificationService::NoDetails()); |
@@ -539,22 +549,10 @@ void OffTheRecordProfileImpl::InitChromeOSPreferences() { |
} |
#endif // defined(OS_CHROMEOS) |
-void OffTheRecordProfileImpl::ExitedOffTheRecordMode() { |
- // DownloadManager is lazily created, so check before accessing it. |
- if (download_manager_.get()) { |
- // Drop our download manager so we forget about all the downloads made |
- // in incognito mode. |
- download_manager_->Shutdown(); |
- download_manager_ = NULL; |
- } |
-} |
- |
void OffTheRecordProfileImpl::OnBrowserAdded(const Browser* browser) { |
} |
void OffTheRecordProfileImpl::OnBrowserRemoved(const Browser* browser) { |
- if (BrowserList::GetBrowserCount(this) == 0) |
- ExitedOffTheRecordMode(); |
} |
ChromeBlobStorageContext* OffTheRecordProfileImpl::GetBlobStorageContext() { |