Chromium Code Reviews| Index: src/gpu/batches/GrBatch.h |
| diff --git a/src/gpu/batches/GrBatch.h b/src/gpu/batches/GrBatch.h |
| index b29c8a49b701ccccee3290233350f9ee1591877f..c23094d0ebe5a194ef90d6fffa28285915416ce1 100644 |
| --- a/src/gpu/batches/GrBatch.h |
| +++ b/src/gpu/batches/GrBatch.h |
| @@ -95,9 +95,12 @@ public: |
| uint32_t classID() const { SkASSERT(kIllegalBatchID != fClassID); return fClassID; } |
| -#if GR_BATCH_SPEW |
| - uint32_t uniqueID() const { return fUniqueID; } |
| -#endif |
| + uint32_t uniqueID() const { |
|
bsalomon
2016/03/08 16:38:35
Maybe a comment that we lazily initialize because
|
| + 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 +156,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; |
| }; |