SkRef for expressions.
https://codereview.appspot.com/6475045/ git-svn-id: http://skia.googlecode.com/svn/trunk@5238 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
35c5ff0be8
commit
1fd201b9df
@ -117,12 +117,21 @@ private:
|
||||
} while (0)
|
||||
|
||||
|
||||
/** Check if the argument is non-null, and if so, call obj->ref()
|
||||
/** Call obj->ref() and return obj. The obj must not be NULL.
|
||||
*/
|
||||
template <typename T> static inline void SkSafeRef(T* obj) {
|
||||
template <typename T> static inline T* SkRef(T* obj) {
|
||||
SkASSERT(obj);
|
||||
obj->ref();
|
||||
return obj;
|
||||
}
|
||||
|
||||
/** Check if the argument is non-null, and if so, call obj->ref() and return obj.
|
||||
*/
|
||||
template <typename T> static inline T* SkSafeRef(T* obj) {
|
||||
if (obj) {
|
||||
obj->ref();
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/** Check if the argument is non-null, and if so, call obj->unref()
|
||||
|
Loading…
Reference in New Issue
Block a user