mirror of
https://github.com/servo/servo.git
synced 2025-06-20 07:08:59 +01:00
Terminate timer scheduler thread during shutdown
This commit is contained in:
parent
6a795f4795
commit
fb878f33d1
8 changed files with 47 additions and 23 deletions
|
@ -37,7 +37,7 @@ use profile_traits::{mem, time};
|
|||
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
|
||||
use script_thread::{MainThreadScriptChan, RunnableWrapper, ScriptThread};
|
||||
use script_traits::{MsDuration, ScriptMsg as ConstellationMsg, TimerEvent};
|
||||
use script_traits::{TimerEventId, TimerEventRequest, TimerSource};
|
||||
use script_traits::{TimerEventId, TimerSchedulerMsg, TimerSource};
|
||||
use servo_url::ServoUrl;
|
||||
use std::cell::Cell;
|
||||
use std::collections::HashMap;
|
||||
|
@ -82,7 +82,7 @@ pub struct GlobalScope {
|
|||
constellation_chan: IpcSender<ConstellationMsg>,
|
||||
|
||||
#[ignore_heap_size_of = "channels are hard"]
|
||||
scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#in-error-reporting-mode
|
||||
in_error_reporting_mode: Cell<bool>,
|
||||
|
@ -101,7 +101,7 @@ impl GlobalScope {
|
|||
mem_profiler_chan: mem::ProfilerChan,
|
||||
time_profiler_chan: time::ProfilerChan,
|
||||
constellation_chan: IpcSender<ConstellationMsg>,
|
||||
scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||
resource_threads: ResourceThreads,
|
||||
timer_event_chan: IpcSender<TimerEvent>)
|
||||
-> Self {
|
||||
|
@ -229,7 +229,7 @@ impl GlobalScope {
|
|||
&self.constellation_chan
|
||||
}
|
||||
|
||||
pub fn scheduler_chan(&self) -> &IpcSender<TimerEventRequest> {
|
||||
pub fn scheduler_chan(&self) -> &IpcSender<TimerSchedulerMsg> {
|
||||
&self.scheduler_chan
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable, Runnabl
|
|||
use script_thread::{SendableMainThreadScriptChan, ImageCacheMsg};
|
||||
use script_traits::{ConstellationControlMsg, LoadData, MozBrowserEvent, UntrustedNodeAddress};
|
||||
use script_traits::{DocumentState, TimerEvent, TimerEventId};
|
||||
use script_traits::{ScriptMsg as ConstellationMsg, TimerEventRequest, WindowSizeData, WindowSizeType};
|
||||
use script_traits::{ScriptMsg as ConstellationMsg, TimerSchedulerMsg, WindowSizeData, WindowSizeType};
|
||||
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
||||
use servo_atoms::Atom;
|
||||
use servo_config::opts;
|
||||
|
@ -1711,7 +1711,7 @@ impl Window {
|
|||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||
constellation_chan: IpcSender<ConstellationMsg>,
|
||||
control_chan: IpcSender<ConstellationControlMsg>,
|
||||
scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||
timer_event_chan: IpcSender<TimerEvent>,
|
||||
layout_chan: Sender<Msg>,
|
||||
id: PipelineId,
|
||||
|
|
|
@ -86,7 +86,7 @@ use script_traits::{CompositorEvent, ConstellationControlMsg};
|
|||
use script_traits::{DocumentActivity, DiscardBrowsingContext, EventResult};
|
||||
use script_traits::{InitialScriptState, LayoutMsg, LoadData, MouseButton, MouseEventType, MozBrowserEvent};
|
||||
use script_traits::{NewLayoutInfo, ScriptMsg as ConstellationMsg};
|
||||
use script_traits::{ScriptThreadFactory, TimerEvent, TimerEventRequest, TimerSource};
|
||||
use script_traits::{ScriptThreadFactory, TimerEvent, TimerSchedulerMsg, TimerSource};
|
||||
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress, WindowSizeData, WindowSizeType};
|
||||
use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent};
|
||||
use script_traits::CompositorEvent::{TouchEvent, TouchpadPressureEvent};
|
||||
|
@ -472,7 +472,7 @@ pub struct ScriptThread {
|
|||
/// List of pipelines that have been owned and closed by this script thread.
|
||||
closed_pipelines: DOMRefCell<HashSet<PipelineId>>,
|
||||
|
||||
scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||
timer_event_chan: Sender<TimerEvent>,
|
||||
timer_event_port: Receiver<TimerEvent>,
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@ use ipc_channel::ipc::IpcSender;
|
|||
use js::jsapi::{HandleValue, Heap};
|
||||
use js::jsval::{JSVal, UndefinedValue};
|
||||
use script_traits::{MsDuration, precise_time_ms};
|
||||
use script_traits::{TimerEvent, TimerEventId, TimerEventRequest, TimerSource};
|
||||
use script_traits::{TimerEvent, TimerEventId, TimerEventRequest};
|
||||
use script_traits::{TimerSchedulerMsg, TimerSource};
|
||||
use servo_config::prefs::PREFS;
|
||||
use std::cell::Cell;
|
||||
use std::cmp::{self, Ord, Ordering};
|
||||
|
@ -35,7 +36,7 @@ pub struct OneshotTimers {
|
|||
#[ignore_heap_size_of = "Defined in std"]
|
||||
timer_event_chan: IpcSender<TimerEvent>,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||
next_timer_handle: Cell<OneshotTimerHandle>,
|
||||
timers: DOMRefCell<Vec<OneshotTimer>>,
|
||||
suspended_since: Cell<Option<MsDuration>>,
|
||||
|
@ -109,7 +110,7 @@ impl PartialEq for OneshotTimer {
|
|||
|
||||
impl OneshotTimers {
|
||||
pub fn new(timer_event_chan: IpcSender<TimerEvent>,
|
||||
scheduler_chan: IpcSender<TimerEventRequest>)
|
||||
scheduler_chan: IpcSender<TimerSchedulerMsg>)
|
||||
-> OneshotTimers {
|
||||
OneshotTimers {
|
||||
js_timers: JsTimers::new(),
|
||||
|
@ -267,7 +268,7 @@ impl OneshotTimers {
|
|||
let delay = Length::new(timer.scheduled_for.get().saturating_sub(precise_time_ms().get()));
|
||||
let request = TimerEventRequest(self.timer_event_chan.clone(), timer.source,
|
||||
expected_event_id, delay);
|
||||
self.scheduler_chan.send(request).unwrap();
|
||||
self.scheduler_chan.send(TimerSchedulerMsg::Request(request)).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue