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

Unified Diff: base/bind_helpers.h

Issue 6718021: Callback support for unbound reference and array arguments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 9 years, 9 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 | « no previous file | base/bind_internal.h » ('j') | base/callback_internal.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bind_helpers.h
diff --git a/base/bind_helpers.h b/base/bind_helpers.h
index c1ca3d793c13671dabc0a1e07af728a6232118d0..92194e713885d75f4cadf78a6f83780567168a5b 100644
--- a/base/bind_helpers.h
+++ b/base/bind_helpers.h
@@ -161,7 +161,11 @@ struct UnsafeBindtoRefCountedArgHelper<true, T>
};
template <typename T>
-struct UnsafeBindtoRefCountedArg
+struct UnsafeBindtoRefCountedArg : false_type {
+};
+
+template <typename T>
+struct UnsafeBindtoRefCountedArg<T*>
: UnsafeBindtoRefCountedArgHelper<is_class<T>::value, T> {
};
@@ -233,43 +237,6 @@ struct MaybeRefcount<base::true_type, const T*> {
static void Release(const T* o) { o->Release(); }
};
-
-// This is a typetraits object that's used to convert an argument type into a
-// type suitable for storage. In particular, it strips off references, and
-// converts arrays to pointers.
-//
-// This array type becomes an issue because we are passing bound parameters by
-// const reference. In this case, we end up passing an actual array type in the
-// initializer list which C++ does not allow. This will break passing of
-// C-string literals.
-template <typename T>
-struct BindType {
- typedef T StorageType;
-};
-
-// This should almost be impossible to trigger unless someone manually
-// specifies type of the bind parameters. However, in case they do,
-// this will guard against us accidentally storing a reference parameter.
-template <typename T>
-struct BindType<T&> {
- typedef T StorageType;
-};
-
-// Note that for array types, we implicitly add a const in the conversion. This
-// means that it is not possible to bind array arguments to functions that take
-// a non-const pointer. Trying to specialize the template based on a "const
-// T[n]" does not seem to match correctly, so we are stuck with this
-// restriction.
-template <typename T, size_t n>
-struct BindType<T[n]> {
- typedef const T* StorageType;
-};
-
-template <typename T>
-struct BindType<T[]> {
- typedef const T* StorageType;
-};
-
} // namespace internal
template <typename T>
« no previous file with comments | « no previous file | base/bind_internal.h » ('j') | base/callback_internal.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698