| OLD | NEW |
| (Empty) |
| 1 #include "GrBatch.h" | |
| 2 | |
| 3 #include "GrMemoryPool.h" | |
| 4 #include "SkTLS.h" | |
| 5 | |
| 6 // TODO I noticed a small benefit to using a larger exclusive pool for batches.
Its very small, | |
| 7 // but seems to be mostly consistent. There is a lot in flux right now, but we
should really | |
| 8 // revisit this when batch is everywhere | |
| 9 | |
| 10 class GrBatch_Globals { | |
| 11 public: | |
| 12 static GrMemoryPool* GetTLS() { | |
| 13 return (GrMemoryPool*)SkTLS::Get(CreateTLS, DeleteTLS); | |
| 14 } | |
| 15 | |
| 16 private: | |
| 17 static void* CreateTLS() { | |
| 18 return SkNEW_ARGS(GrMemoryPool, (16384, 16384)); | |
| 19 } | |
| 20 | |
| 21 static void DeleteTLS(void* pool) { | |
| 22 SkDELETE(reinterpret_cast<GrMemoryPool*>(pool)); | |
| 23 } | |
| 24 }; | |
| 25 | |
| 26 int32_t GrBatch::gCurrBatchClassID = | |
| 27 GrBatch::kIllegalBatchClassID; | |
| 28 | |
| 29 void* GrBatch::operator new(size_t size) { | |
| 30 return GrBatch_Globals::GetTLS()->allocate(size); | |
| 31 } | |
| 32 | |
| 33 void GrBatch::operator delete(void* target) { | |
| 34 GrBatch_Globals::GetTLS()->release(target); | |
| 35 } | |
| OLD | NEW |