Add debug helper for finding leaks in GrMemoryPool.h

Change-Id: I1d11769f9e99606af5e7752b3a6d055a5bf6a48d
Reviewed-on: https://skia-review.googlesource.com/10289
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrMemoryPool.h b/src/gpu/GrMemoryPool.h
index e483aab..26a7634 100644
--- a/src/gpu/GrMemoryPool.h
+++ b/src/gpu/GrMemoryPool.h
@@ -9,6 +9,9 @@
 #define GrMemoryPool_DEFINED
 
 #include "GrTypes.h"
+#ifdef SK_DEBUG
+#include "SkTHash.h"
+#endif
 
 /**
  * Allocates memory in blocks and parcels out space in the blocks for allocation
@@ -94,6 +97,7 @@
     struct AllocHeader {
 #ifdef SK_DEBUG
         uint32_t fSentinal;      ///< known value to check for memory stomping (e.g., (CD)*)
+        int32_t fID;             ///< ID that can be used to track down leaks by clients.
 #endif
         BlockHeader* fHeader;    ///< pointer back to the block header in which an alloc resides
     };
@@ -105,6 +109,7 @@
 #ifdef SK_DEBUG
     int                               fAllocationCnt;
     int                               fAllocBlockCnt;
+    SkTHashSet<int32_t>               fAllocatedIDs;
 #endif
 
 protected: