Home | History | Annotate | Download | only in ext

Lines Matching refs:RefPtr

17 //   skia::RefPtr<SkShader> shader = skia::AdoptRef(SkGradientShader::Create());
21 // pass around the skia::RefPtr instead of the raw pointer. An example method
23 // void AMethodThatSavesAShader(const skia::RefPtr<SkShader>& shader) {
26 // skia::RefPtr<SkShader> member_refptr_;
28 // When returning a ref-counted pointer, also return the skia::RefPtr instead.
30 // skia::RefPtr<SkShader> MakeAShader() {
38 // skia::RefPtr<SkShader> shader = skia::SharePtr(paint.getShader());
41 // AdoptRef() the raw pointer immediately into a skia::RefPtr and always work
42 // with skia::RefPtr instances instead, the ref-counting will be taken care of
45 class RefPtr {
47 RefPtr() : ptr_(NULL) {}
49 RefPtr(const RefPtr& other)
55 RefPtr(const RefPtr<U>& other)
60 ~RefPtr() {
64 RefPtr& operator=(const RefPtr& other) {
70 RefPtr& operator=(const RefPtr<U>& other) {
85 typedef T* RefPtr::*unspecified_bool_type;
87 return ptr_ ? &RefPtr::ptr_ : NULL;
97 // this RefPtr can also manage its lifetime).
98 explicit RefPtr(T* ptr) : ptr_(ptr) {}
101 friend RefPtr<U> AdoptRef(U* ptr);
104 friend RefPtr<U> SharePtr(U* ptr);
109 RefPtr<T> AdoptRef(T* ptr) { return RefPtr<T>(ptr); }
114 RefPtr<T> SharePtr(T* ptr) { return RefPtr<T>(SkSafeRef(ptr)); }