Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5954)

Unified Diff: chrome/browser/download/download_test_observer.cc

Issue 10837125: Revert 149794 - DownloadItem::Observer::OnDownloadDestroyed() replaces DownloadItem::REMOVING (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1228/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_test_observer.h ('k') | chrome/browser/download/download_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_test_observer.cc
===================================================================
--- chrome/browser/download/download_test_observer.cc (revision 150095)
+++ chrome/browser/download/download_test_observer.cc (working copy)
@@ -85,15 +85,17 @@
wait_count_);
}
-void DownloadTestObserver::OnDownloadDestroyed(DownloadItem* download) {
+void DownloadTestObserver::OnDownloadUpdated(DownloadItem* download) {
+ // The REMOVING state indicates that the download is being destroyed.
// Stop observing. Do not do anything with it, as it is about to be gone.
- DownloadSet::iterator it = downloads_observed_.find(download);
- ASSERT_TRUE(it != downloads_observed_.end());
- downloads_observed_.erase(it);
- download->RemoveObserver(this);
-}
+ if (download->GetState() == DownloadItem::REMOVING) {
+ DownloadSet::iterator it = downloads_observed_.find(download);
+ ASSERT_TRUE(it != downloads_observed_.end());
+ downloads_observed_.erase(it);
+ download->RemoveObserver(this);
+ return;
+ }
-void DownloadTestObserver::OnDownloadUpdated(DownloadItem* download) {
// Real UI code gets the user's response after returning from the observer.
if (download->GetSafetyState() == DownloadItem::DANGEROUS &&
!ContainsKey(dangerous_downloads_seen_, download->GetId())) {
@@ -266,15 +268,17 @@
CheckDownloadsInProgress(true);
}
-void DownloadTestFlushObserver::OnDownloadDestroyed(DownloadItem* download) {
+void DownloadTestFlushObserver::OnDownloadUpdated(DownloadItem* download) {
+ // The REMOVING state indicates that the download is being destroyed.
// Stop observing. Do not do anything with it, as it is about to be gone.
- DownloadSet::iterator it = downloads_observed_.find(download);
- ASSERT_TRUE(it != downloads_observed_.end());
- downloads_observed_.erase(it);
- download->RemoveObserver(this);
-}
+ if (download->GetState() == DownloadItem::REMOVING) {
+ DownloadSet::iterator it = downloads_observed_.find(download);
+ ASSERT_TRUE(it != downloads_observed_.end());
+ downloads_observed_.erase(it);
+ download->RemoveObserver(this);
+ return;
+ }
-void DownloadTestFlushObserver::OnDownloadUpdated(DownloadItem* download) {
// No change in DownloadItem set on manager.
CheckDownloadsInProgress(false);
}
« no previous file with comments | « chrome/browser/download/download_test_observer.h ('k') | chrome/browser/download/download_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698