mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
added pipelines to all task sources
changed task sources to accept pipeline ids
This commit is contained in:
parent
2ffbe53989
commit
52b63def44
20 changed files with 194 additions and 230 deletions
|
@ -359,7 +359,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
#[allow(unsafe_code)]
|
||||
pub fn forward_error_to_worker_object(&self, error_info: ErrorInfo) {
|
||||
let worker = self.worker.borrow().as_ref().unwrap().clone();
|
||||
let pipeline_id = worker.clone().root().global().pipeline_id();
|
||||
let pipeline_id = self.upcast::<GlobalScope>().pipeline_id();
|
||||
let task = Box::new(task!(forward_error_to_worker_object: move || {
|
||||
let worker = worker.root();
|
||||
let global = worker.global();
|
||||
|
@ -406,7 +406,7 @@ impl DedicatedWorkerGlobalScopeMethods for DedicatedWorkerGlobalScope {
|
|||
unsafe fn PostMessage(&self, cx: *mut JSContext, message: HandleValue) -> ErrorResult {
|
||||
let data = StructuredCloneData::write(cx, message)?;
|
||||
let worker = self.worker.borrow().as_ref().unwrap().clone();
|
||||
let pipeline_id = worker.clone().root().global().pipeline_id();
|
||||
let pipeline_id = self.upcast::<GlobalScope>().pipeline_id();
|
||||
let task = Box::new(task!(post_worker_message: move || {
|
||||
Worker::handle_message(worker, data);
|
||||
}));
|
||||
|
|
|
@ -99,7 +99,7 @@ use hyper_serde::Serde;
|
|||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use js::jsapi::{JSContext, JSRuntime};
|
||||
use js::jsapi::JS_GetRuntime;
|
||||
use metrics::{InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory, ProgressiveWebMetric};
|
||||
use metrics::{InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory};
|
||||
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
|
||||
use msg::constellation_msg::{BrowsingContextId, Key, KeyModifiers, KeyState, TopLevelBrowsingContextId};
|
||||
use net_traits::{FetchResponseMsg, IpcSend, ReferrerPolicy};
|
||||
|
@ -1839,7 +1839,7 @@ impl Document {
|
|||
update_with_current_time_ms(&self.dom_content_loaded_event_end);
|
||||
|
||||
// html parsing has finished - set dom content loaded
|
||||
self.interactive_time.borrow().maybe_set_tti(self, None, InteractiveFlag::DCL);
|
||||
self.interactive_time.borrow().maybe_set_tti(self, InteractiveFlag::DOMContentLoaded);
|
||||
|
||||
// Step 4.2.
|
||||
// TODO: client message queue.
|
||||
|
@ -1927,7 +1927,7 @@ impl Document {
|
|||
self.interactive_time.borrow()
|
||||
}
|
||||
|
||||
pub fn is_interactive(&self) -> bool {
|
||||
pub fn has_recorded_tti_metric(&self) -> bool {
|
||||
self.get_interactive_metrics().get_tti().is_some()
|
||||
}
|
||||
|
||||
|
@ -1958,13 +1958,12 @@ impl Document {
|
|||
/// check tti for this document
|
||||
/// if it's been 10s since this doc encountered a task over 50ms, then we consider the
|
||||
/// main thread available and try to set tti
|
||||
pub fn check_tti(&self) {
|
||||
if self.is_interactive() { return; }
|
||||
pub fn record_tti_if_necessary(&self) {
|
||||
if self.has_recorded_tti_metric() { return; }
|
||||
|
||||
if self.tti_window.borrow().needs_check() {
|
||||
self.get_interactive_metrics().maybe_set_tti(self,
|
||||
Some(self.tti_window.borrow().get_start() as f64),
|
||||
InteractiveFlag::TTI);
|
||||
InteractiveFlag::TimeToInteractive(self.tti_window.borrow().get_start() as f64));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2177,8 +2176,7 @@ impl Document {
|
|||
(DocumentReadyState::Complete, true)
|
||||
};
|
||||
|
||||
let mut interactive_time = InteractiveMetrics::new(window.time_profiler_chan().clone());
|
||||
interactive_time.set_navigation_start(window.get_navigation_start());
|
||||
let interactive_time = InteractiveMetrics::new(window.time_profiler_chan().clone());
|
||||
|
||||
Document {
|
||||
node: Node::new_document_node(),
|
||||
|
|
|
@ -9,7 +9,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::globalscope::GlobalScope;
|
||||
use dom::performanceentry::PerformanceEntry;
|
||||
use dom_struct::dom_struct;
|
||||
use script_traits::PWMType;
|
||||
use script_traits::ProgressiveWebMetricType;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct PerformancePaintTiming {
|
||||
|
@ -17,10 +17,10 @@ pub struct PerformancePaintTiming {
|
|||
}
|
||||
|
||||
impl PerformancePaintTiming {
|
||||
fn new_inherited(metric_type: PWMType, start_time: f64) -> PerformancePaintTiming {
|
||||
fn new_inherited(metric_type: ProgressiveWebMetricType, start_time: f64) -> PerformancePaintTiming {
|
||||
let name = match metric_type {
|
||||
PWMType::FirstPaint => DOMString::from("first-paint"),
|
||||
PWMType::FirstContentfulPaint => DOMString::from("first-contentful-paint"),
|
||||
ProgressiveWebMetricType::FirstPaint => DOMString::from("first-paint"),
|
||||
ProgressiveWebMetricType::FirstContentfulPaint => DOMString::from("first-contentful-paint"),
|
||||
_ => DOMString::from(""),
|
||||
};
|
||||
PerformancePaintTiming {
|
||||
|
@ -33,7 +33,7 @@ impl PerformancePaintTiming {
|
|||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(global: &GlobalScope,
|
||||
metric_type: PWMType,
|
||||
metric_type: ProgressiveWebMetricType,
|
||||
start_time: f64) -> DomRoot<PerformancePaintTiming> {
|
||||
let entry = PerformancePaintTiming::new_inherited(metric_type, start_time);
|
||||
reflect_dom_object(Box::new(entry), global, PerformancePaintTimingBinding::Wrap)
|
||||
|
|
|
@ -494,6 +494,7 @@ impl VRDisplay {
|
|||
let address = Trusted::new(&*self);
|
||||
let near_init = self.depth_near.get();
|
||||
let far_init = self.depth_far.get();
|
||||
let pipeline_id = self.global().pipeline_id();
|
||||
|
||||
// The render loop at native headset frame rate is implemented using a dedicated thread.
|
||||
// Every loop iteration syncs pose data with the HMD, submits the pixels to the display and waits for Vsync.
|
||||
|
@ -505,7 +506,6 @@ impl VRDisplay {
|
|||
let (raf_sender, raf_receiver) = mpsc::channel();
|
||||
let mut near = near_init;
|
||||
let mut far = far_init;
|
||||
// let pipeline_id = self.global().pipeline_id().clone(); TODO
|
||||
|
||||
// Initialize compositor
|
||||
api_sender.send_vr(WebVRCommand::Create(display_id)).unwrap();
|
||||
|
@ -516,7 +516,7 @@ impl VRDisplay {
|
|||
let task = Box::new(task!(handle_vrdisplay_raf: move || {
|
||||
this.root().handle_raf(&sender);
|
||||
}));
|
||||
js_sender.send(CommonScriptMsg::Task(WebVREvent, task, None)).unwrap();
|
||||
js_sender.send(CommonScriptMsg::Task(WebVREvent, task, Some(pipeline_id))).unwrap();
|
||||
|
||||
// Run Sync Poses in parallell on Render thread
|
||||
let msg = WebVRCommand::SyncPoses(display_id, near, far, sync_sender.clone());
|
||||
|
|
|
@ -29,6 +29,7 @@ use ipc_channel::ipc::IpcSender;
|
|||
use js::jsapi::{HandleValue, JSAutoCompartment, JSContext, JSRuntime};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::panic::maybe_resume_unwind;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use net_traits::{IpcSend, load_whole_resource};
|
||||
use net_traits::request::{CredentialsMode, Destination, RequestInit as NetRequestInit, Type as RequestType};
|
||||
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, get_reports, Runtime};
|
||||
|
@ -165,6 +166,10 @@ impl WorkerGlobalScope {
|
|||
cancelled: self.closing.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pipeline_id(&self) -> PipelineId {
|
||||
self.globalscope.pipeline_id()
|
||||
}
|
||||
}
|
||||
|
||||
impl WorkerGlobalScopeMethods for WorkerGlobalScope {
|
||||
|
@ -364,15 +369,15 @@ impl WorkerGlobalScope {
|
|||
}
|
||||
|
||||
pub fn file_reading_task_source(&self) -> FileReadingTaskSource {
|
||||
FileReadingTaskSource(self.script_chan())
|
||||
FileReadingTaskSource(self.script_chan(), self.pipeline_id())
|
||||
}
|
||||
|
||||
pub fn networking_task_source(&self) -> NetworkingTaskSource {
|
||||
NetworkingTaskSource(self.script_chan())
|
||||
NetworkingTaskSource(self.script_chan(), self.pipeline_id())
|
||||
}
|
||||
|
||||
pub fn performance_timeline_task_source(&self) -> PerformanceTimelineTaskSource {
|
||||
PerformanceTimelineTaskSource(self.script_chan())
|
||||
PerformanceTimelineTaskSource(self.script_chan(), self.pipeline_id())
|
||||
}
|
||||
|
||||
pub fn new_script_pair(&self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) {
|
||||
|
|
|
@ -1285,7 +1285,7 @@ impl XMLHttpRequest {
|
|||
|
||||
let (task_source, script_port) = if self.sync.get() {
|
||||
let (tx, rx) = global.new_script_pair();
|
||||
(NetworkingTaskSource(tx), Some(rx))
|
||||
(NetworkingTaskSource(tx, global.pipeline_id()), Some(rx))
|
||||
} else {
|
||||
(global.networking_task_source(), None)
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue