mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
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:
parent
b12cebd1ac
commit
236cae9ce5
4 changed files with 24 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1914,6 +1914,7 @@ dependencies = [
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"style",
|
"style",
|
||||||
"surfman",
|
"surfman",
|
||||||
|
"tracing",
|
||||||
"truetype",
|
"truetype",
|
||||||
"unicode-bidi",
|
"unicode-bidi",
|
||||||
"unicode-properties",
|
"unicode-properties",
|
||||||
|
|
|
@ -41,6 +41,7 @@ servo_url = { path = "../url" }
|
||||||
smallvec = { workspace = true, features = ["union"] }
|
smallvec = { workspace = true, features = ["union"] }
|
||||||
surfman = { workspace = true }
|
surfman = { workspace = true }
|
||||||
style = { workspace = true }
|
style = { workspace = true }
|
||||||
|
tracing = { workspace = true }
|
||||||
unicode-bidi = { workspace = true, features = ["with_serde"] }
|
unicode-bidi = { workspace = true, features = ["with_serde"] }
|
||||||
unicode-properties = { workspace = true }
|
unicode-properties = { workspace = true }
|
||||||
unicode-script = { workspace = true }
|
unicode-script = { workspace = true }
|
||||||
|
|
|
@ -23,6 +23,7 @@ use style::values::computed::font::{
|
||||||
};
|
};
|
||||||
use style::values::computed::{FontStretch, FontWeight};
|
use style::values::computed::{FontStretch, FontWeight};
|
||||||
use style::values::specified::FontStretch as SpecifiedFontStretch;
|
use style::values::specified::FontStretch as SpecifiedFontStretch;
|
||||||
|
use tracing::{span, Level};
|
||||||
use webrender_api::{FontInstanceFlags, FontInstanceKey, FontKey};
|
use webrender_api::{FontInstanceFlags, FontInstanceKey, FontKey};
|
||||||
use webrender_traits::WebRenderFontApi;
|
use webrender_traits::WebRenderFontApi;
|
||||||
|
|
||||||
|
@ -102,12 +103,19 @@ struct FontCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FontCache {
|
impl FontCache {
|
||||||
|
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
|
||||||
fn run(&mut self) {
|
fn run(&mut self) {
|
||||||
loop {
|
loop {
|
||||||
let msg = self.port.recv().unwrap();
|
let msg = self.port.recv().unwrap();
|
||||||
|
|
||||||
match msg {
|
match msg {
|
||||||
Command::GetFontTemplates(descriptor_to_match, font_family, result) => {
|
Command::GetFontTemplates(descriptor_to_match, font_family, result) => {
|
||||||
|
let span = span!(
|
||||||
|
Level::TRACE,
|
||||||
|
"Command::GetFontTemplates",
|
||||||
|
servo_profiling = true
|
||||||
|
);
|
||||||
|
let _span = span.enter();
|
||||||
let templates =
|
let templates =
|
||||||
self.find_font_templates(descriptor_to_match.as_ref(), &font_family);
|
self.find_font_templates(descriptor_to_match.as_ref(), &font_family);
|
||||||
debug!("Found templates for descriptor {descriptor_to_match:?}: ");
|
debug!("Found templates for descriptor {descriptor_to_match:?}: ");
|
||||||
|
@ -141,6 +149,12 @@ impl FontCache {
|
||||||
.font_data
|
.font_data
|
||||||
.entry(identifier)
|
.entry(identifier)
|
||||||
.or_insert_with(|| font_template.data());
|
.or_insert_with(|| font_template.data());
|
||||||
|
let span = span!(
|
||||||
|
Level::TRACE,
|
||||||
|
"GetFontTemplates send",
|
||||||
|
servo_profiling = true
|
||||||
|
);
|
||||||
|
let _span = span.enter();
|
||||||
let _ = bytes_sender.send(data);
|
let _ = bytes_sender.send(data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -186,6 +200,7 @@ impl FontCache {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
|
||||||
fn find_font_templates(
|
fn find_font_templates(
|
||||||
&mut self,
|
&mut self,
|
||||||
descriptor_to_match: Option<&FontDescriptor>,
|
descriptor_to_match: Option<&FontDescriptor>,
|
||||||
|
|
|
@ -89,6 +89,7 @@ use surfman::platform::generic::multi::context::NativeContext as LinuxNativeCont
|
||||||
use surfman::{GLApi, GLVersion};
|
use surfman::{GLApi, GLVersion};
|
||||||
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
|
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
|
||||||
use surfman::{NativeConnection, NativeContext};
|
use surfman::{NativeConnection, NativeContext};
|
||||||
|
use tracing::{span, Level};
|
||||||
use webgpu::swapchain::WGPUImageMap;
|
use webgpu::swapchain::WGPUImageMap;
|
||||||
use webrender::{RenderApiSender, ShaderPrecacheFlags, UploadMethod, ONE_TIME_USAGE_HINT};
|
use webrender::{RenderApiSender, ShaderPrecacheFlags, UploadMethod, ONE_TIME_USAGE_HINT};
|
||||||
use webrender_api::{
|
use webrender_api::{
|
||||||
|
@ -1105,6 +1106,7 @@ impl WebRenderFontApi for WebRenderFontApiCompositorProxy {
|
||||||
receiver.recv().unwrap()
|
receiver.recv().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
|
||||||
fn add_font(&self, data: Arc<Vec<u8>>, index: u32) -> FontKey {
|
fn add_font(&self, data: Arc<Vec<u8>>, index: u32) -> FontKey {
|
||||||
let (sender, receiver) = unbounded();
|
let (sender, receiver) = unbounded();
|
||||||
let (bytes_sender, bytes_receiver) =
|
let (bytes_sender, bytes_receiver) =
|
||||||
|
@ -1113,7 +1115,11 @@ impl WebRenderFontApi for WebRenderFontApiCompositorProxy {
|
||||||
.send(CompositorMsg::Forwarded(ForwardedToCompositorMsg::Font(
|
.send(CompositorMsg::Forwarded(ForwardedToCompositorMsg::Font(
|
||||||
FontToCompositorMsg::AddFont(sender, index, bytes_receiver),
|
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()
|
receiver.recv().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue