OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "SkBenchmark.h" | 7 #include "SkBenchmark.h" |
8 #include "SkRefCnt.h" | 8 #include "SkRefCnt.h" |
9 #include "SkThread.h" | 9 #include "SkThread.h" |
10 #include "SkWeakRefCnt.h" | 10 #include "SkWeakRefCnt.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 public: | 43 public: |
44 SK_DECLARE_INST_COUNT(PlacedRefCnt) | 44 SK_DECLARE_INST_COUNT(PlacedRefCnt) |
45 | 45 |
46 PlacedRefCnt() : SkRefCnt() { } | 46 PlacedRefCnt() : SkRefCnt() { } |
47 void operator delete(void*) { } | 47 void operator delete(void*) { } |
48 | 48 |
49 private: | 49 private: |
50 typedef SkRefCnt INHERITED; | 50 typedef SkRefCnt INHERITED; |
51 }; | 51 }; |
52 | 52 |
53 SK_DEFINE_INST_COUNT(PlacedRefCnt) | |
54 | |
55 class RefCntBench_Heap : public SkBenchmark { | 53 class RefCntBench_Heap : public SkBenchmark { |
56 public: | 54 public: |
57 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { | 55 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { |
58 return backend == kNonRendering_Backend; | 56 return backend == kNonRendering_Backend; |
59 } | 57 } |
60 | 58 |
61 protected: | 59 protected: |
62 virtual const char* onGetName() { | 60 virtual const char* onGetName() { |
63 return "ref_cnt_heap"; | 61 return "ref_cnt_heap"; |
64 } | 62 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 191 |
194 /////////////////////////////////////////////////////////////////////////////// | 192 /////////////////////////////////////////////////////////////////////////////// |
195 | 193 |
196 DEF_BENCH( return new RefCntBench_Stack(); ) | 194 DEF_BENCH( return new RefCntBench_Stack(); ) |
197 DEF_BENCH( return new RefCntBench_Heap(); ) | 195 DEF_BENCH( return new RefCntBench_Heap(); ) |
198 DEF_BENCH( return new RefCntBench_New(); ) | 196 DEF_BENCH( return new RefCntBench_New(); ) |
199 | 197 |
200 DEF_BENCH( return new WeakRefCntBench_Stack(); ) | 198 DEF_BENCH( return new WeakRefCntBench_Stack(); ) |
201 DEF_BENCH( return new WeakRefCntBench_Heap(); ) | 199 DEF_BENCH( return new WeakRefCntBench_Heap(); ) |
202 DEF_BENCH( return new WeakRefCntBench_New(); ) | 200 DEF_BENCH( return new WeakRefCntBench_New(); ) |
OLD | NEW |