8#ifndef SkTScopedComPtr_DEFINED
9#define SkTScopedComPtr_DEFINED
14#ifdef SK_BUILD_FOR_WIN
16template<
typename T>
T* SkRefComPtr(
T* ptr) {
21template<
typename T>
T* SkSafeRefComPtr(
T* ptr) {
29class SkTScopedComPtr {
34 constexpr SkTScopedComPtr() : fPtr(nullptr) {}
35 constexpr SkTScopedComPtr(std::nullptr_t) : fPtr(nullptr) {}
36 explicit SkTScopedComPtr(
T *ptr) : fPtr(ptr) {}
37 SkTScopedComPtr(SkTScopedComPtr&& that) : fPtr(that.release()) {}
38 SkTScopedComPtr(
const SkTScopedComPtr&) =
delete;
40 ~SkTScopedComPtr() { this->
reset();}
42 SkTScopedComPtr& operator=(SkTScopedComPtr&& that) {
43 this->
reset(that.release());
46 SkTScopedComPtr& operator=(
const SkTScopedComPtr&) =
delete;
47 SkTScopedComPtr& operator=(std::nullptr_t) { this->
reset();
return *
this; }
51 explicit operator bool()
const {
return fPtr !=
nullptr; }
53 T *operator->()
const {
return fPtr; }
63 T *
get()
const {
return fPtr; }
65 void reset(
T* ptr =
nullptr) {
72 void swap(SkTScopedComPtr<T>& that) {
74 this->fPtr = that.fPtr;
void swap(sk_sp< T > &a, sk_sp< T > &b)
constexpr Mask< EnumType > operator&(const EnumType &lhs, const EnumType &rhs)
constexpr Color operator*(T value, const Color &c)
const myers::Point & get(const myers::Segment &)