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

Unified Diff: base/bind_helpers.h

Issue 7015064: Support binding WeakPtr<> to methods with void return types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix copyright Created 9 years, 7 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/bind_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 73fd81ea87692954443d5a0856632f65155dbdb6..c9433f8267e0ffafe7c198ff13eaf0a00156dfaf 100644
--- a/base/bind_helpers.h
+++ b/base/bind_helpers.h
@@ -53,6 +53,7 @@
#include "base/basictypes.h"
#include "base/template_util.h"
+#include "base/memory/weak_ptr.h"
willchan no longer on Chromium 2011/05/14 01:25:10 sort alphabetically :)
awong 2011/05/16 20:01:27 Done.
namespace base {
namespace internal {
@@ -215,7 +216,7 @@ const T& Unwrap(ConstRefWrapper<T> const_ref) {
// Utility for handling different refcounting semantics in the Bind()
// function.
-template <typename ref, typename T>
+template <typename IsMethod, typename T>
struct MaybeRefcount;
template <typename T>
@@ -248,6 +249,12 @@ struct MaybeRefcount<base::true_type, const T*> {
static void Release(const T* o) { o->Release(); }
};
+template <typename T>
+struct MaybeRefcount<base::true_type, WeakPtr<T> > {
+ static void AddRef(const WeakPtr<T>&) {}
+ static void Release(const WeakPtr<T>&) {}
+};
+
} // namespace internal
template <typename T>
« no previous file with comments | « no previous file | base/bind_internal.h » ('j') | base/bind_internal.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698