aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/servoxmlparser.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2016-10-09 00:19:09 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2016-10-11 15:03:25 +0200
commit609299e1e45e93939f75f8439fc7ac3276ca5881 (patch)
treea5babcda579378059474b77f29e95410ab710221 /components/script/dom/servoxmlparser.rs
parent1f23810a341612e5293e37829f68c72491dafb04 (diff)
downloadservo-609299e1e45e93939f75f8439fc7ac3276ca5881.tar.gz
servo-609299e1e45e93939f75f8439fc7ac3276ca5881.zip
Add time profiling to ServoXMLParser::parse_sync
Diffstat (limited to 'components/script/dom/servoxmlparser.rs')
-rw-r--r--components/script/dom/servoxmlparser.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/components/script/dom/servoxmlparser.rs b/components/script/dom/servoxmlparser.rs
index 119dd8f4b47..919dcfdb946 100644
--- a/components/script/dom/servoxmlparser.rs
+++ b/components/script/dom/servoxmlparser.rs
@@ -9,12 +9,15 @@ use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::trace::JSTraceable;
use dom::document::Document;
+use dom::globalscope::GlobalScope;
use dom::node::Node;
use dom::servoparser::ServoParser;
use dom::window::Window;
use js::jsapi::JSTracer;
use msg::constellation_msg::PipelineId;
use parse::{Parser, ParserRef};
+use profile_traits::time::{ProfilerCategory, TimerMetadata};
+use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType, profile};
use script_thread::ScriptThread;
use std::cell::Cell;
use url::Url;
@@ -106,6 +109,18 @@ impl ServoXMLParser {
}
pub fn parse_sync(&self) {
+ let metadata = TimerMetadata {
+ url: self.upcast().document().url().as_str().into(),
+ iframe: TimerMetadataFrameType::RootWindow,
+ incremental: TimerMetadataReflowType::FirstReflow,
+ };
+ profile(ProfilerCategory::ScriptParseXML,
+ Some(metadata),
+ self.upcast().document().window().upcast::<GlobalScope>().time_profiler_chan().clone(),
+ || self.do_parse_sync())
+ }
+
+ fn do_parse_sync(&self) {
// This parser will continue to parse while there is either pending input or
// the parser remains unsuspended.
loop {