Index: base/bind_helpers.h |
diff --git a/base/bind_helpers.h b/base/bind_helpers.h |
index 7eb5716caef4f7b566f0026ad57f91d7a373ace7..07f11f98d2cde4e730b0c811e6b176dac1fa9ca7 100644 |
--- a/base/bind_helpers.h |
+++ b/base/bind_helpers.h |
@@ -227,6 +227,11 @@ const T& Unwrap(ConstRefWrapper<T> const_ref) { |
return const_ref.get(); |
} |
+template <typename T> |
+T* Unwrap(const scoped_refptr<T>& o) { return o.get(); } |
+ |
+template <typename T> |
+const WeakPtr<T>& Unwrap(const WeakPtr<T>& o) { return o; } |
// Utility for handling different refcounting semantics in the Bind() |
// function. |
@@ -257,6 +262,14 @@ struct MaybeRefcount<base::true_type, T*> { |
static void Release(T* o) { o->Release(); } |
}; |
+// No need to additionally AddRef() and Release() since we are storing a |
+// scoped_refptr<> inside the storage object already. |
+template <typename T> |
+struct MaybeRefcount<base::true_type, scoped_refptr<T> > { |
+ static void AddRef(const scoped_refptr<T>& o) {} |
+ static void Release(const scoped_refptr<T>& o) {} |
+}; |
+ |
template <typename T> |
struct MaybeRefcount<base::true_type, const T*> { |
static void AddRef(const T* o) { o->AddRef(); } |