Index: webrtc/base/bind.h.pump |
diff --git a/webrtc/base/bind.h.pump b/webrtc/base/bind.h.pump |
index 9a4bc664c39145c416c13f01073f3da10ced71f4..e1cea61fc2afe85c432daf3f1639c06bbacecebe 100644 |
--- a/webrtc/base/bind.h.pump |
+++ b/webrtc/base/bind.h.pump |
@@ -124,6 +124,18 @@ struct PointerType { |
T*>::type type; |
}; |
+// RemoveScopedPtrRef will capture scoped_refptr by-value instead of |
+// by-reference. |
+template <class T> struct RemoveScopedPtrRef { typedef T type; }; |
+template <class T> |
+struct RemoveScopedPtrRef<const scoped_refptr<T>&> { |
+ typedef scoped_refptr<T> type; |
+}; |
+template <class T> |
+struct RemoveScopedPtrRef<scoped_refptr<T>&> { |
+ typedef scoped_refptr<T> type; |
+}; |
+ |
} // namespace detail |
$var n = 6 |
@@ -145,7 +157,7 @@ class MethodFunctor$i { |
MethodT method_; |
typename detail::PointerType<ObjectT>::type object_;$for j [[ |
- P$j p$(j)_;]] |
+ typename detail::RemoveScopedPtrRef<P$j>::type p$(j)_;]] |
}; |
@@ -162,7 +174,7 @@ Functor$i(const FunctorT& functor$for j [[, P$j p$j]]) |
private: |
FunctorT functor_;$for j [[ |
- P$j p$(j)_;]] |
+ typename detail::RemoveScopedPtrRef<P$j>::type p$(j)_;]] |
}; |