Add perfetto tracing events to fonts (#33436)

* trace fonts

Co-authored-by: Delan Azabani <dazabani@igalia.com>
Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* review fix

Co-authored-by: Delan Azabani <dazabani@igalia.com>
Signed-off-by: atbrakhi <atbrakhi@igalia.com>

---------

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
atbrakhi 2024-09-16 11:04:58 +02:00 committed by GitHub
parent b12cebd1ac
commit 236cae9ce5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 1 deletions

View file

@ -89,6 +89,7 @@ use surfman::platform::generic::multi::context::NativeContext as LinuxNativeCont
use surfman::{GLApi, GLVersion};
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
use surfman::{NativeConnection, NativeContext};
use tracing::{span, Level};
use webgpu::swapchain::WGPUImageMap;
use webrender::{RenderApiSender, ShaderPrecacheFlags, UploadMethod, ONE_TIME_USAGE_HINT};
use webrender_api::{
@ -1105,6 +1106,7 @@ impl WebRenderFontApi for WebRenderFontApiCompositorProxy {
receiver.recv().unwrap()
}
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
fn add_font(&self, data: Arc<Vec<u8>>, index: u32) -> FontKey {
let (sender, receiver) = unbounded();
let (bytes_sender, bytes_receiver) =
@ -1113,7 +1115,11 @@ impl WebRenderFontApi for WebRenderFontApiCompositorProxy {
.send(CompositorMsg::Forwarded(ForwardedToCompositorMsg::Font(
FontToCompositorMsg::AddFont(sender, index, bytes_receiver),
)));
let _ = bytes_sender.send(&data);
{
let span = span!(Level::TRACE, "add_font send", servo_profiling = true);
let _span = span.enter();
let _ = bytes_sender.send(&data);
}
receiver.recv().unwrap()
}