aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-08-27 09:01:48 -0700
committerGitHub <noreply@github.com>2024-08-27 16:01:48 +0000
commit87027d2e5c02b51fea0cb49c1cd4ba4f85debd3a (patch)
tree595cefc0fab26791a1cbb83a3e125836d00fbf41
parent50eb69a7e0f9d70d9c395eadb03fb7bbe2ae6724 (diff)
downloadservo-87027d2e5c02b51fea0cb49c1cd4ba4f85debd3a.tar.gz
servo-87027d2e5c02b51fea0cb49c1cd4ba4f85debd3a.zip
Remove measurement of layout query wait time (#33210)
Now that the script thread and the layout thread are the same the wait time effectively zero, so there's no need to measure it. This also removes one dependency and removes one use of legacy time. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
-rw-r--r--Cargo.lock8
-rw-r--r--components/layout_thread/Cargo.toml2
-rw-r--r--components/layout_thread/lib.rs22
-rw-r--r--components/script/dom/window.rs7
-rw-r--r--components/shared/script_layout/lib.rs6
5 files changed, 5 insertions, 40 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 55dec8b8260..2485f5e2cc8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2852,12 +2852,6 @@ dependencies = [
]
[[package]]
-name = "histogram"
-version = "0.6.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12cb882ccb290b8646e554b157ab0b71e64e8d5bef775cd66b6531e52d302669"
-
-[[package]]
name = "home"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3766,7 +3760,6 @@ dependencies = [
"fonts",
"fonts_traits",
"fxhash",
- "histogram",
"ipc-channel",
"layout_2013",
"log",
@@ -3787,7 +3780,6 @@ dependencies = [
"servo_url",
"style",
"style_traits",
- "time 0.1.45",
"url",
"webrender_api",
"webrender_traits",
diff --git a/components/layout_thread/Cargo.toml b/components/layout_thread/Cargo.toml
index 517cae255fd..14d4b263d5f 100644
--- a/components/layout_thread/Cargo.toml
+++ b/components/layout_thread/Cargo.toml
@@ -20,7 +20,6 @@ fnv = { workspace = true }
fxhash = { workspace = true }
fonts = { path = "../fonts" }
fonts_traits = { workspace = true }
-histogram = "0.6.8"
ipc-channel = { workspace = true }
layout = { path = "../layout", package = "layout_2013" }
log = { workspace = true }
@@ -41,7 +40,6 @@ servo_config = { path = "../config" }
servo_url = { path = "../url" }
style = { workspace = true }
style_traits = { workspace = true }
-time = { workspace = true }
url = { workspace = true }
webrender_api = { workspace = true }
webrender_traits = { workspace = true }
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 786779077e7..4f677655bdc 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -27,7 +27,6 @@ use fonts::{
};
use fonts_traits::WebFontLoadFinishedCallback;
use fxhash::{FxHashMap, FxHashSet};
-use histogram::Histogram;
use ipc_channel::ipc::IpcSender;
use layout::construct::ConstructionResult;
use layout::context::{LayoutContext, RegisteredPainter, RegisteredPainters};
@@ -175,9 +174,6 @@ pub struct LayoutThread {
/// Paint time metrics.
paint_time_metrics: PaintTimeMetrics,
- /// The time a layout query has waited before serviced by layout.
- layout_query_waiting_time: Histogram,
-
/// The sizes of all iframes encountered during the last layout operation.
last_iframe_sizes: RefCell<FnvHashMap<BrowsingContextId, Size2D<f32, CSSPixel>>>,
@@ -470,15 +466,6 @@ impl Layout for LayoutThread {
// Drop the root flow explicitly to avoid holding style data, such as
// rule nodes. The `Stylist` checks when it is dropped that all rule
// nodes have been GCed, so we want drop anyone who holds them first.
- let waiting_time_min = self.layout_query_waiting_time.minimum().unwrap_or(0);
- let waiting_time_max = self.layout_query_waiting_time.maximum().unwrap_or(0);
- let waiting_time_mean = self.layout_query_waiting_time.mean().unwrap_or(0);
- let waiting_time_stddev = self.layout_query_waiting_time.stddev().unwrap_or(0);
- debug!(
- "layout: query waiting time: min: {}, max: {}, mean: {}, standard_deviation: {}",
- waiting_time_min, waiting_time_max, waiting_time_mean, waiting_time_stddev
- );
-
self.root_flow.borrow_mut().take();
}
@@ -625,7 +612,6 @@ impl LayoutThread {
scroll_offsets: Default::default(),
webrender_image_cache: Arc::new(RwLock::new(FnvHashMap::default())),
paint_time_metrics,
- layout_query_waiting_time: Histogram::new(),
last_iframe_sizes: Default::default(),
debug: opts::get().debug.clone(),
nonincremental_layout: opts::get().nonincremental_layout,
@@ -968,14 +954,6 @@ impl LayoutThread {
debug!("Number of objects in DOM: {}", data.dom_count);
debug!("layout: parallel? {}", self.parallel_flag);
- // Record the time that layout query has been waited.
- let now = time::precise_time_ns();
- if let ReflowGoal::LayoutQuery(_, timestamp) = data.reflow_goal {
- self.layout_query_waiting_time
- .increment(now - timestamp)
- .expect("layout: wrong layout query timestamp");
- };
-
let Some(root_element) = document.root_element() else {
debug!("layout: No root node: bailing");
return;
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 5e7e1f8988c..6f20bb64ace 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -2066,10 +2066,7 @@ impl Window {
}
pub fn layout_reflow(&self, query_msg: QueryMsg) -> bool {
- self.reflow(
- ReflowGoal::LayoutQuery(query_msg, time::precise_time_ns()),
- ReflowReason::Query,
- )
+ self.reflow(ReflowGoal::LayoutQuery(query_msg), ReflowReason::Query)
}
pub fn resolved_font_style_query(&self, node: &Node, value: String) -> Option<ServoArc<Font>> {
@@ -2732,7 +2729,7 @@ fn debug_reflow_events(id: PipelineId, reflow_goal: &ReflowGoal, reason: &Reflow
ReflowGoal::Full => "\tFull",
ReflowGoal::TickAnimations => "\tTickAnimations",
ReflowGoal::UpdateScrollNode(_) => "\tUpdateScrollNode",
- ReflowGoal::LayoutQuery(ref query_msg, _) => match *query_msg {
+ ReflowGoal::LayoutQuery(ref query_msg) => match *query_msg {
QueryMsg::ContentBox => "\tContentBoxQuery",
QueryMsg::ContentBoxes => "\tContentBoxesQuery",
QueryMsg::NodesFromPointQuery => "\tNodesFromPointQuery",
diff --git a/components/shared/script_layout/lib.rs b/components/shared/script_layout/lib.rs
index bb9099e8b45..4c43b2e859a 100644
--- a/components/shared/script_layout/lib.rs
+++ b/components/shared/script_layout/lib.rs
@@ -310,7 +310,7 @@ pub enum QueryMsg {
pub enum ReflowGoal {
Full,
TickAnimations,
- LayoutQuery(QueryMsg, u64),
+ LayoutQuery(QueryMsg),
/// Tells layout about a single new scrolling offset from the script. The rest will
/// remain untouched and layout won't forward this back to script.
@@ -323,7 +323,7 @@ impl ReflowGoal {
pub fn needs_display_list(&self) -> bool {
match *self {
ReflowGoal::Full | ReflowGoal::TickAnimations | ReflowGoal::UpdateScrollNode(_) => true,
- ReflowGoal::LayoutQuery(ref querymsg, _) => match *querymsg {
+ ReflowGoal::LayoutQuery(ref querymsg) => match *querymsg {
QueryMsg::ElementInnerTextQuery |
QueryMsg::InnerWindowDimensionsQuery |
QueryMsg::NodesFromPointQuery |
@@ -345,7 +345,7 @@ impl ReflowGoal {
pub fn needs_display(&self) -> bool {
match *self {
ReflowGoal::Full | ReflowGoal::TickAnimations | ReflowGoal::UpdateScrollNode(_) => true,
- ReflowGoal::LayoutQuery(ref querymsg, _) => match *querymsg {
+ ReflowGoal::LayoutQuery(ref querymsg) => match *querymsg {
QueryMsg::NodesFromPointQuery |
QueryMsg::TextIndexQuery |
QueryMsg::ElementInnerTextQuery => true,