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 | 7 |
8 | 8 |
9 #ifndef SkInstCnt_DEFINED | 9 #ifndef SkInstCnt_DEFINED |
10 #define SkInstCnt_DEFINED | 10 #define SkInstCnt_DEFINED |
11 | 11 |
12 /* | 12 /* |
13 * The instance counting system consists of three macros that create the | 13 * The instance counting system consists of three macros that create the |
14 * instance counting machinery. A class is added to the system by adding: | 14 * instance counting machinery. A class is added to the system by adding: |
15 * SK_DECLARE_INST_COUNT at the top of its declaration for derived classes | 15 * SK_DECLARE_INST_COUNT at the top of its declaration for derived classes |
16 * SK_DECLARE_INST_COUNT_ROOT at the top of its declaration for a root class | 16 * SK_DECLARE_INST_COUNT_ROOT at the top of its declaration for a root class |
17 * At the end of an application a call to all the "root" objects' | 17 * At the end of an application a call to all the "root" objects' |
18 * CheckInstanceCount methods should be made | 18 * CheckInstanceCount methods should be made |
19 */ | 19 */ |
20 #include "SkTypes.h" | 20 #include "SkTypes.h" |
21 | 21 |
22 #if SK_ENABLE_INST_COUNT | 22 #if SK_ENABLE_INST_COUNT |
23 #include "SkTArray.h" | 23 #include "SkTArray.h" |
24 #include "SkThread_platform.h" | 24 #include "SkThread.h" |
25 | 25 |
26 extern bool gPrintInstCount; | 26 extern bool gPrintInstCount; |
27 | 27 |
28 // The non-root classes just register themselves with their parent | 28 // The non-root classes just register themselves with their parent |
29 #define SK_DECLARE_INST_COUNT(className) \ | 29 #define SK_DECLARE_INST_COUNT(className) \ |
30 SK_DECLARE_INST_COUNT_INTERNAL(className, \ | 30 SK_DECLARE_INST_COUNT_INTERNAL(className, \ |
31 INHERITED::AddInstChild(CheckInstanceCount);) | 31 INHERITED::AddInstChild(CheckInstanceCount);) |
32 | 32 |
33 // The root classes registers a function to print out the memory stats when | 33 // The root classes registers a function to print out the memory stats when |
34 // the app ends | 34 // the app ends |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 #define SK_DECLARE_INST_COUNT(className) static void AddInstChild() { INHERITED:
:AddInstChild(); } | 118 #define SK_DECLARE_INST_COUNT(className) static void AddInstChild() { INHERITED:
:AddInstChild(); } |
119 #define SK_DECLARE_INST_COUNT_ROOT(className) static void AddInstChild() { } | 119 #define SK_DECLARE_INST_COUNT_ROOT(className) static void AddInstChild() { } |
120 #endif | 120 #endif |
121 | 121 |
122 // Following are deprecated. They are defined only for backwards API compatibili
ty. | 122 // Following are deprecated. They are defined only for backwards API compatibili
ty. |
123 #define SK_DECLARE_INST_COUNT_TEMPLATE(className) SK_DECLARE_INST_COUNT(classNam
e) | 123 #define SK_DECLARE_INST_COUNT_TEMPLATE(className) SK_DECLARE_INST_COUNT(classNam
e) |
124 #define SK_DEFINE_INST_COUNT(className) | 124 #define SK_DEFINE_INST_COUNT(className) |
125 #define SK_DEFINE_INST_COUNT_TEMPLATE(templateInfo, className) | 125 #define SK_DEFINE_INST_COUNT_TEMPLATE(templateInfo, className) |
126 | 126 |
127 #endif // SkInstCnt_DEFINED | 127 #endif // SkInstCnt_DEFINED |
OLD | NEW |