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

Unified Diff: third_party/WebKit/Source/wtf/Functional.h

Issue 2250373002: Readd base::UnwrapTraits to support rvalue-reference wrappers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20_oneshot
Patch Set: rebase Created 4 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
« no previous file with comments | « base/bind_helpers_unittest.cc ('k') | third_party/WebKit/Source/wtf/FunctionalTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/Functional.h
diff --git a/third_party/WebKit/Source/wtf/Functional.h b/third_party/WebKit/Source/wtf/Functional.h
index caad8c2d2531fb21fa3457dee4be6c5fd2db55c7..97d156086f32ca4bcd6157581821fc1431e82daf 100644
--- a/third_party/WebKit/Source/wtf/Functional.h
+++ b/third_party/WebKit/Source/wtf/Functional.h
@@ -43,13 +43,6 @@ template <typename T> class Member;
template <typename T> class WeakMember;
}
-namespace base {
-
-template <typename T>
-struct IsWeakReceiver<WTF::WeakPtr<T>> : std::true_type {};
-
-}
-
namespace WTF {
// Functional.h provides a very simple way to bind a function pointer and arguments together into a function object
@@ -172,12 +165,6 @@ struct ParamStorageTraits<RefPtr<T>> {
typedef RefPtr<T> StorageType;
};
-template <typename T>
-T* Unwrap(const RefPtr<T>& wrapped)
-{
- return wrapped.get();
-}
-
template <typename> class RetainPtr;
template <typename T>
@@ -190,23 +177,11 @@ struct ParamStorageTraits<PassedWrapper<T>> {
typedef PassedWrapper<T> StorageType;
};
-template <typename T>
-T Unwrap(const PassedWrapper<T>& wrapped)
-{
- return wrapped.moveOut();
-}
-
template <typename T, FunctionThreadAffinity threadAffinity>
struct ParamStorageTraits<UnretainedWrapper<T, threadAffinity>> {
typedef UnretainedWrapper<T, threadAffinity> StorageType;
};
-template <typename T, FunctionThreadAffinity threadAffinity>
-T* Unwrap(const UnretainedWrapper<T, threadAffinity>& wrapped)
-{
- return wrapped.value();
-}
-
template<typename Signature, FunctionThreadAffinity threadAffinity = SameThreadAffinity>
class Function;
@@ -261,6 +236,37 @@ typedef Function<void(), CrossThreadAffinity> CrossThreadClosure;
} // namespace WTF
+namespace base {
+
+template <typename T>
+struct IsWeakReceiver<WTF::WeakPtr<T>> : std::true_type {};
+
+template <typename T>
+struct BindUnwrapTraits<WTF::RefPtr<T>> {
+ static T* Unwrap(const WTF::RefPtr<T>& wrapped)
+ {
+ return wrapped.get();
+ }
+};
+
+template <typename T>
+struct BindUnwrapTraits<WTF::PassedWrapper<T>> {
+ static T Unwrap(const WTF::PassedWrapper<T>& wrapped)
+ {
+ return wrapped.moveOut();
+ }
+};
+
+template <typename T, WTF::FunctionThreadAffinity threadAffinity>
+struct BindUnwrapTraits<WTF::UnretainedWrapper<T, threadAffinity>> {
+ static T* Unwrap(const WTF::UnretainedWrapper<T, threadAffinity>& wrapped)
+ {
+ return wrapped.value();
+ }
+};
+
+} // namespace base
+
using WTF::passed;
using WTF::unretained;
using WTF::crossThreadUnretained;
« no previous file with comments | « base/bind_helpers_unittest.cc ('k') | third_party/WebKit/Source/wtf/FunctionalTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698