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

Unified Diff: content/browser/download/download_manager_impl.cc

Issue 2422923002: Reduce usage of FOR_EACH_OBSERVER macro in content/browser (Closed)
Patch Set: skip cases in 2418143004 and 2418373002 Created 4 years, 2 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 | « content/browser/download/download_item_impl.cc ('k') | content/browser/frame_host/frame_tree_node.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 176ec387ecf835cbf84d569ac16da842d1c105da..990ab5552ac6bce23abd02c1f36ccba816128878 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -274,7 +274,8 @@ void DownloadManagerImpl::Shutdown() {
return;
shutdown_needed_ = false;
- FOR_EACH_OBSERVER(Observer, observers_, ManagerGoingDown(this));
+ for (auto& observer : observers_)
+ observer.ManagerGoingDown(this);
// TODO(benjhayden): Consider clearing observers_.
// If there are in-progress downloads, cancel them. This also goes for
@@ -383,8 +384,10 @@ void DownloadManagerImpl::StartDownloadWithId(
// For new downloads, we notify here, rather than earlier, so that
// the download_file is bound to download and all the usual
// setters (e.g. Cancel) work.
- if (new_download)
- FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, download));
+ if (new_download) {
+ for (auto& observer : observers_)
+ observer.OnDownloadCreated(this, download);
+ }
if (!on_started.is_null())
on_started.Run(download, DOWNLOAD_INTERRUPT_REASON_NONE);
@@ -460,16 +463,16 @@ void DownloadManagerImpl::CreateSavePackageDownloadItemWithId(
downloads_[download_item->GetId()] = download_item;
DCHECK(!base::ContainsKey(downloads_by_guid_, download_item->GetGuid()));
downloads_by_guid_[download_item->GetGuid()] = download_item;
- FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(
- this, download_item));
+ for (auto& observer : observers_)
+ observer.OnDownloadCreated(this, download_item);
if (!item_created.is_null())
item_created.Run(download_item);
}
void DownloadManagerImpl::OnSavePackageSuccessfullyFinished(
DownloadItem* download_item) {
- FOR_EACH_OBSERVER(Observer, observers_,
- OnSavePackageSuccessfullyFinished(this, download_item));
+ for (auto& observer : observers_)
+ observer.OnSavePackageSuccessfullyFinished(this, download_item);
}
// Resume a download of a specific URL. We send the request to the
@@ -705,7 +708,8 @@ DownloadItem* DownloadManagerImpl::CreateDownloadItem(
net::NetLogWithSource::Make(net_log_, net::NetLogSourceType::DOWNLOAD));
downloads_[id] = item;
downloads_by_guid_[guid] = item;
- FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, item));
+ for (auto& observer : observers_)
+ observer.OnDownloadCreated(this, item);
DVLOG(20) << __func__ << "() download = " << item->DebugString(true);
return item;
}
« no previous file with comments | « content/browser/download/download_item_impl.cc ('k') | content/browser/frame_host/frame_tree_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698