mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Timers are scheduled by a dedicated per-constellation thread.
This commit is contained in:
parent
674589c370
commit
553a0dbefd
21 changed files with 786 additions and 334 deletions
|
@ -22,6 +22,8 @@ use msg::constellation_msg::{ConstellationChan, PipelineId, WorkerId};
|
|||
use net_traits::ResourceTask;
|
||||
use profile_traits::mem;
|
||||
use script_task::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptTask};
|
||||
use script_traits::TimerEventRequest;
|
||||
use std::sync::mpsc::Sender;
|
||||
use url::Url;
|
||||
use util::mem::HeapSizeOf;
|
||||
|
||||
|
@ -96,6 +98,14 @@ impl<'a> GlobalRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Get the scheduler channel to request timer events.
|
||||
pub fn scheduler_chan(&self) -> Sender<TimerEventRequest> {
|
||||
match *self {
|
||||
GlobalRef::Window(window) => window.scheduler_chan(),
|
||||
GlobalRef::Worker(worker) => worker.scheduler_chan(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Get an `IpcSender<ScriptToDevtoolsControlMsg>` to send messages to Devtools
|
||||
/// task when available.
|
||||
pub fn devtools_chan(&self) -> Option<IpcSender<ScriptToDevtoolsControlMsg>> {
|
||||
|
|
|
@ -37,6 +37,7 @@ use dom::bindings::js::{JS, Root};
|
|||
use dom::bindings::refcounted::Trusted;
|
||||
use dom::bindings::utils::{Reflectable, Reflector, WindowProxyHandler};
|
||||
use encoding::types::EncodingRef;
|
||||
use euclid::length::Length as EuclidLength;
|
||||
use euclid::matrix2d::Matrix2D;
|
||||
use euclid::rect::Rect;
|
||||
use euclid::size::Size2D;
|
||||
|
@ -58,7 +59,7 @@ use net_traits::storage_task::StorageType;
|
|||
use profile_traits::mem::ProfilerChan as MemProfilerChan;
|
||||
use profile_traits::time::ProfilerChan as TimeProfilerChan;
|
||||
use script_task::ScriptChan;
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
use script_traits::{TimerEventChan, TimerEventId, TimerSource, UntrustedNodeAddress};
|
||||
use selectors::parser::PseudoElement;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use smallvec::SmallVec;
|
||||
|
@ -283,6 +284,7 @@ no_jsmanaged_fields!(HashSet<T>);
|
|||
// These three are interdependent, if you plan to put jsmanaged data
|
||||
// in one of these make sure it is propagated properly to containing structs
|
||||
no_jsmanaged_fields!(SubpageId, WindowSizeData, PipelineId);
|
||||
no_jsmanaged_fields!(TimerEventId, TimerSource);
|
||||
no_jsmanaged_fields!(WorkerId);
|
||||
no_jsmanaged_fields!(QuirksMode);
|
||||
no_jsmanaged_fields!(Runtime);
|
||||
|
@ -293,6 +295,7 @@ no_jsmanaged_fields!(WindowProxyHandler);
|
|||
no_jsmanaged_fields!(UntrustedNodeAddress);
|
||||
no_jsmanaged_fields!(LengthOrPercentageOrAuto);
|
||||
no_jsmanaged_fields!(RGBA);
|
||||
no_jsmanaged_fields!(EuclidLength<Unit, T>);
|
||||
no_jsmanaged_fields!(Matrix2D<T>);
|
||||
no_jsmanaged_fields!(StorageType);
|
||||
no_jsmanaged_fields!(CanvasGradientStop, LinearGradientStyle, RadialGradientStyle);
|
||||
|
@ -311,6 +314,13 @@ impl JSTraceable for Box<ScriptChan + Send> {
|
|||
}
|
||||
}
|
||||
|
||||
impl JSTraceable for Box<TimerEventChan + Send> {
|
||||
#[inline]
|
||||
fn trace(&self, _trc: *mut JSTracer) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
impl JSTraceable for Box<FnBox(f64, )> {
|
||||
#[inline]
|
||||
fn trace(&self, _trc: *mut JSTracer) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue