1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef UseCounter_h_
7 #define UseCounter_h_
8 
9 #include <stdint.h>
10 #include "mozilla/BitSet.h"
11 
12 namespace mozilla {
13 
14 enum UseCounter : int16_t {
15   eUseCounter_UNKNOWN = -1,
16 #define USE_COUNTER_DOM_METHOD(interface_, name_) \
17   eUseCounter_##interface_##_##name_,
18 #define USE_COUNTER_DOM_ATTRIBUTE(interface_, name_) \
19   eUseCounter_##interface_##_##name_##_getter,       \
20       eUseCounter_##interface_##_##name_##_setter,
21 #define USE_COUNTER_CUSTOM(name_, desc_) eUseCounter_custom_##name_,
22 #include "mozilla/dom/UseCounterList.h"
23 #undef USE_COUNTER_DOM_METHOD
24 #undef USE_COUNTER_DOM_ATTRIBUTE
25 #undef USE_COUNTER_CUSTOM
26 
27 #define DEPRECATED_OPERATION(op_) eUseCounter_##op_,
28 #include "nsDeprecatedOperationList.h"
29 #undef DEPRECATED_OPERATION
30 
31   eUseCounter_FirstCSSProperty,
32   __reset_hack = eUseCounter_FirstCSSProperty - 1,
33 
34 // Need an extra level of macro nesting to force expansion of method_
35 // params before they get pasted.
36 #define CSS_PROP_USE_COUNTER(method_) eUseCounter_property_##method_,
37 #define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) privatename_
38 #define CSS_PROP_LONGHAND(name_, id_, method_, ...) \
39   CSS_PROP_USE_COUNTER(method_)
40 #define CSS_PROP_SHORTHAND(name_, id_, method_, ...) \
41   CSS_PROP_USE_COUNTER(method_)
42 #define CSS_PROP_ALIAS(name_, aliasid_, id_, method_, ...) \
43   CSS_PROP_USE_COUNTER(method_)
44 #include "mozilla/ServoCSSPropList.h"
45 #undef CSS_PROP_ALIAS
46 #undef CSS_PROP_SHORTHAND
47 #undef CSS_PROP_LONGHAND
48 #undef CSS_PROP_PUBLIC_OR_PRIVATE
49 #undef CSS_PROP_USE_COUNTER
50 
51   eUseCounter_EndCSSProperties,
52   eUseCounter_FirstCountedUnknownProperty = eUseCounter_EndCSSProperties,
53   __reset_hack_2 = eUseCounter_FirstCountedUnknownProperty - 1,
54 
55 #define COUNTED_UNKNOWN_PROPERTY(name_, method_) \
56   eUseCounter_unknown_property_##method_,
57 #include "mozilla/CountedUnknownProperties.h"
58 #undef COUNTED_UNKNOWN_PROPERTY
59 
60   eUseCounter_Count
61 };
62 
63 using UseCounters = BitSet<eUseCounter_Count, uint64_t>;
64 
65 enum class UseCounterWorker : int16_t {
66   Unknown = -1,
67 #define USE_COUNTER_DOM_METHOD(interface_, name_) interface_##_##name_,
68 #define USE_COUNTER_DOM_ATTRIBUTE(interface_, name_) \
69   interface_##_##name_##_getter, interface_##_##name_##_setter,
70 #define USE_COUNTER_CUSTOM(name_, desc_) Custom_##name_,
71 #include "mozilla/dom/UseCounterWorkerList.h"
72 #undef USE_COUNTER_DOM_METHOD
73 #undef USE_COUNTER_DOM_ATTRIBUTE
74 #undef USE_COUNTER_CUSTOM
75   Count
76 };
77 
78 }  // namespace mozilla
79 
80 #endif
81