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

Unified Diff: webrtc/base/bind.h.pump

Issue 1308563004: rtc::Bind: Capture scoped_refptr reference arguments by value (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Capture scoped_refptr references by-value instead Created 5 years, 4 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
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)_;]]
};
« no previous file with comments | « webrtc/base/bind.h ('k') | webrtc/base/bind_unittest.cc » ('j') | webrtc/base/bind_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698