aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_layout_interface
diff options
context:
space:
mode:
Diffstat (limited to 'components/script_layout_interface')
-rw-r--r--components/script_layout_interface/Cargo.toml1
-rw-r--r--components/script_layout_interface/lib.rs1
-rw-r--r--components/script_layout_interface/message.rs21
3 files changed, 23 insertions, 0 deletions
diff --git a/components/script_layout_interface/Cargo.toml b/components/script_layout_interface/Cargo.toml
index caddb62a1de..18fb45385b8 100644
--- a/components/script_layout_interface/Cargo.toml
+++ b/components/script_layout_interface/Cargo.toml
@@ -20,6 +20,7 @@ html5ever = "0.22"
ipc-channel = "0.9"
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"}
diff --git a/components/script_layout_interface/lib.rs b/components/script_layout_interface/lib.rs
index dc2c6f515a7..289dd7c0c8b 100644
--- a/components/script_layout_interface/lib.rs
+++ b/components/script_layout_interface/lib.rs
@@ -33,6 +33,7 @@ extern crate servo_arc;
extern crate servo_atoms;
extern crate servo_url;
extern crate style;
+extern crate time;
extern crate webrender_api;
pub mod message;
diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs
index ac52d9373ce..8a8b1f8b0d0 100644
--- a/components/script_layout_interface/message.rs
+++ b/components/script_layout_interface/message.rs
@@ -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.