OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrProgramElementRef_DEFINED | 8 #ifndef GrProgramElementRef_DEFINED |
9 #define GrProgramElementRef_DEFINED | 9 #define GrProgramElementRef_DEFINED |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 /** | 48 /** |
49 * GrProgramElementRef assumes ownership of the ref and manages converting t
he ref to a | 49 * GrProgramElementRef assumes ownership of the ref and manages converting t
he ref to a |
50 * pending execution. As a result, it is an error for the user to ref or unr
ef through | 50 * pending execution. As a result, it is an error for the user to ref or unr
ef through |
51 * GrProgramElementRef. Therefore operator-> returns BlockRef<T>*. | 51 * GrProgramElementRef. Therefore operator-> returns BlockRef<T>*. |
52 */ | 52 */ |
53 BlockRefType *operator->() const { | 53 BlockRefType *operator->() const { |
54 return static_cast<BlockRefType*>(fObj); | 54 return static_cast<BlockRefType*>(fObj); |
55 } | 55 } |
56 | 56 |
57 ~GrProgramElementRef() { | 57 ~GrProgramElementRef() { |
58 if (NULL != fObj) { | 58 if (fObj) { |
59 if (fOwnPendingExec) { | 59 if (fOwnPendingExec) { |
60 fObj->completedExecution(); | 60 fObj->completedExecution(); |
61 } else { | 61 } else { |
62 fObj->unref(); | 62 fObj->unref(); |
63 } | 63 } |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 private: | 67 private: |
68 bool fOwnPendingExec; | 68 bool fOwnPendingExec; |
69 T* fObj; | 69 T* fObj; |
70 | 70 |
71 typedef SkNoncopyable INHERITED; | 71 typedef SkNoncopyable INHERITED; |
72 }; | 72 }; |
73 #endif | 73 #endif |
OLD | NEW |