Skia
2D Graphics Library
SkRefCnt.h File Reference
#include "include/core/SkTypes.h"
#include <atomic>
#include <cstddef>
#include <iosfwd>
#include <memory>
#include <type_traits>
#include <utility>
Include dependency graph for SkRefCnt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SkRefCntBase
 
class  SkRefCnt
 
class  SkNVRefCnt< Derived >
 
class  sk_sp< T >
 Shared pointer class to wrap classes that support a ref()/unref() interface. More...
 

Functions

template<typename T >
static T * SkRef (T *obj)
 Call obj->ref() and return obj. More...
 
template<typename T >
static T * SkSafeRef (T *obj)
 Check if the argument is non-null, and if so, call obj->ref() and return obj. More...
 
template<typename T >
static void SkSafeUnref (T *obj)
 Check if the argument is non-null, and if so, call obj->unref() More...
 
template<typename T >
void swap (sk_sp< T > &a, sk_sp< T > &b)
 
template<typename T , typename U >
bool operator== (const sk_sp< T > &a, const sk_sp< U > &b)
 
template<typename T >
bool operator== (const sk_sp< T > &a, std::nullptr_t)
 
template<typename T >
bool operator== (std::nullptr_t, const sk_sp< T > &b)
 
template<typename T , typename U >
bool operator!= (const sk_sp< T > &a, const sk_sp< U > &b)
 
template<typename T >
bool operator!= (const sk_sp< T > &a, std::nullptr_t)
 
template<typename T >
bool operator!= (std::nullptr_t, const sk_sp< T > &b)
 
template<typename C , typename CT , typename T >
auto operator<< (std::basic_ostream< C, CT > &os, const sk_sp< T > &sp) -> decltype(os<< sp.get())
 
template<typename T , typename... Args>
sk_sp< T > sk_make_sp (Args &&... args)
 
template<typename T >
sk_sp< T > sk_ref_sp (T *obj)
 
template<typename T >
sk_sp< T > sk_ref_sp (const T *obj)
 

Function Documentation

◆ operator!=() [1/3]

template<typename T , typename U >
bool operator!= ( const sk_sp< T > &  a,
const sk_sp< U > &  b 
)
inline

◆ operator!=() [2/3]

template<typename T >
bool operator!= ( const sk_sp< T > &  a,
std::nullptr_t   
)
inline

◆ operator!=() [3/3]

template<typename T >
bool operator!= ( std::nullptr_t  ,
const sk_sp< T > &  b 
)
inline

◆ operator<<()

template<typename C , typename CT , typename T >
auto operator<< ( std::basic_ostream< C, CT > &  os,
const sk_sp< T > &  sp 
) -> decltype(os << sp.get())

◆ operator==() [1/3]

template<typename T , typename U >
bool operator== ( const sk_sp< T > &  a,
const sk_sp< U > &  b 
)
inline

◆ operator==() [2/3]

template<typename T >
bool operator== ( const sk_sp< T > &  a,
std::nullptr_t   
)
inline

◆ operator==() [3/3]

template<typename T >
bool operator== ( std::nullptr_t  ,
const sk_sp< T > &  b 
)
inline

◆ sk_make_sp()

template<typename T , typename... Args>
sk_sp<T> sk_make_sp ( Args &&...  args)

◆ sk_ref_sp() [1/2]

template<typename T >
sk_sp<T> sk_ref_sp ( const T *  obj)

◆ sk_ref_sp() [2/2]

template<typename T >
sk_sp<T> sk_ref_sp ( T *  obj)

◆ SkRef()

template<typename T >
static T* SkRef ( T *  obj)
inlinestatic

Call obj->ref() and return obj.

The obj must not be nullptr.

◆ SkSafeRef()

template<typename T >
static T* SkSafeRef ( T *  obj)
inlinestatic

Check if the argument is non-null, and if so, call obj->ref() and return obj.

◆ SkSafeUnref()

template<typename T >
static void SkSafeUnref ( T *  obj)
inlinestatic

Check if the argument is non-null, and if so, call obj->unref()

◆ swap()

template<typename T >
void swap ( sk_sp< T > &  a,
sk_sp< T > &  b 
)
inline