From 14259c1d59da7189bdd45985edd6c8108376c4e5 Mon Sep 17 00:00:00 2001 From: Narfinger Date: Tue, 17 Jun 2025 20:48:45 +0200 Subject: [PATCH] OHOS: servoshell: forward special alerts to hitrace (#37508) We want to have special files with testcases running javascript and reporting their timing via alert(). This pushes these messages to hitrace. Signed-off-by: Narfinger Testing: Does not change functionality and will only add messages to hitrace. Signed-off-by: Narfinger --- ports/servoshell/egl/ohos.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ports/servoshell/egl/ohos.rs b/ports/servoshell/egl/ohos.rs index 7c70aa8254f..abafb8e97cb 100644 --- a/ports/servoshell/egl/ohos.rs +++ b/ports/servoshell/egl/ohos.rs @@ -869,6 +869,17 @@ impl HostTrait for HostCallbacks { response_sender, } => { debug!("SimpleDialog::Alert"); + + // forward it to tracing + #[cfg(feature = "tracing-hitrace")] + { + if message.contains("TESTCASE_PROFILING") { + if let Some((tag, number)) = message.rsplit_once(":") { + hitrace::trace_metric_str(tag, number.parse::().unwrap_or(-1)); + } + } + } + // TODO: Indicate that this message is untrusted, and what origin it came from. self.show_alert(message); response_sender.send(AlertResponse::Ok)