diff options
author | 2015-08-27 12:57:01 -0700 | |
---|---|---|
committer | 2015-08-27 12:57:01 -0700 | |
commit | 38f1f6f9e590fc20b81015ceca9d642cbe02a2d9 (patch) | |
tree | cbcb747c29596ed5202c1745b568fdd7d97776d7 /include/gpu/GrProcessor.h | |
parent | 6904d1d3f1a2903fcaa4c4bd17b07d5f10af2e8e (diff) |
Remove overly complicated GR_CREATE_STATIC_PROCESSOR macro
This macro was responsible for producing code like:
static SkAlignedStorage<sizeof(Foo)> g_gFoo_Storage;
static Foo* gFoo = new(g_gFoo_Storage.get()) Foo;
static SkAutoTDestroy<Foo> gFoo_ad(gFoo);
which would allocate static storage for an object of type Foo
(g_gFoo_Storage), lazily instantiate the object in that memory (via
gFoo's initializer), and then ensure that at global destruction time
the object is destroyed (via gFoo_Ad's destructor).
However, the exact same effect is achieved by just writing:
static Foo gFoo;
Review URL: https://codereview.chromium.org/1314763009
Diffstat (limited to 'include/gpu/GrProcessor.h')
-rw-r--r-- | include/gpu/GrProcessor.h | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h index c1f4aa0256..7c24f549f0 100644 --- a/include/gpu/GrProcessor.h +++ b/include/gpu/GrProcessor.h @@ -52,8 +52,7 @@ private: immutable: after being constructed, their fields may not change. Dynamically allocated GrProcessors are managed by a per-thread memory pool. The ref count of an - processor must reach 0 before the thread terminates and the pool is destroyed. To create a - static processor use the helper macro GR_CREATE_STATIC_PROCESSOR declared below. + processor must reach 0 before the thread terminates and the pool is destroyed. */ class GrProcessor : public GrProgramElement { public: @@ -143,13 +142,4 @@ private: typedef GrProgramElement INHERITED; }; -/** - * This creates a processor outside of the memory pool. The processor's destructor will be called - * at global destruction time. NAME will be the name of the created instance. - */ -#define GR_CREATE_STATIC_PROCESSOR(NAME, PROC_CLASS, ARGS) \ -static SkAlignedSStorage<sizeof(PROC_CLASS)> g_##NAME##_Storage; \ -static PROC_CLASS* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), PROC_CLASS, ARGS); \ -static SkAutoTDestroy<GrProcessor> NAME##_ad(NAME); - #endif |