Index: src/gpu/batches/GrBatch.h |
diff --git a/src/gpu/batches/GrBatch.h b/src/gpu/batches/GrBatch.h |
index f0559330feb82db2764b1e444858d0d08ba3b13c..4e38b61775094a1162b077c1e6479914c79f5e92 100644 |
--- a/src/gpu/batches/GrBatch.h |
+++ b/src/gpu/batches/GrBatch.h |
@@ -141,6 +141,9 @@ private: |
virtual void onPrepare(GrBatchFlushState*) = 0; |
virtual void onDraw(GrBatchFlushState*) = 0; |
+ // Override this method if the batch subclass gets allocated in a nonstandard way. |
+ virtual void onDelete() const { delete this; } |
+ |
static uint32_t GenID(int32_t* idCounter) { |
// The atomic inc returns the old value not the incremented value. So we add |
// 1 to the returned value. |
@@ -162,6 +165,12 @@ private: |
mutable uint32_t fUniqueID; |
static int32_t gCurrBatchUniqueID; |
static int32_t gCurrBatchClassID; |
+ |
+ friend void GrTDeleteNonAtomicRef(const GrBatch*); // For onDelete. |
}; |
+inline void GrTDeleteNonAtomicRef(const GrBatch* batch) { |
+ batch->onDelete(); |
+} |
+ |
#endif |