@@ -10,6 +10,19 @@ index e0e14bf60..179de2592 100644
10
10
11
11
12
12
@depends(target)
13
+ @@ -1019,6 +1019,12 @@
14
+
15
+ set_config("ANDROID_CPU_ARCH", android_cpu_arch)
16
+
17
+ + @depends(target, when=target_is_ohos)
18
+ + def ohos_hilog_domain(target):
19
+ + return "0xE0C4"
20
+ +
21
+ + set_define("OHOS_LOG_DOMAIN", ohos_hilog_domain)
22
+ +
23
+
24
+ @depends("--enable-project", build_environment, "--help")
25
+ @imports(_from="os.path", _import="exists")
13
26
diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
14
27
index 471599f17..a89f0ca7a 100644
15
28
--- a/config/system-headers.mozbuild
@@ -47,7 +60,7 @@ index 3cfc92533..9c487ac45 100644
47
60
+ #ifdef ANDROID
48
61
+ __android_log_print(ANDROID_LOG_ERROR, "Gecko", "mozalloc_abort: %s", msg);
49
62
+ #elif defined(OHOS)
50
- + (void) OH_LOG_Print(LOG_APP, LOG_ERROR, 0 , "Gecko",
63
+ + (void) OH_LOG_Print(LOG_APP, LOG_ERROR, OHOS_LOG_DOMAIN , "Gecko",
51
64
+ "mozalloc_abort: %{public}s\n", msg);
52
65
+ #else
53
66
fputs(msg, stderr);
@@ -75,7 +88,7 @@ index 0b7395177..e84d76aba 100644
75
88
/* aMaxFrames */ 0);
76
89
# endif
77
90
+ #elif defined(OHOS)
78
- + (void) OH_LOG_Print(LOG_APP, LOG_FATAL, 0 , "MOZ_Assert",
91
+ + (void) OH_LOG_Print(LOG_APP, LOG_FATAL, OHOS_LOG_DOMAIN , "MOZ_Assert",
79
92
+ "Assertion failure: %{public}s, at %{public}s:%{public}d\n",
80
93
+ aStr, aFilename, aLine);
81
94
#else
@@ -86,7 +99,7 @@ index 0b7395177..e84d76aba 100644
86
99
"[%d] Hit MOZ_CRASH(%s) at %s:%d\n", MOZ_GET_PID(), aStr,
87
100
aFilename, aLine);
88
101
+ #elif defined(OHOS)
89
- + (void) OH_LOG_Print(LOG_APP, LOG_FATAL, 0 , "MOZ_CRASH",
102
+ + (void) OH_LOG_Print(LOG_APP, LOG_FATAL, OHOS_LOG_DOMAIN , "MOZ_CRASH",
90
103
+ "Hit MOZ_CRASH(%{public}s), at %{public}s:%{public}d\n",
91
104
+ aStr, aFilename, aLine);
92
105
#else
@@ -116,7 +129,7 @@ index 3247b993c..c7039d5f8 100644
116
129
+ #if defined(ANDROID)
117
130
__android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", s.str().c_str());
118
131
+ #elif defined(OHOS)
119
- + (void) OH_LOG_Print(LOG_APP, LOG_INFO, 0 , "Gecko", "%{public}s\n", s.str().c_str());
132
+ + (void) OH_LOG_Print(LOG_APP, LOG_INFO, OHOS_LOG_DOMAIN , "Gecko", "%{public}s\n", s.str().c_str());
120
133
#else
121
134
fputs(s.str().c_str(), stderr);
122
135
#endif
@@ -143,7 +156,7 @@ index c3a2ca89e..3fea33f4b 100644
143
156
}
144
157
+ #elif defined(OHOS)
145
158
+ MFBT_API void vprintf_stderr(const char* aFmt, va_list aArgs) {
146
- + (void) OH_LOG_Print(LOG_APP, LOG_INFO, 0 , "Gecko", aFmt, aArgs);
159
+ + (void) OH_LOG_Print(LOG_APP, LOG_INFO, OHOS_LOG_DOMAIN , "Gecko", aFmt, aArgs);
147
160
+ }
148
161
#elif defined(FUZZING_SNAPSHOT)
149
162
MFBT_API void vprintf_stderr(const char* aFmt, va_list aArgs) {
@@ -194,7 +207,7 @@ index 52bd6abc5..781402d56 100644
194
207
+ if (fd == _pr_stderr) { \
195
208
+ char savebyte = buf[nb]; \
196
209
+ buf[nb] = '\0'; \
197
- + (void) OH_LOG_Print(LOG_APP, LOG_INFO, 0 , "PRLog", \
210
+ + (void) OH_LOG_Print(LOG_APP, LOG_INFO, OHOS_LOG_DOMAIN , "PRLog", \
198
211
+ "%{public}s\n", buf); \
199
212
+ buf[nb] = savebyte; \
200
213
+ } else { \
@@ -209,7 +222,7 @@ index 52bd6abc5..781402d56 100644
209
222
#ifdef ANDROID
210
223
__android_log_write(ANDROID_LOG_ERROR, "PRLog", "Aborting");
211
224
+ #elif defined(OHOS)
212
- + (void) OH_LOG_Print(LOG_APP, LOG_ERROR, 0 , "PRLog", "Aborting\n");
225
+ + (void) OH_LOG_Print(LOG_APP, LOG_ERROR, OHOS_LOG_DOMAIN , "PRLog", "Aborting\n");
213
226
#endif
214
227
abort();
215
228
}
@@ -218,7 +231,7 @@ index 52bd6abc5..781402d56 100644
218
231
__android_log_assert(NULL, "PRLog", "Assertion failure: %s, at %s:%d\n",
219
232
s, file, ln);
220
233
+ #elif defined(OHOS)
221
- + (void) OH_LOG_Print(LOG_APP, LOG_ERROR, 0 , "PRLog",
234
+ + (void) OH_LOG_Print(LOG_APP, LOG_ERROR, OHOS_LOG_DOMAIN , "PRLog",
222
235
+ "Assertion failure: %{public}s, at %{public}s:%{public}d\n",s, file, ln);
223
236
#endif
224
237
abort();
0 commit comments