• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
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.
7  */
8 
9 
10 
11 #ifndef GrRefCnt_DEFINED
12 #define GrRefCnt_DEFINED
13 
14 #include "GrTypes.h"
15 #include "SkRefCnt.h"
16 
17 typedef SkRefCnt GrRefCnt;
18 typedef SkAutoRef GrAutoRef;
19 typedef SkAutoUnref GrAutoUnref;
20 
21 #define GrSafeRef SkSafeRef
22 #define GrSafeUnref SkSafeUnref
23 #define GrSafeAssign(a, b)  SkRefCnt_SafeAssign(a, b)
24 
25 template<typename T>
GrSafeSetNull(T * & obj)26 static inline void GrSafeSetNull(T*& obj) {
27     if (NULL != obj) {
28         obj->unref();
29         obj = NULL;
30     }
31 }
32 
33 #endif
34