mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Auto merge of #20307 - csmoe:measure_query_time, r=jdm
Measure time required before a layout query is serviced by the layout thread <!-- Please describe your changes on the following line: --> - [X] extract QueryMsg from ReflowGoal - [X] introduce QueryMsg timestamp --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [x] These changes fix #19795 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/20307) <!-- Reviewable:end -->
This commit is contained in:
commit
4b8416fafb
8 changed files with 218 additions and 156 deletions
|
@ -20,6 +20,7 @@ html5ever = "0.22"
|
|||
ipc-channel = "0.10"
|
||||
libc = "0.2"
|
||||
log = "0.3.5"
|
||||
time = "0.1.17"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
metrics = {path = "../metrics"}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use {OpaqueStyleAndLayoutData, TrustedNodeAddress, PendingImage};
|
||||
use {OpaqueStyleAndLayoutData, PendingImage, TrustedNodeAddress};
|
||||
use app_units::Au;
|
||||
use euclid::{Point2D, Rect};
|
||||
use gfx_traits::Epoch;
|
||||
|
@ -106,11 +106,8 @@ pub enum NodesFromPointQueryType {
|
|||
Topmost,
|
||||
}
|
||||
|
||||
/// Any query to perform with this reflow.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum ReflowGoal {
|
||||
Full,
|
||||
TickAnimations,
|
||||
pub enum QueryMsg {
|
||||
ContentBoxQuery(TrustedNodeAddress),
|
||||
ContentBoxesQuery(TrustedNodeAddress),
|
||||
NodeScrollIdQuery(TrustedNodeAddress),
|
||||
|
@ -124,19 +121,33 @@ pub enum ReflowGoal {
|
|||
ElementInnerTextQuery(TrustedNodeAddress),
|
||||
}
|
||||
|
||||
/// Any query to perform with this reflow.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum ReflowGoal {
|
||||
Full,
|
||||
TickAnimations,
|
||||
LayoutQuery(QueryMsg, u64),
|
||||
}
|
||||
|
||||
impl ReflowGoal {
|
||||
/// Returns true if the given ReflowQuery needs a full, up-to-date display list to
|
||||
/// be present or false if it only needs stacking-relative positions.
|
||||
pub fn needs_display_list(&self) -> bool {
|
||||
match *self {
|
||||
ReflowGoal::NodesFromPointQuery(..) | ReflowGoal::TextIndexQuery(..) |
|
||||
ReflowGoal::TickAnimations | ReflowGoal::ElementInnerTextQuery(_) |
|
||||
ReflowGoal::Full => true,
|
||||
ReflowGoal::ContentBoxQuery(_) | ReflowGoal::ContentBoxesQuery(_) |
|
||||
ReflowGoal::NodeGeometryQuery(_) | ReflowGoal::NodeScrollGeometryQuery(_) |
|
||||
ReflowGoal::NodeScrollIdQuery(_) |
|
||||
ReflowGoal::ResolvedStyleQuery(..) | ReflowGoal::OffsetParentQuery(_) |
|
||||
ReflowGoal::StyleQuery(_) => false,
|
||||
ReflowGoal::Full | ReflowGoal::TickAnimations => true,
|
||||
ReflowGoal::LayoutQuery(ref querymsg, _) => match querymsg {
|
||||
&QueryMsg::NodesFromPointQuery(..) |
|
||||
&QueryMsg::TextIndexQuery(..) |
|
||||
&QueryMsg::ElementInnerTextQuery(_) => true,
|
||||
&QueryMsg::ContentBoxQuery(_) |
|
||||
&QueryMsg::ContentBoxesQuery(_) |
|
||||
&QueryMsg::NodeGeometryQuery(_) |
|
||||
&QueryMsg::NodeScrollGeometryQuery(_) |
|
||||
&QueryMsg::NodeScrollIdQuery(_) |
|
||||
&QueryMsg::ResolvedStyleQuery(..) |
|
||||
&QueryMsg::OffsetParentQuery(_) |
|
||||
&QueryMsg::StyleQuery(_) => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,14 +155,20 @@ impl ReflowGoal {
|
|||
/// false if a layout_thread display list is sufficient.
|
||||
pub fn needs_display(&self) -> bool {
|
||||
match *self {
|
||||
ReflowGoal::StyleQuery(_) | ReflowGoal::TextIndexQuery(..) |
|
||||
ReflowGoal::ContentBoxQuery(_) | ReflowGoal::ContentBoxesQuery(_) |
|
||||
ReflowGoal::NodeGeometryQuery(_) | ReflowGoal::NodeScrollGeometryQuery(_) |
|
||||
ReflowGoal::NodeScrollIdQuery(_) | ReflowGoal::ResolvedStyleQuery(..) |
|
||||
ReflowGoal::OffsetParentQuery(_) => false,
|
||||
ReflowGoal::NodesFromPointQuery(..) | ReflowGoal::Full |
|
||||
ReflowGoal::ElementInnerTextQuery(_) |
|
||||
ReflowGoal::TickAnimations => true,
|
||||
ReflowGoal::Full | ReflowGoal::TickAnimations => true,
|
||||
ReflowGoal::LayoutQuery(ref querymsg, _) => match querymsg {
|
||||
&QueryMsg::NodesFromPointQuery(..) |
|
||||
&QueryMsg::TextIndexQuery(..) |
|
||||
&QueryMsg::ElementInnerTextQuery(_) => true,
|
||||
&QueryMsg::ContentBoxQuery(_) |
|
||||
&QueryMsg::ContentBoxesQuery(_) |
|
||||
&QueryMsg::NodeGeometryQuery(_) |
|
||||
&QueryMsg::NodeScrollGeometryQuery(_) |
|
||||
&QueryMsg::NodeScrollIdQuery(_) |
|
||||
&QueryMsg::ResolvedStyleQuery(..) |
|
||||
&QueryMsg::OffsetParentQuery(_) |
|
||||
&QueryMsg::StyleQuery(_) => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue