aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrBatch.cpp
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-01-27 15:39:06 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-27 15:39:06 -0800
commitd5a7db4a867c7e6ccf8451a053d987b470099198 (patch)
treefb313f7c8f594e6b27ed2a17bf5d1eba2f34de47 /src/gpu/GrBatch.cpp
parent95faa61d63a6f62916f6f7be58c4624da8357e3b (diff)
GrBatchPrototype
Diffstat (limited to 'src/gpu/GrBatch.cpp')
-rw-r--r--src/gpu/GrBatch.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gpu/GrBatch.cpp b/src/gpu/GrBatch.cpp
new file mode 100644
index 0000000000..e1650a6bd3
--- /dev/null
+++ b/src/gpu/GrBatch.cpp
@@ -0,0 +1,35 @@
+#include "GrBatch.h"
+
+#include "GrMemoryPool.h"
+#include "SkTLS.h"
+
+// TODO I noticed a small benefit to using a larger exclusive pool for batches. Its very small,
+// but seems to be mostly consistent. There is a lot in flux right now, but we should really
+// revisit this when batch is everywhere
+
+class GrBatch_Globals {
+public:
+ static GrMemoryPool* GetTLS() {
+ return (GrMemoryPool*)SkTLS::Get(CreateTLS, DeleteTLS);
+ }
+
+private:
+ static void* CreateTLS() {
+ return SkNEW_ARGS(GrMemoryPool, (16384, 16384));
+ }
+
+ static void DeleteTLS(void* pool) {
+ SkDELETE(reinterpret_cast<GrMemoryPool*>(pool));
+ }
+};
+
+int32_t GrBatch::gCurrBatchClassID =
+ GrBatch::kIllegalBatchClassID;
+
+void* GrBatch::operator new(size_t size) {
+ return GrBatch_Globals::GetTLS()->allocate(size);
+}
+
+void GrBatch::operator delete(void* target) {
+ GrBatch_Globals::GetTLS()->release(target);
+}