Skip to content

Commit bce77c8

Browse files
Emily Janzerfacebook-github-bot
authored andcommitted
Convert ReactMarkerConstants enum to consts
Summary: Converting ReactMarkerConstants enum to consts + stringdef annotation Reviewed By: mdvacca Differential Revision: D9304307 fbshipit-source-id: db9d170e80593131bd4ebd6937d2f6ce6e694e4e
1 parent 88be0ce commit bce77c8

2 files changed

Lines changed: 169 additions & 105 deletions

File tree

ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarker.java

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
public class ReactMarker {
2121

2222
public interface MarkerListener {
23-
void logMarker(ReactMarkerConstants name, @Nullable String tag, int instanceKey);
23+
void logMarker(@ReactMarkerConstants String name, @Nullable String tag, int instanceKey);
2424
};
2525

2626
// Use a list instead of a set here because we expect the number of listeners
@@ -52,43 +52,22 @@ public static void clearMarkerListeners() {
5252
}
5353

5454
@DoNotStrip
55-
public static void logMarker(String name) {
56-
logMarker(name, null);
57-
}
58-
59-
@DoNotStrip
60-
public static void logMarker(String name, int instanceKey) {
61-
logMarker(name, null, instanceKey);
62-
}
63-
64-
@DoNotStrip
65-
public static void logMarker(String name, @Nullable String tag) {
66-
logMarker(name, tag, 0);
67-
}
68-
69-
@DoNotStrip
70-
public static void logMarker(String name, @Nullable String tag, int instanceKey) {
71-
ReactMarkerConstants marker = ReactMarkerConstants.valueOf(name);
72-
logMarker(marker, tag, instanceKey);
73-
}
74-
75-
@DoNotStrip
76-
public static void logMarker(ReactMarkerConstants name) {
55+
public static void logMarker(@ReactMarkerConstants String name) {
7756
logMarker(name, null, 0);
7857
}
7958

8059
@DoNotStrip
81-
public static void logMarker(ReactMarkerConstants name, int instanceKey) {
60+
public static void logMarker(@ReactMarkerConstants String name, int instanceKey) {
8261
logMarker(name, null, instanceKey);
8362
}
8463

8564
@DoNotStrip
86-
public static void logMarker(ReactMarkerConstants name, @Nullable String tag) {
65+
public static void logMarker(@ReactMarkerConstants String name, @Nullable String tag) {
8766
logMarker(name, tag, 0);
8867
}
8968

9069
@DoNotStrip
91-
public static void logMarker(ReactMarkerConstants name, @Nullable String tag, int instanceKey) {
70+
public static void logMarker(@ReactMarkerConstants String name, @Nullable String tag, int instanceKey) {
9271
synchronized(sListeners) {
9372
for (MarkerListener listener : sListeners) {
9473
listener.logMarker(name, tag, instanceKey);

ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java

Lines changed: 164 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -5,86 +5,171 @@
55

66
package com.facebook.react.bridge;
77

8+
import android.support.annotation.StringDef;
9+
import java.lang.annotation.Retention;
10+
import java.lang.annotation.RetentionPolicy;
11+
812
/**
913
* Constants used by ReactMarker.
1014
*/
11-
public enum ReactMarkerConstants {
12-
CREATE_REACT_CONTEXT_START,
13-
CREATE_REACT_CONTEXT_END,
14-
PROCESS_PACKAGES_START,
15-
PROCESS_PACKAGES_END,
16-
BUILD_NATIVE_MODULE_REGISTRY_START,
17-
BUILD_NATIVE_MODULE_REGISTRY_END,
18-
CREATE_CATALYST_INSTANCE_START,
19-
CREATE_CATALYST_INSTANCE_END,
20-
DESTROY_CATALYST_INSTANCE_START,
21-
DESTROY_CATALYST_INSTANCE_END,
22-
RUN_JS_BUNDLE_START,
23-
RUN_JS_BUNDLE_END,
24-
NATIVE_MODULE_INITIALIZE_START,
25-
NATIVE_MODULE_INITIALIZE_END,
26-
SETUP_REACT_CONTEXT_START,
27-
SETUP_REACT_CONTEXT_END,
28-
CREATE_UI_MANAGER_MODULE_START,
29-
CREATE_UI_MANAGER_MODULE_END,
30-
CREATE_VIEW_MANAGERS_START,
31-
CREATE_VIEW_MANAGERS_END,
32-
CREATE_UI_MANAGER_MODULE_CONSTANTS_START,
33-
CREATE_UI_MANAGER_MODULE_CONSTANTS_END,
34-
NATIVE_MODULE_SETUP_START,
35-
NATIVE_MODULE_SETUP_END,
36-
CREATE_MODULE_START,
37-
CREATE_MODULE_END,
38-
PROCESS_CORE_REACT_PACKAGE_START,
39-
PROCESS_CORE_REACT_PACKAGE_END,
40-
CREATE_I18N_MODULE_CONSTANTS_START,
41-
CREATE_I18N_MODULE_CONSTANTS_END,
42-
I18N_MODULE_CONSTANTS_CONVERT_START,
43-
I18N_MODULE_CONSTANTS_CONVERT_END,
44-
CREATE_I18N_ASSETS_MODULE_START,
45-
CREATE_I18N_ASSETS_MODULE_END,
46-
GET_CONSTANTS_START,
47-
GET_CONSTANTS_END,
48-
INITIALIZE_MODULE_START,
49-
INITIALIZE_MODULE_END,
50-
ON_HOST_RESUME_START,
51-
ON_HOST_RESUME_END,
52-
ON_HOST_PAUSE_START,
53-
ON_HOST_PAUSE_END,
54-
CONVERT_CONSTANTS_START,
55-
CONVERT_CONSTANTS_END,
56-
PRE_REACT_CONTEXT_END,
57-
UNPACKING_JS_BUNDLE_LOADER_CHECK_START,
58-
UNPACKING_JS_BUNDLE_LOADER_CHECK_END,
59-
UNPACKING_JS_BUNDLE_LOADER_EXTRACTED,
60-
UNPACKING_JS_BUNDLE_LOADER_BLOCKED,
61-
loadApplicationScript_startStringConvert,
62-
loadApplicationScript_endStringConvert,
63-
PRE_SETUP_REACT_CONTEXT_START,
64-
PRE_SETUP_REACT_CONTEXT_END,
65-
PRE_RUN_JS_BUNDLE_START,
66-
ATTACH_MEASURED_ROOT_VIEWS_START,
67-
ATTACH_MEASURED_ROOT_VIEWS_END,
68-
CONTENT_APPEARED,
69-
RELOAD,
70-
DOWNLOAD_START,
71-
DOWNLOAD_END,
72-
REACT_CONTEXT_THREAD_START,
73-
REACT_CONTEXT_THREAD_END,
74-
GET_REACT_INSTANCE_MANAGER_START,
75-
GET_REACT_INSTANCE_MANAGER_END,
76-
GET_REACT_INSTANCE_HOLDER_SPEC_START,
77-
GET_REACT_INSTANCE_HOLDER_SPEC_END,
78-
BUILD_REACT_INSTANCE_MANAGER_START,
79-
BUILD_REACT_INSTANCE_MANAGER_END,
80-
PROCESS_INFRA_PACKAGE_START,
81-
PROCESS_INFRA_PACKAGE_END,
82-
PROCESS_PRODUCT_PACKAGE_START,
83-
PROCESS_PRODUCT_PACKAGE_END,
84-
CREATE_MC_MODULE_START,
85-
CREATE_MC_MODULE_END,
86-
CREATE_MC_MODULE_GET_METADATA_START,
87-
CREATE_MC_MODULE_GET_METADATA_END,
88-
REGISTER_JS_SEGMENT_START,
89-
REGISTER_JS_SEGMENT_STOP,
15+
@StringDef({
16+
ReactMarkerConstants.CREATE_REACT_CONTEXT_START,
17+
ReactMarkerConstants.CREATE_REACT_CONTEXT_END,
18+
ReactMarkerConstants.PROCESS_PACKAGES_START,
19+
ReactMarkerConstants.PROCESS_PACKAGES_END,
20+
ReactMarkerConstants.BUILD_NATIVE_MODULE_REGISTRY_START,
21+
ReactMarkerConstants.BUILD_NATIVE_MODULE_REGISTRY_END,
22+
ReactMarkerConstants.CREATE_CATALYST_INSTANCE_START,
23+
ReactMarkerConstants.CREATE_CATALYST_INSTANCE_END,
24+
ReactMarkerConstants.DESTROY_CATALYST_INSTANCE_START,
25+
ReactMarkerConstants.DESTROY_CATALYST_INSTANCE_END,
26+
ReactMarkerConstants.RUN_JS_BUNDLE_START,
27+
ReactMarkerConstants.RUN_JS_BUNDLE_END,
28+
ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_START,
29+
ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_END,
30+
ReactMarkerConstants.SETUP_REACT_CONTEXT_START,
31+
ReactMarkerConstants.SETUP_REACT_CONTEXT_END,
32+
ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_START,
33+
ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_END,
34+
ReactMarkerConstants.CREATE_VIEW_MANAGERS_START,
35+
ReactMarkerConstants.CREATE_VIEW_MANAGERS_END,
36+
ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_CONSTANTS_START,
37+
ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_CONSTANTS_END,
38+
ReactMarkerConstants.NATIVE_MODULE_SETUP_START,
39+
ReactMarkerConstants.NATIVE_MODULE_SETUP_END,
40+
ReactMarkerConstants.CREATE_MODULE_START,
41+
ReactMarkerConstants.CREATE_MODULE_END,
42+
ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_START,
43+
ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_END,
44+
ReactMarkerConstants.CREATE_I18N_MODULE_CONSTANTS_START,
45+
ReactMarkerConstants.CREATE_I18N_MODULE_CONSTANTS_END,
46+
ReactMarkerConstants.I18N_MODULE_CONSTANTS_CONVERT_START,
47+
ReactMarkerConstants.I18N_MODULE_CONSTANTS_CONVERT_END,
48+
ReactMarkerConstants.CREATE_I18N_ASSETS_MODULE_START,
49+
ReactMarkerConstants.CREATE_I18N_ASSETS_MODULE_END,
50+
ReactMarkerConstants.GET_CONSTANTS_START,
51+
ReactMarkerConstants.GET_CONSTANTS_END,
52+
ReactMarkerConstants.INITIALIZE_MODULE_START,
53+
ReactMarkerConstants.INITIALIZE_MODULE_END,
54+
ReactMarkerConstants.ON_HOST_RESUME_START,
55+
ReactMarkerConstants.ON_HOST_RESUME_END,
56+
ReactMarkerConstants.ON_HOST_PAUSE_START,
57+
ReactMarkerConstants.ON_HOST_PAUSE_END,
58+
ReactMarkerConstants.CONVERT_CONSTANTS_START,
59+
ReactMarkerConstants.CONVERT_CONSTANTS_END,
60+
ReactMarkerConstants.PRE_REACT_CONTEXT_END,
61+
ReactMarkerConstants.UNPACKING_JS_BUNDLE_LOADER_CHECK_START,
62+
ReactMarkerConstants.UNPACKING_JS_BUNDLE_LOADER_CHECK_END,
63+
ReactMarkerConstants.UNPACKING_JS_BUNDLE_LOADER_EXTRACTED,
64+
ReactMarkerConstants.UNPACKING_JS_BUNDLE_LOADER_BLOCKED,
65+
ReactMarkerConstants.LOAD_APPLICATION_SCRIPT_START_STRING_CONVERT,
66+
ReactMarkerConstants.LOAD_APPLICATION_SCRIPT_END_STRING_CONVERT,
67+
ReactMarkerConstants.PRE_SETUP_REACT_CONTEXT_START,
68+
ReactMarkerConstants.PRE_SETUP_REACT_CONTEXT_END,
69+
ReactMarkerConstants.PRE_RUN_JS_BUNDLE_START,
70+
ReactMarkerConstants.ATTACH_MEASURED_ROOT_VIEWS_START,
71+
ReactMarkerConstants.ATTACH_MEASURED_ROOT_VIEWS_END,
72+
ReactMarkerConstants.CONTENT_APPEARED,
73+
ReactMarkerConstants.RELOAD,
74+
ReactMarkerConstants.DOWNLOAD_START,
75+
ReactMarkerConstants.DOWNLOAD_END,
76+
ReactMarkerConstants.REACT_CONTEXT_THREAD_START,
77+
ReactMarkerConstants.REACT_CONTEXT_THREAD_END,
78+
ReactMarkerConstants.GET_REACT_INSTANCE_MANAGER_START,
79+
ReactMarkerConstants.GET_REACT_INSTANCE_MANAGER_END,
80+
ReactMarkerConstants.GET_REACT_INSTANCE_HOLDER_SPEC_START,
81+
ReactMarkerConstants.GET_REACT_INSTANCE_HOLDER_SPEC_END,
82+
ReactMarkerConstants.BUILD_REACT_INSTANCE_MANAGER_START,
83+
ReactMarkerConstants.BUILD_REACT_INSTANCE_MANAGER_END,
84+
ReactMarkerConstants.PROCESS_INFRA_PACKAGE_START,
85+
ReactMarkerConstants.PROCESS_INFRA_PACKAGE_END,
86+
ReactMarkerConstants.PROCESS_PRODUCT_PACKAGE_START,
87+
ReactMarkerConstants.PROCESS_PRODUCT_PACKAGE_END,
88+
ReactMarkerConstants.CREATE_MC_MODULE_START,
89+
ReactMarkerConstants.CREATE_MC_MODULE_END,
90+
ReactMarkerConstants.CREATE_MC_MODULE_GET_METADATA_START,
91+
ReactMarkerConstants.CREATE_MC_MODULE_GET_METADATA_END,
92+
ReactMarkerConstants.REGISTER_JS_SEGMENT_START,
93+
ReactMarkerConstants.REGISTER_JS_SEGMENT_STOP
94+
})
95+
@Retention(RetentionPolicy.SOURCE)
96+
public @interface ReactMarkerConstants {
97+
String CREATE_REACT_CONTEXT_START = "CREATE_REACT_CONTEXT_START";
98+
String CREATE_REACT_CONTEXT_END = "CREATE_REACT_CONTEXT_END";
99+
String PROCESS_PACKAGES_START = "PROCESS_PACKAGES_START";
100+
String PROCESS_PACKAGES_END = "PROCESS_PACKAGES_END";
101+
String BUILD_NATIVE_MODULE_REGISTRY_START = "BUILD_NATIVE_MODULE_REGISTRY_START";
102+
String BUILD_NATIVE_MODULE_REGISTRY_END = "BUILD_NATIVE_MODULE_REGISTRY_END";
103+
String CREATE_CATALYST_INSTANCE_START = "CREATE_CATALYST_INSTANCE_START";
104+
String CREATE_CATALYST_INSTANCE_END = "CREATE_CATALYST_INSTANCE_END";
105+
String DESTROY_CATALYST_INSTANCE_START = "DESTROY_CATALYST_INSTANCE_START";
106+
String DESTROY_CATALYST_INSTANCE_END = "DESTROY_CATALYST_INSTANCE_END";
107+
String RUN_JS_BUNDLE_START = "RUN_JS_BUNDLE_START";
108+
String RUN_JS_BUNDLE_END = "RUN_JS_BUNDLE_END";
109+
String NATIVE_MODULE_INITIALIZE_START = "NATIVE_MODULE_INITIALIZE_START";
110+
String NATIVE_MODULE_INITIALIZE_END = "NATIVE_MODULE_INITIALIZE_END";
111+
String SETUP_REACT_CONTEXT_START = "SETUP_REACT_CONTEXT_START";
112+
String SETUP_REACT_CONTEXT_END = "SETUP_REACT_CONTEXT_END";
113+
String CREATE_UI_MANAGER_MODULE_START = "CREATE_UI_MANAGER_MODULE_START";
114+
String CREATE_UI_MANAGER_MODULE_END = "CREATE_UI_MANAGER_MODULE_END";
115+
String CREATE_VIEW_MANAGERS_START = "CREATE_VIEW_MANAGERS_START";
116+
String CREATE_VIEW_MANAGERS_END = "CREATE_VIEW_MANAGERS_END";
117+
String CREATE_UI_MANAGER_MODULE_CONSTANTS_START = "CREATE_UI_MANAGER_MODULE_CONSTANTS_START";
118+
String CREATE_UI_MANAGER_MODULE_CONSTANTS_END = "CREATE_UI_MANAGER_MODULE_CONSTANTS_END";
119+
String NATIVE_MODULE_SETUP_START = "NATIVE_MODULE_SETUP_START";
120+
String NATIVE_MODULE_SETUP_END = "NATIVE_MODULE_SETUP_END";
121+
String CREATE_MODULE_START = "CREATE_MODULE_START";
122+
String CREATE_MODULE_END = "CREATE_MODULE_END";
123+
String PROCESS_CORE_REACT_PACKAGE_START = "PROCESS_CORE_REACT_PACKAGE_START";
124+
String PROCESS_CORE_REACT_PACKAGE_END = "PROCESS_CORE_REACT_PACKAGE_END";
125+
String CREATE_I18N_MODULE_CONSTANTS_START = "CREATE_I18N_MODULE_CONSTANTS_START";
126+
String CREATE_I18N_MODULE_CONSTANTS_END = "CREATE_I18N_MODULE_CONSTANTS_END";
127+
String I18N_MODULE_CONSTANTS_CONVERT_START = "I18N_MODULE_CONSTANTS_CONVERT_START";
128+
String I18N_MODULE_CONSTANTS_CONVERT_END = "I18N_MODULE_CONSTANTS_CONVERT_END";
129+
String CREATE_I18N_ASSETS_MODULE_START = "CREATE_I18N_ASSETS_MODULE_START";
130+
String CREATE_I18N_ASSETS_MODULE_END = "CREATE_I18N_ASSETS_MODULE_END";
131+
String GET_CONSTANTS_START = "GET_CONSTANTS_START";
132+
String GET_CONSTANTS_END = "GET_CONSTANTS_END";
133+
String INITIALIZE_MODULE_START = "INITIALIZE_MODULE_START";
134+
String INITIALIZE_MODULE_END = "INITIALIZE_MODULE_END";
135+
String ON_HOST_RESUME_START = "ON_HOST_RESUME_START";
136+
String ON_HOST_RESUME_END = "ON_HOST_RESUME_END";
137+
String ON_HOST_PAUSE_START = "ON_HOST_PAUSE_START";
138+
String ON_HOST_PAUSE_END = "ON_HOST_PAUSE_END";
139+
String CONVERT_CONSTANTS_START = "CONVERT_CONSTANTS_START";
140+
String CONVERT_CONSTANTS_END = "CONVERT_CONSTANTS_END";
141+
String PRE_REACT_CONTEXT_END = "PRE_REACT_CONTEXT_END";
142+
String UNPACKING_JS_BUNDLE_LOADER_CHECK_START = "UNPACKING_JS_BUNDLE_LOADER_CHECK_START";
143+
String UNPACKING_JS_BUNDLE_LOADER_CHECK_END = "UNPACKING_JS_BUNDLE_LOADER_CHECK_END";
144+
String UNPACKING_JS_BUNDLE_LOADER_EXTRACTED = "UNPACKING_JS_BUNDLE_LOADER_EXTRACTED";
145+
String UNPACKING_JS_BUNDLE_LOADER_BLOCKED = "UNPACKING_JS_BUNDLE_LOADER_BLOCKED";
146+
String LOAD_APPLICATION_SCRIPT_START_STRING_CONVERT = "loadApplicationScript_startStringConvert";
147+
String LOAD_APPLICATION_SCRIPT_END_STRING_CONVERT = "loadApplicationScript_endStringConvert";
148+
String PRE_SETUP_REACT_CONTEXT_START = "PRE_SETUP_REACT_CONTEXT_START";
149+
String PRE_SETUP_REACT_CONTEXT_END = "PRE_SETUP_REACT_CONTEXT_END";
150+
String PRE_RUN_JS_BUNDLE_START = "PRE_RUN_JS_BUNDLE_START";
151+
String ATTACH_MEASURED_ROOT_VIEWS_START = "ATTACH_MEASURED_ROOT_VIEWS_START";
152+
String ATTACH_MEASURED_ROOT_VIEWS_END = "ATTACH_MEASURED_ROOT_VIEWS_END";
153+
String CONTENT_APPEARED = "CONTENT_APPEARED";
154+
String RELOAD = "RELOAD";
155+
String DOWNLOAD_START = "DOWNLOAD_START";
156+
String DOWNLOAD_END = "DOWNLOAD_END";
157+
String REACT_CONTEXT_THREAD_START = "REACT_CONTEXT_THREAD_START";
158+
String REACT_CONTEXT_THREAD_END = "REACT_CONTEXT_THREAD_END";
159+
String GET_REACT_INSTANCE_MANAGER_START = "GET_REACT_INSTANCE_MANAGER_START";
160+
String GET_REACT_INSTANCE_MANAGER_END = "GET_REACT_INSTANCE_MANAGER_END";
161+
String GET_REACT_INSTANCE_HOLDER_SPEC_START = "GET_REACT_INSTANCE_HOLDER_SPEC_START";
162+
String GET_REACT_INSTANCE_HOLDER_SPEC_END = "GET_REACT_INSTANCE_HOLDER_SPEC_END";
163+
String BUILD_REACT_INSTANCE_MANAGER_START = "BUILD_REACT_INSTANCE_MANAGER_START";
164+
String BUILD_REACT_INSTANCE_MANAGER_END = "BUILD_REACT_INSTANCE_MANAGER_END";
165+
String PROCESS_INFRA_PACKAGE_START = "PROCESS_INFRA_PACKAGE_START";
166+
String PROCESS_INFRA_PACKAGE_END = "PROCESS_INFRA_PACKAGE_END";
167+
String PROCESS_PRODUCT_PACKAGE_START = "PROCESS_PRODUCT_PACKAGE_START";
168+
String PROCESS_PRODUCT_PACKAGE_END = "PROCESS_PRODUCT_PACKAGE_END";
169+
String CREATE_MC_MODULE_START = "CREATE_MC_MODULE_START";
170+
String CREATE_MC_MODULE_END = "CREATE_MC_MODULE_END";
171+
String CREATE_MC_MODULE_GET_METADATA_START = "CREATE_MC_MODULE_GET_METADATA_START";
172+
String CREATE_MC_MODULE_GET_METADATA_END = "CREATE_MC_MODULE_GET_METADATA_END";
173+
String REGISTER_JS_SEGMENT_START = "REGISTER_JS_SEGMENT_START";
174+
String REGISTER_JS_SEGMENT_STOP = "REGISTER_JS_SEGMENT_STOP";
90175
}

0 commit comments

Comments
 (0)