summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvmpstr <vmpstr@chromium.org>2016-03-11 13:39:53 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-11 21:41:00 +0000
commitad1b44e489281f42a0ea6d7d9516ba30d5879225 (patch)
treef5ffaa978a00a96c46ead77c1e05c0a65157de22
parent3cb637dda82dc3df902f9341718a8a785368204b (diff)
downloadchromium_src-ad1b44e489281f42a0ea6d7d9516ba30d5879225.zip
chromium_src-ad1b44e489281f42a0ea6d7d9516ba30d5879225.tar.gz
chromium_src-ad1b44e489281f42a0ea6d7d9516ba30d5879225.tar.bz2
Remove std::mem_fun uses.
This patch removes std::mem_fun and std::mem_fun_ref uses from the codebase, since those are deprecated in C++11. Additionally, the resulting code should be simpler to parse, since most of the time the use is replaced with a ranged based for-loop, which is a more familiar construct. Discussion: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/ip8T6u-o7KY TBR=gavinp BUG=593407 Review URL: https://codereview.chromium.org/1782963002 Cr-Commit-Position: refs/heads/master@{#380740}
-rw-r--r--chrome/browser/browsing_data/cookies_tree_model.cc5
-rw-r--r--chrome/browser/prerender/prerender_manager.cc14
-rw-r--r--chrome/browser/search_engines/search_provider_install_data.cc5
-rw-r--r--chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc4
-rw-r--r--content/browser/appcache/appcache_service_impl.cc5
-rw-r--r--content/browser/appcache/appcache_storage_impl.cc10
-rw-r--r--net/disk_cache/simple/simple_backend_impl.cc4
-rw-r--r--storage/browser/quota/quota_manager.cc4
-rw-r--r--storage/browser/quota/quota_task.cc5
9 files changed, 24 insertions, 32 deletions
diff --git a/chrome/browser/browsing_data/cookies_tree_model.cc b/chrome/browser/browsing_data/cookies_tree_model.cc
index 1f4cfd3..79befce 100644
--- a/chrome/browser/browsing_data/cookies_tree_model.cc
+++ b/chrome/browser/browsing_data/cookies_tree_model.cc
@@ -290,9 +290,8 @@ CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitFlashLSO(
// CookieTreeNode, public:
void CookieTreeNode::DeleteStoredObjects() {
- std::for_each(children().begin(),
- children().end(),
- std::mem_fun(&CookieTreeNode::DeleteStoredObjects));
+ for (auto* child : children())
+ child->DeleteStoredObjects();
}
CookiesTreeModel* CookieTreeNode::GetModel() const {
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index 4bb07b2..f809316 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -1039,16 +1039,14 @@ void PrerenderManager::PeriodicCleanup() {
// Grab a copy of the current PrerenderContents pointers, so that we
// will not interfere with potential deletions of the list.
- std::vector<PrerenderContents*>
- prerender_contents(active_prerenders_.size());
- std::transform(active_prerenders_.begin(), active_prerenders_.end(),
- prerender_contents.begin(),
- std::mem_fun(&PrerenderData::contents));
+ std::vector<PrerenderContents*> prerender_contents;
+ prerender_contents.reserve(active_prerenders_.size());
+ for (auto* prerender : active_prerenders_)
+ prerender_contents.push_back(prerender->contents());
// And now check for prerenders using too much memory.
- std::for_each(prerender_contents.begin(), prerender_contents.end(),
- std::mem_fun(
- &PrerenderContents::DestroyWhenUsingTooManyResources));
+ for (auto* contents : prerender_contents)
+ contents->DestroyWhenUsingTooManyResources();
// Measure how long the resource checks took. http://crbug.com/305419.
UMA_HISTOGRAM_TIMES("Prerender.PeriodicCleanupResourceCheckTime",
diff --git a/chrome/browser/search_engines/search_provider_install_data.cc b/chrome/browser/search_engines/search_provider_install_data.cc
index dcf0d7c..78bd1c4 100644
--- a/chrome/browser/search_engines/search_provider_install_data.cc
+++ b/chrome/browser/search_engines/search_provider_install_data.cc
@@ -306,9 +306,8 @@ void SearchProviderInstallData::NotifyLoaded() {
std::vector<base::Closure> closure_queue;
closure_queue.swap(closure_queue_);
- std::for_each(closure_queue.begin(),
- closure_queue.end(),
- std::mem_fun_ref(&base::Closure::Run));
+ for (auto& closure : closure_queue)
+ closure.Run();
// Since we expect this request to be rare, clear out the information. This
// also keeps the responses current as the search providers change.
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc
index c43d298..ce221ce 100644
--- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc
+++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc
@@ -349,8 +349,8 @@ MultiUserWindowManagerChromeOSTest::GetOwnersOfVisibleWindowsAsString() {
multi_user_window_manager_->GetOwnersOfVisibleWindows(&owners);
std::vector<std::string> owner_list;
- std::transform(owners.begin(), owners.end(), std::back_inserter(owner_list),
- std::mem_fun_ref(&AccountId::GetUserEmail));
+ for (auto& owner : owners)
+ owner_list.push_back(owner.GetUserEmail());
return base::JoinString(owner_list, " ");
}
diff --git a/content/browser/appcache/appcache_service_impl.cc b/content/browser/appcache/appcache_service_impl.cc
index 2fc5d94..537ca8e 100644
--- a/content/browser/appcache/appcache_service_impl.cc
+++ b/content/browser/appcache/appcache_service_impl.cc
@@ -412,9 +412,8 @@ AppCacheServiceImpl::AppCacheServiceImpl(
AppCacheServiceImpl::~AppCacheServiceImpl() {
DCHECK(backends_.empty());
- std::for_each(pending_helpers_.begin(),
- pending_helpers_.end(),
- std::mem_fun(&AsyncHelper::Cancel));
+ for (auto* helper : pending_helpers_)
+ helper->Cancel();
STLDeleteElements(&pending_helpers_);
if (quota_client_)
quota_client_->NotifyAppCacheDestroyed();
diff --git a/content/browser/appcache/appcache_storage_impl.cc b/content/browser/appcache/appcache_storage_impl.cc
index 2a255ed..fbb7290 100644
--- a/content/browser/appcache/appcache_storage_impl.cc
+++ b/content/browser/appcache/appcache_storage_impl.cc
@@ -1419,12 +1419,10 @@ AppCacheStorageImpl::AppCacheStorageImpl(AppCacheServiceImpl* service)
}
AppCacheStorageImpl::~AppCacheStorageImpl() {
- std::for_each(pending_quota_queries_.begin(),
- pending_quota_queries_.end(),
- std::mem_fun(&DatabaseTask::CancelCompletion));
- std::for_each(scheduled_database_tasks_.begin(),
- scheduled_database_tasks_.end(),
- std::mem_fun(&DatabaseTask::CancelCompletion));
+ for (auto* task : pending_quota_queries_)
+ task->CancelCompletion();
+ for (auto* task : scheduled_database_tasks_)
+ task->CancelCompletion();
if (database_ &&
!db_thread_->PostTask(
diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc
index 9f410ed..00f6d15 100644
--- a/net/disk_cache/simple/simple_backend_impl.cc
+++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -295,8 +295,8 @@ void SimpleBackendImpl::OnDoomComplete(uint64_t entry_hash) {
to_run_closures.swap(it->second);
entries_pending_doom_.erase(it);
- std::for_each(to_run_closures.begin(), to_run_closures.end(),
- std::mem_fun_ref(&Closure::Run));
+ for (auto& closure : to_run_closures)
+ closure.Run();
}
void SimpleBackendImpl::DoomEntries(std::vector<uint64_t>* entry_hashes,
diff --git a/storage/browser/quota/quota_manager.cc b/storage/browser/quota/quota_manager.cc
index 5000061..cb1add8 100644
--- a/storage/browser/quota/quota_manager.cc
+++ b/storage/browser/quota/quota_manager.cc
@@ -1282,8 +1282,8 @@ void QuotaManager::RemoveStorageObserverForFilter(
QuotaManager::~QuotaManager() {
proxy_->manager_ = NULL;
- std::for_each(clients_.begin(), clients_.end(),
- std::mem_fun(&QuotaClient::OnQuotaManagerDestroyed));
+ for (auto* client : clients_)
+ client->OnQuotaManagerDestroyed();
if (database_)
db_thread_->DeleteSoon(FROM_HERE, database_.release());
}
diff --git a/storage/browser/quota/quota_task.cc b/storage/browser/quota/quota_task.cc
index a0bda59..55ade2b 100644
--- a/storage/browser/quota/quota_task.cc
+++ b/storage/browser/quota/quota_task.cc
@@ -58,9 +58,8 @@ void QuotaTask::DeleteSoon() {
// QuotaTaskObserver -------------------------------------------------------
QuotaTaskObserver::~QuotaTaskObserver() {
- std::for_each(running_quota_tasks_.begin(),
- running_quota_tasks_.end(),
- std::mem_fun(&QuotaTask::Abort));
+ for (auto* task : running_quota_tasks_)
+ task->Abort();
}
QuotaTaskObserver::QuotaTaskObserver() {