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 GrProgramElement_DEFINED | 8 #ifndef GrProgramElement_DEFINED |
9 #define GrProgramElement_DEFINED | 9 #define GrProgramElement_DEFINED |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 is and will remain owned by the subclass and this function will retain a
raw ptr. Once a | 64 is and will remain owned by the subclass and this function will retain a
raw ptr. Once a |
65 GrProgramResource is registered its setResource must not be called. | 65 GrProgramResource is registered its setResource must not be called. |
66 */ | 66 */ |
67 void addProgramResource(const GrProgramResource* res) { | 67 void addProgramResource(const GrProgramResource* res) { |
68 fProgramResources.push_back(res); | 68 fProgramResources.push_back(res); |
69 } | 69 } |
70 | 70 |
71 private: | 71 private: |
72 void convertRefToPendingExecution() const; | 72 void convertRefToPendingExecution() const; |
73 | 73 |
74 void completedExecution() const { | 74 void completedExecution() const; |
75 this->validate(); | |
76 --fPendingExecutions; | |
77 if (0 == fRefCnt && 0 == fPendingExecutions) { | |
78 SkDELETE(this); | |
79 } | |
80 } | |
81 | 75 |
82 mutable int32_t fRefCnt; | 76 mutable int32_t fRefCnt; |
83 // Count of deferred executions not yet issued to the 3D API. | 77 // Count of deferred executions not yet issued to the 3D API. |
84 mutable int32_t fPendingExecutions; | 78 mutable int32_t fPendingExecutions; |
85 | 79 |
86 SkSTArray<4, const GrProgramResource*, true> fProgramResources; | 80 SkSTArray<4, const GrProgramResource*, true> fProgramResources; |
87 | 81 |
88 // Only this class can access convertRefToPendingExecution() and completedEx
ecution(). | 82 // Only this class can access convertRefToPendingExecution() and completedEx
ecution(). |
89 template <typename T> friend class GrProgramElementRef; | 83 template <typename T> friend class GrProgramElementRef; |
90 | 84 |
91 typedef SkNoncopyable INHERITED; | 85 typedef SkNoncopyable INHERITED; |
92 }; | 86 }; |
93 | 87 |
94 #endif | 88 #endif |
OLD | NEW |