mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -41,6 +41,7 @@ servo_url = { path = "../url" }
|
|||
smallvec = { workspace = true, features = ["union"] }
|
||||
surfman = { workspace = true }
|
||||
style = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
unicode-bidi = { workspace = true, features = ["with_serde"] }
|
||||
unicode-properties = { workspace = true }
|
||||
unicode-script = { workspace = true }
|
||||
|
|
|
@ -23,6 +23,7 @@ use style::values::computed::font::{
|
|||
};
|
||||
use style::values::computed::{FontStretch, FontWeight};
|
||||
use style::values::specified::FontStretch as SpecifiedFontStretch;
|
||||
use tracing::{span, Level};
|
||||
use webrender_api::{FontInstanceFlags, FontInstanceKey, FontKey};
|
||||
use webrender_traits::WebRenderFontApi;
|
||||
|
||||
|
@ -102,12 +103,19 @@ struct FontCache {
|
|||
}
|
||||
|
||||
impl FontCache {
|
||||
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
|
||||
fn run(&mut self) {
|
||||
loop {
|
||||
let msg = self.port.recv().unwrap();
|
||||
|
||||
match msg {
|
||||
Command::GetFontTemplates(descriptor_to_match, font_family, result) => {
|
||||
let span = span!(
|
||||
Level::TRACE,
|
||||
"Command::GetFontTemplates",
|
||||
servo_profiling = true
|
||||
);
|
||||
let _span = span.enter();
|
||||
let templates =
|
||||
self.find_font_templates(descriptor_to_match.as_ref(), &font_family);
|
||||
debug!("Found templates for descriptor {descriptor_to_match:?}: ");
|
||||
|
@ -141,6 +149,12 @@ impl FontCache {
|
|||
.font_data
|
||||
.entry(identifier)
|
||||
.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);
|
||||
}
|
||||
},
|
||||
|
@ -186,6 +200,7 @@ impl FontCache {
|
|||
});
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), fields(servo_profiling = true))]
|
||||
fn find_font_templates(
|
||||
&mut self,
|
||||
descriptor_to_match: Option<&FontDescriptor>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue