mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #19779 - bholley:avoid_rule_debug_hooks, r=emilio
Avoid debug serialization of PropertyDeclaration & co in release builds In total, this PR saves ~60k. The conditional compilation on the _Debug FFI function eliminates one of the ToCss variants, eliminating 54.4k, as well as a bunch of other <1k functions. Removing the public trait implementation of Debug for the font metrics provider eliminates the last Debug impl from stylo. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19779) <!-- Reviewable:end -->
This commit is contained in:
commit
7de87c487b
2 changed files with 8 additions and 2 deletions
|
@ -12,7 +12,6 @@ use context::SharedStyleContext;
|
||||||
use logical_geometry::WritingMode;
|
use logical_geometry::WritingMode;
|
||||||
use media_queries::Device;
|
use media_queries::Device;
|
||||||
use properties::style_structs::Font;
|
use properties::style_structs::Font;
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
/// Represents the font metrics that style needs from a font to compute the
|
/// Represents the font metrics that style needs from a font to compute the
|
||||||
/// value of certain CSS units like `ex`.
|
/// value of certain CSS units like `ex`.
|
||||||
|
@ -35,7 +34,7 @@ pub enum FontMetricsQueryResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A trait used to represent something capable of providing us font metrics.
|
/// A trait used to represent something capable of providing us font metrics.
|
||||||
pub trait FontMetricsProvider: fmt::Debug {
|
pub trait FontMetricsProvider {
|
||||||
/// Obtain the metrics for given font family.
|
/// Obtain the metrics for given font family.
|
||||||
///
|
///
|
||||||
/// TODO: We could make this take the full list, I guess, and save a few
|
/// TODO: We could make this take the full list, I guess, and save a few
|
||||||
|
|
|
@ -1438,6 +1438,7 @@ macro_rules! impl_basic_rule_funcs_without_getter {
|
||||||
debug: $debug:ident,
|
debug: $debug:ident,
|
||||||
to_css: $to_css:ident,
|
to_css: $to_css:ident,
|
||||||
} => {
|
} => {
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn $debug(rule: &$raw_type, result: *mut nsACString) {
|
pub extern "C" fn $debug(rule: &$raw_type, result: *mut nsACString) {
|
||||||
read_locked_arc(rule, |rule: &$rule_type| {
|
read_locked_arc(rule, |rule: &$rule_type| {
|
||||||
|
@ -1445,6 +1446,12 @@ macro_rules! impl_basic_rule_funcs_without_getter {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn $debug(_: &$raw_type, _: *mut nsACString) {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn $to_css(rule: &$raw_type, result: *mut nsAString) {
|
pub extern "C" fn $to_css(rule: &$raw_type, result: *mut nsAString) {
|
||||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue