epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2010 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 10 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 11 | #ifndef GrRefCnt_DEFINED |
| 12 | #define GrRefCnt_DEFINED |
| 13 | |
| 14 | #include "GrTypes.h" |
reed@google.com | 970cb55 | 2011-07-15 15:52:28 +0000 | [diff] [blame] | 15 | #include "SkRefCnt.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 16 | |
reed@google.com | 970cb55 | 2011-07-15 15:52:28 +0000 | [diff] [blame] | 17 | typedef SkRefCnt GrRefCnt; |
| 18 | typedef SkAutoRef GrAutoRef; |
| 19 | typedef SkAutoUnref GrAutoUnref; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 20 | |
bsalomon@google.com | b095140 | 2011-08-19 15:37:34 +0000 | [diff] [blame] | 21 | #define GrSafeRef SkSafeRef |
| 22 | #define GrSafeUnref SkSafeUnref |
reed@google.com | 970cb55 | 2011-07-15 15:52:28 +0000 | [diff] [blame] | 23 | #define GrSafeAssign(a, b) SkRefCnt_SafeAssign(a, b) |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 24 | |
bsalomon@google.com | 8fe7247 | 2011-03-30 21:26:44 +0000 | [diff] [blame] | 25 | template<typename T> |
| 26 | static inline void GrSafeSetNull(T*& obj) { |
| 27 | if (NULL != obj) { |
| 28 | obj->unref(); |
| 29 | obj = NULL; |
| 30 | } |
| 31 | } |
| 32 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 33 | #endif |