summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvmpstr <vmpstr@chromium.org>2016-03-09 11:38:19 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-09 19:41:09 +0000
commit3abe3303bcbb2b24d7c21228f88114337347b674 (patch)
tree8c81c0ada48e93499286fc435f8a30cd8a2ef7e7
parentb2bf6ebb42d71afea2b6ef3834a40724fa2fb3f6 (diff)
downloadchromium_src-3abe3303bcbb2b24d7c21228f88114337347b674.zip
chromium_src-3abe3303bcbb2b24d7c21228f88114337347b674.tar.gz
chromium_src-3abe3303bcbb2b24d7c21228f88114337347b674.tar.bz2
Remove uses of std::unary_function and std::binary_function.
This patch removes unary and binary function, since those are deprecated in C++11. They also only provide two typedefs, so this cleans up some code. In rare cases where the typedefs are actually required, it's easier to just provide the typedef directly instead of deriving from one of these functions. BUG=593407 Review URL: https://codereview.chromium.org/1420333006 Cr-Commit-Position: refs/heads/master@{#380179}
-rw-r--r--ash/wm/overview/window_grid.cc3
-rw-r--r--ash/wm/overview/window_selector.cc9
-rw-r--r--components/bookmarks/browser/bookmark_index.cc6
-rw-r--r--components/bookmarks/browser/bookmark_model.cc9
-rw-r--r--components/omnibox/browser/history_quick_provider_unittest.cc3
-rw-r--r--components/omnibox/browser/url_index_private_data.h5
-rw-r--r--components/variations/entropy_provider.h2
-rw-r--r--content/browser/appcache/appcache_storage_impl.cc6
-rw-r--r--net/cookies/cookie_monster.cc3
-rw-r--r--tools/gn/label_ptr.h8
-rw-r--r--ui/base/l10n/l10n_util_collator.h14
11 files changed, 20 insertions, 48 deletions
diff --git a/ash/wm/overview/window_grid.cc b/ash/wm/overview/window_grid.cc
index 2036d55..e415726 100644
--- a/ash/wm/overview/window_grid.cc
+++ b/ash/wm/overview/window_grid.cc
@@ -68,8 +68,7 @@ void CleanupWidgetAfterAnimationObserver::OnImplicitAnimationsCompleted() {
}
// A comparator for locating a given target window.
-struct WindowSelectorItemComparator
- : public std::unary_function<WindowSelectorItem*, bool> {
+struct WindowSelectorItemComparator {
explicit WindowSelectorItemComparator(const aura::Window* target_window)
: target(target_window) {
}
diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc
index c940dff..109143e 100644
--- a/ash/wm/overview/window_selector.cc
+++ b/ash/wm/overview/window_selector.cc
@@ -73,8 +73,7 @@ const unsigned char kTextFilterOpacity = 180;
const int kTextFilterCornerRadius = 1;
// A comparator for locating a grid with a given root window.
-struct RootWindowGridComparator
- : public std::unary_function<WindowGrid*, bool> {
+struct RootWindowGridComparator {
explicit RootWindowGridComparator(const aura::Window* root_window)
: root_window_(root_window) {
}
@@ -87,8 +86,7 @@ struct RootWindowGridComparator
};
// A comparator for locating a selectable window given a targeted window.
-struct WindowSelectorItemTargetComparator
- : public std::unary_function<WindowSelectorItem*, bool> {
+struct WindowSelectorItemTargetComparator {
explicit WindowSelectorItemTargetComparator(const aura::Window* target_window)
: target(target_window) {
}
@@ -101,8 +99,7 @@ struct WindowSelectorItemTargetComparator
};
// A comparator for locating a selector item for a given root.
-struct WindowSelectorItemForRoot
- : public std::unary_function<WindowSelectorItem*, bool> {
+struct WindowSelectorItemForRoot {
explicit WindowSelectorItemForRoot(const aura::Window* root)
: root_window(root) {
}
diff --git a/components/bookmarks/browser/bookmark_index.cc b/components/bookmarks/browser/bookmark_index.cc
index e953df8..d4fbf32 100644
--- a/components/bookmarks/browser/bookmark_index.cc
+++ b/components/bookmarks/browser/bookmark_index.cc
@@ -56,8 +56,7 @@ base::string16 Normalize(const base::string16& text) {
// Sort functor for NodeTypedCountPairs. We sort in decreasing order of typed
// count so that the best matches will always be added to the results.
-struct NodeTypedCountPairSortFunctor
- : std::binary_function<NodeTypedCountPair, NodeTypedCountPair, bool> {
+struct NodeTypedCountPairSortFunctor {
bool operator()(const NodeTypedCountPair& a,
const NodeTypedCountPair& b) const {
return a.second > b.second;
@@ -65,8 +64,7 @@ struct NodeTypedCountPairSortFunctor
};
// Extract the const Node* stored in a BookmarkClient::NodeTypedCountPair.
-struct NodeTypedCountPairExtractNodeFunctor
- : std::unary_function<NodeTypedCountPair, const BookmarkNode*> {
+struct NodeTypedCountPairExtractNodeFunctor {
const BookmarkNode* operator()(const NodeTypedCountPair& pair) const {
return pair.first;
}
diff --git a/components/bookmarks/browser/bookmark_model.cc b/components/bookmarks/browser/bookmark_model.cc
index 3b50276..51d0f50 100644
--- a/components/bookmarks/browser/bookmark_model.cc
+++ b/components/bookmarks/browser/bookmark_model.cc
@@ -47,10 +47,7 @@ BookmarkPermanentNode* AsMutable(const BookmarkPermanentNode* node) {
// Comparator used when sorting permanent nodes. Nodes that are initially
// visible are sorted before nodes that are initially hidden.
-class VisibilityComparator
- : public std::binary_function<const BookmarkPermanentNode*,
- const BookmarkPermanentNode*,
- bool> {
+class VisibilityComparator {
public:
explicit VisibilityComparator(BookmarkClient* client) : client_(client) {}
@@ -68,9 +65,7 @@ class VisibilityComparator
// Comparator used when sorting bookmarks. Folders are sorted first, then
// bookmarks.
-class SortComparator : public std::binary_function<const BookmarkNode*,
- const BookmarkNode*,
- bool> {
+class SortComparator {
public:
explicit SortComparator(icu::Collator* collator) : collator_(collator) {}
diff --git a/components/omnibox/browser/history_quick_provider_unittest.cc b/components/omnibox/browser/history_quick_provider_unittest.cc
index da6abd4..a5e19dd 100644
--- a/components/omnibox/browser/history_quick_provider_unittest.cc
+++ b/components/omnibox/browser/history_quick_provider_unittest.cc
@@ -237,8 +237,7 @@ class HistoryQuickProviderTest : public testing::Test {
HistoryQuickProviderTest() {}
protected:
- class SetShouldContain : public std::unary_function<const std::string&,
- std::set<std::string> > {
+ class SetShouldContain {
public:
explicit SetShouldContain(const ACMatches& matched_urls);
diff --git a/components/omnibox/browser/url_index_private_data.h b/components/omnibox/browser/url_index_private_data.h
index a7348cc..0a327e5 100644
--- a/components/omnibox/browser/url_index_private_data.h
+++ b/components/omnibox/browser/url_index_private_data.h
@@ -198,7 +198,7 @@ class URLIndexPrivateData
// A helper class which performs the final filter on each candidate
// history URL match, inserting accepted matches into |scored_matches_|.
- class AddHistoryMatch : public std::unary_function<HistoryID, void> {
+ class AddHistoryMatch {
public:
AddHistoryMatch(bookmarks::BookmarkModel* bookmark_model,
TemplateURLService* template_url_service,
@@ -230,8 +230,7 @@ class URLIndexPrivateData
// A helper predicate class used to filter excess history items when the
// candidate results set is too large.
- class HistoryItemFactorGreater
- : public std::binary_function<HistoryID, HistoryID, void> {
+ class HistoryItemFactorGreater {
public:
explicit HistoryItemFactorGreater(const HistoryInfoMap& history_info_map);
~HistoryItemFactorGreater();
diff --git a/components/variations/entropy_provider.h b/components/variations/entropy_provider.h
index fa7a1e2..27e73eb 100644
--- a/components/variations/entropy_provider.h
+++ b/components/variations/entropy_provider.h
@@ -24,7 +24,7 @@ namespace internal {
// A functor that generates random numbers based on a seed, using the Mersenne
// Twister algorithm. Suitable for use with std::random_shuffle().
-struct SeededRandGenerator : std::unary_function<uint32_t, uint32_t> {
+struct SeededRandGenerator {
explicit SeededRandGenerator(uint32_t seed);
~SeededRandGenerator();
diff --git a/content/browser/appcache/appcache_storage_impl.cc b/content/browser/appcache/appcache_storage_impl.cc
index b144eb6..2a255ed 100644
--- a/content/browser/appcache/appcache_storage_impl.cc
+++ b/content/browser/appcache/appcache_storage_impl.cc
@@ -837,11 +837,7 @@ void AppCacheStorageImpl::StoreGroupAndCacheTask::CancelCompletion() {
// Helpers for FindMainResponseTask::Run()
namespace {
-class SortByCachePreference
- : public std::binary_function<
- AppCacheDatabase::EntryRecord,
- AppCacheDatabase::EntryRecord,
- bool> {
+class SortByCachePreference {
public:
SortByCachePreference(int64_t preferred_id,
const std::set<int64_t>& in_use_ids)
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index 09bf473..c73e74a 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -251,8 +251,7 @@ void SplitCookieVectorIntoSecureAndNonSecure(
}
// Predicate to support PartitionCookieByPriority().
-struct CookiePriorityEqualsTo
- : std::unary_function<const CookieMonster::CookieMap::iterator, bool> {
+struct CookiePriorityEqualsTo {
explicit CookiePriorityEqualsTo(CookiePriority priority)
: priority_(priority) {}
diff --git a/tools/gn/label_ptr.h b/tools/gn/label_ptr.h
index 4ce20a6..c0b2d63 100644
--- a/tools/gn/label_ptr.h
+++ b/tools/gn/label_ptr.h
@@ -56,7 +56,7 @@ typedef std::vector<LabelTargetPair> LabelTargetVector;
// To do a brute-force search by label:
// std::find_if(vect.begin(), vect.end(), LabelPtrLabelEquals<Config>(label));
template<typename T>
-struct LabelPtrLabelEquals : public std::unary_function<Label, bool> {
+struct LabelPtrLabelEquals {
explicit LabelPtrLabelEquals(const Label& l) : label(l) {}
bool operator()(const LabelPtrPair<T>& arg) const {
@@ -69,7 +69,7 @@ struct LabelPtrLabelEquals : public std::unary_function<Label, bool> {
// To do a brute-force search by object pointer:
// std::find_if(vect.begin(), vect.end(), LabelPtrPtrEquals<Config>(config));
template<typename T>
-struct LabelPtrPtrEquals : public std::unary_function<T, bool> {
+struct LabelPtrPtrEquals {
explicit LabelPtrPtrEquals(const T* p) : ptr(p) {}
bool operator()(const LabelPtrPair<T>& arg) const {
@@ -82,9 +82,7 @@ struct LabelPtrPtrEquals : public std::unary_function<T, bool> {
// To sort by label:
// std::sort(vect.begin(), vect.end(), LabelPtrLabelLess<Config>());
template<typename T>
-struct LabelPtrLabelLess : public std::binary_function<LabelPtrPair<T>,
- LabelPtrPair<T>,
- bool> {
+struct LabelPtrLabelLess {
bool operator()(const LabelPtrPair<T>& a, const LabelPtrPair<T>& b) const {
return a.label < b.label;
}
diff --git a/ui/base/l10n/l10n_util_collator.h b/ui/base/l10n/l10n_util_collator.h
index d2b95f2..423f17a 100644
--- a/ui/base/l10n/l10n_util_collator.h
+++ b/ui/base/l10n/l10n_util_collator.h
@@ -22,10 +22,7 @@ namespace l10n_util {
// Used by SortStringsUsingMethod. Invokes a method on the objects passed to
// operator (), comparing the string results using a collator.
template <class T, class Method>
-class StringMethodComparatorWithCollator
- : public std::binary_function<const base::string16&,
- const base::string16&,
- bool> {
+class StringMethodComparatorWithCollator {
public:
StringMethodComparatorWithCollator(icu::Collator* collator, Method method)
: collator_(collator),
@@ -46,10 +43,7 @@ class StringMethodComparatorWithCollator
// Used by SortStringsUsingMethod. Invokes a method on the objects passed to
// operator (), comparing the string results using <.
template <class T, class Method>
-class StringMethodComparator
- : public std::binary_function<const base::string16&,
- const base::string16&,
- bool> {
+class StringMethodComparator {
public:
explicit StringMethodComparator(Method method) : method_(method) { }
@@ -88,9 +82,7 @@ void SortStringsUsingMethod(const std::string& locale,
// const base::string16& GetStringKey() const;
// This uses the locale specified in the constructor.
template <class Element>
-class StringComparator : public std::binary_function<const Element&,
- const Element&,
- bool> {
+class StringComparator {
public:
explicit StringComparator(icu::Collator* collator)
: collator_(collator) { }