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

Unified Diff: include/core/SkRefCnt.h

Issue 1762273004: Check pointers convertible not values in sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkRefCnt.h
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
index 9e8f3be61c33456de32384af7a25f84326d30989..de3d98b3c4d98f3891211df0ebdc7c6a2c21c3ea 100644
--- a/include/core/SkRefCnt.h
+++ b/include/core/SkRefCnt.h
@@ -249,8 +249,7 @@ public:
* created sk_sp both have a reference to it.
*/
sk_sp(const sk_sp<T>& that) : fPtr(SkSafeRef(that.get())) {}
- template <typename U,
- typename = skstd::enable_if_t<skstd::is_convertible<U, T>::value>>
+ template <typename U, typename = skstd::enable_if_t<skstd::is_convertible<U*, T*>::value>>
sk_sp(const sk_sp<U>& that) : fPtr(SkSafeRef(that.get())) {}
/**
@@ -259,8 +258,7 @@ public:
* No call to ref() or unref() will be made.
*/
sk_sp(sk_sp<T>&& that) : fPtr(that.release()) {}
- template <typename U,
- typename = skstd::enable_if_t<skstd::is_convertible<U, T>::value>>
+ template <typename U, typename = skstd::enable_if_t<skstd::is_convertible<U*, T*>::value>>
sk_sp(sk_sp<U>&& that) : fPtr(that.release()) {}
/**
@@ -287,8 +285,7 @@ public:
this->reset(SkSafeRef(that.get()));
return *this;
}
- template <typename U,
- typename = skstd::enable_if_t<skstd::is_convertible<U, T>::value>>
+ template <typename U, typename = skstd::enable_if_t<skstd::is_convertible<U*, T*>::value>>
sk_sp<T>& operator=(const sk_sp<U>& that) {
this->reset(SkSafeRef(that.get()));
return *this;
@@ -303,8 +300,7 @@ public:
this->reset(that.release());
return *this;
}
- template <typename U,
- typename = skstd::enable_if_t<skstd::is_convertible<U, T>::value>>
+ template <typename U, typename = skstd::enable_if_t<skstd::is_convertible<U*, T*>::value>>
sk_sp<T>& operator=(sk_sp<U>&& that) {
this->reset(that.release());
return *this;
@@ -356,7 +352,7 @@ public:
}
private:
- T* fPtr;
+ T* fPtr;
};
template <typename T, typename... Args>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698