diff options
Diffstat (limited to 'bench/Benchmark.h')
-rw-r--r-- | bench/Benchmark.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/bench/Benchmark.h b/bench/Benchmark.h index 5ba6e91108..22b52ab4e8 100644 --- a/bench/Benchmark.h +++ b/bench/Benchmark.h @@ -13,11 +13,10 @@ #include "SkString.h" #include "SkTRegistry.h" -#define DEF_BENCH(code) \ -namespace { \ -static Benchmark* SK_MACRO_APPEND_LINE(factory)(void*) { code; } \ -BenchRegistry SK_MACRO_APPEND_LINE(g_R_)(SK_MACRO_APPEND_LINE(factory)); \ -} +#define DEF_BENCH3(code, N) \ + static BenchRegistry gBench##N([](void*) -> Benchmark* { code; }); +#define DEF_BENCH2(code, N) DEF_BENCH3(code, N) +#define DEF_BENCH(code) DEF_BENCH2(code, __COUNTER__) /* * With the above macros, you can register benches as follows (at the bottom |