mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Add time profiling to ServoXMLParser::parse_sync
This commit is contained in:
parent
1f23810a34
commit
609299e1e4
3 changed files with 17 additions and 0 deletions
|
@ -138,6 +138,7 @@ impl Formattable for ProfilerCategory {
|
||||||
ProfilerCategory::ScriptInputEvent => "Script Input Event",
|
ProfilerCategory::ScriptInputEvent => "Script Input Event",
|
||||||
ProfilerCategory::ScriptNetworkEvent => "Script Network Event",
|
ProfilerCategory::ScriptNetworkEvent => "Script Network Event",
|
||||||
ProfilerCategory::ScriptParseHTML => "Script Parse HTML",
|
ProfilerCategory::ScriptParseHTML => "Script Parse HTML",
|
||||||
|
ProfilerCategory::ScriptParseXML => "Script Parse XML",
|
||||||
ProfilerCategory::ScriptPlannedNavigation => "Script Planned Navigation",
|
ProfilerCategory::ScriptPlannedNavigation => "Script Planned Navigation",
|
||||||
ProfilerCategory::ScriptResize => "Script Resize",
|
ProfilerCategory::ScriptResize => "Script Resize",
|
||||||
ProfilerCategory::ScriptEvent => "Script Event",
|
ProfilerCategory::ScriptEvent => "Script Event",
|
||||||
|
|
|
@ -83,6 +83,7 @@ pub enum ProfilerCategory {
|
||||||
ScriptWebSocketEvent = 0x73,
|
ScriptWebSocketEvent = 0x73,
|
||||||
ScriptWorkerEvent = 0x74,
|
ScriptWorkerEvent = 0x74,
|
||||||
ScriptServiceWorkerEvent = 0x75,
|
ScriptServiceWorkerEvent = 0x75,
|
||||||
|
ScriptParseXML = 0x76,
|
||||||
ApplicationHeartbeat = 0x90,
|
ApplicationHeartbeat = 0x90,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,15 @@ use dom::bindings::js::{JS, Root};
|
||||||
use dom::bindings::reflector::reflect_dom_object;
|
use dom::bindings::reflector::reflect_dom_object;
|
||||||
use dom::bindings::trace::JSTraceable;
|
use dom::bindings::trace::JSTraceable;
|
||||||
use dom::document::Document;
|
use dom::document::Document;
|
||||||
|
use dom::globalscope::GlobalScope;
|
||||||
use dom::node::Node;
|
use dom::node::Node;
|
||||||
use dom::servoparser::ServoParser;
|
use dom::servoparser::ServoParser;
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
use js::jsapi::JSTracer;
|
use js::jsapi::JSTracer;
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use parse::{Parser, ParserRef};
|
use parse::{Parser, ParserRef};
|
||||||
|
use profile_traits::time::{ProfilerCategory, TimerMetadata};
|
||||||
|
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType, profile};
|
||||||
use script_thread::ScriptThread;
|
use script_thread::ScriptThread;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -106,6 +109,18 @@ impl ServoXMLParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_sync(&self) {
|
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
|
// This parser will continue to parse while there is either pending input or
|
||||||
// the parser remains unsuspended.
|
// the parser remains unsuspended.
|
||||||
loop {
|
loop {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue