| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrFakeRefObj_DEFINED | 8 #ifndef GrFakeRefObj_DEFINED |
| 9 #define GrFakeRefObj_DEFINED | 9 #define GrFakeRefObj_DEFINED |
| 10 | 10 |
| 11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
| 12 #include "gl/GrGLInterface.h" | 12 #include "gl/GrGLInterface.h" |
| 13 | 13 |
| 14 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
| 15 // This object is used to track the OpenGL objects. We don't use real | 15 // This object is used to track the OpenGL objects. We don't use real |
| 16 // reference counting (i.e., we don't free the objects when their ref count | 16 // reference counting (i.e., we don't free the objects when their ref count |
| 17 // goes to 0) so that we can detect invalid memory accesses. The refs we | 17 // goes to 0) so that we can detect invalid memory accesses. The refs we |
| 18 // are tracking in this class are actually OpenGL's references to the objects | 18 // are tracking in this class are actually OpenGL's references to the objects |
| 19 // not "ours" | 19 // not "ours" |
| 20 // Each object also gets a unique globally identifying ID | 20 // Each object also gets a unique globally identifying ID |
| 21 class GrFakeRefObj : public SkNoncopyable { | 21 class GrFakeRefObj : SkNoncopyable { |
| 22 public: | 22 public: |
| 23 GrFakeRefObj() | 23 GrFakeRefObj() |
| 24 : fRef(0) | 24 : fRef(0) |
| 25 , fHighRefCount(0) | 25 , fHighRefCount(0) |
| 26 , fMarkedForDeletion(false) | 26 , fMarkedForDeletion(false) |
| 27 , fDeleted(false) { | 27 , fDeleted(false) { |
| 28 | 28 |
| 29 // source for globally unique IDs - 0 is reserved! | 29 // source for globally unique IDs - 0 is reserved! |
| 30 static int fNextID = 0; | 30 static int fNextID = 0; |
| 31 | 31 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // factory creation entry point. This entry point is used by the GrGLDebug | 85 // factory creation entry point. This entry point is used by the GrGLDebug |
| 86 // object to instantiate the various objects | 86 // object to instantiate the various objects |
| 87 // all globally unique IDs | 87 // all globally unique IDs |
| 88 #define GR_DEFINE_CREATOR(className) \ | 88 #define GR_DEFINE_CREATOR(className) \ |
| 89 public: \ | 89 public: \ |
| 90 static GrFakeRefObj *create ## className() { \ | 90 static GrFakeRefObj *create ## className() { \ |
| 91 return SkNEW(className); \ | 91 return SkNEW(className); \ |
| 92 } | 92 } |
| 93 | 93 |
| 94 #endif // GrFakeRefObj_DEFINED | 94 #endif // GrFakeRefObj_DEFINED |
| OLD | NEW |