Index: src/gpu/batches/GrBatch.h |
diff --git a/src/gpu/batches/GrBatch.h b/src/gpu/batches/GrBatch.h |
index b29c8a49b701ccccee3290233350f9ee1591877f..aae726eba95c4094462b3fa76e663100cc362b76 100644 |
--- a/src/gpu/batches/GrBatch.h |
+++ b/src/gpu/batches/GrBatch.h |
@@ -95,9 +95,13 @@ public: |
uint32_t classID() const { SkASSERT(kIllegalBatchID != fClassID); return fClassID; } |
-#if GR_BATCH_SPEW |
- uint32_t uniqueID() const { return fUniqueID; } |
-#endif |
+ // We lazily initialize the uniqueID because currently the only user is GrAuditTrail |
+ uint32_t uniqueID() const { |
+ if (kIllegalBatchID == fUniqueID) { |
+ fUniqueID = GenBatchID(); |
+ } |
+ return fUniqueID; |
+ } |
SkDEBUGCODE(bool isUsed() const { return fUsed; }) |
/** Called prior to drawing. The batch should perform any resource creation necessary to |
@@ -153,11 +157,9 @@ private: |
SkDEBUGCODE(bool fUsed;) |
const uint32_t fClassID; |
-#if GR_BATCH_SPEW |
static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } |
- const uint32_t fUniqueID; |
+ mutable uint32_t fUniqueID; |
static int32_t gCurrBatchUniqueID; |
-#endif |
static int32_t gCurrBatchClassID; |
}; |