Make Callback.Equals() only work when comparing against the same type.
Previously, we were using the base class's comparator to check equality, which allows us to make comparisons across callbacks of different types. This disallows such a thing.
BUG=none
TEST=New no-compile test.
Review URL: http://codereview.chromium.org/7780016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100565 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/callback.h b/base/callback.h
index c1f584d5..03abb4b 100644
--- a/base/callback.h
+++ b/base/callback.h
@@ -258,6 +258,10 @@
callback_type_does_not_match_bind_result);
}
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
R Run() const {
PolymorphicInvoke f =
reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
@@ -292,6 +296,10 @@
callback_type_does_not_match_bind_result);
}
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
R Run(typename internal::ParamTraits<A1>::ForwardType a1) const {
PolymorphicInvoke f =
reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
@@ -327,6 +335,10 @@
callback_type_does_not_match_bind_result);
}
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
R Run(typename internal::ParamTraits<A1>::ForwardType a1,
typename internal::ParamTraits<A2>::ForwardType a2) const {
PolymorphicInvoke f =
@@ -365,6 +377,10 @@
callback_type_does_not_match_bind_result);
}
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
R Run(typename internal::ParamTraits<A1>::ForwardType a1,
typename internal::ParamTraits<A2>::ForwardType a2,
typename internal::ParamTraits<A3>::ForwardType a3) const {
@@ -406,6 +422,10 @@
callback_type_does_not_match_bind_result);
}
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
R Run(typename internal::ParamTraits<A1>::ForwardType a1,
typename internal::ParamTraits<A2>::ForwardType a2,
typename internal::ParamTraits<A3>::ForwardType a3,
@@ -451,6 +471,10 @@
callback_type_does_not_match_bind_result);
}
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
R Run(typename internal::ParamTraits<A1>::ForwardType a1,
typename internal::ParamTraits<A2>::ForwardType a2,
typename internal::ParamTraits<A3>::ForwardType a3,
@@ -499,6 +523,10 @@
callback_type_does_not_match_bind_result);
}
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
R Run(typename internal::ParamTraits<A1>::ForwardType a1,
typename internal::ParamTraits<A2>::ForwardType a2,
typename internal::ParamTraits<A3>::ForwardType a3,