introduce layout query timestamp

This commit is contained in:
csmoe 2018-03-17 00:40:13 +08:00
parent df6b64181b
commit 98fe118be4
9 changed files with 50 additions and 8 deletions

View file

@ -24,6 +24,7 @@ use style::context::QuirksMode;
use style::properties::PropertyId;
use style::selector_parser::PseudoElement;
use style::stylesheets::Stylesheet;
use time;
/// Asynchronous messages that script can send to layout.
pub enum Msg {
@ -171,6 +172,26 @@ impl ReflowGoal {
},
}
}
/// Set the timestamp of query message.
pub fn set_timestamp(&mut self) {
match *self {
ReflowGoal::LayoutQuery(_, ref mut timestamp) => {
*timestamp = time::precise_time_ns();
},
_ => (),
}
}
/// Get the query timestamp.
pub fn timestamp(&self) -> Option<u64> {
match *self {
ReflowGoal::LayoutQuery(_, ref timestamp) => {
Some(*timestamp)
},
_ => None,
}
}
}
/// Information needed for a reflow.