Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: src/gpu/GrBatch.cpp

Issue 862823004: Revert of GrBatchPrototype (Closed) Base URL: https://skia.googlesource.com/skia.git@lc2
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrBatch.h ('k') | src/gpu/GrBatchTarget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « src/gpu/GrBatch.h ('k') | src/gpu/GrBatchTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698