aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2015-10-27 19:52:19 -0700
committerJosh Matthews <josh@joshmatthews.net>2015-11-12 14:30:25 -0500
commit1dc0d61c3cfbfbb856c970e9bb4e72f45837a457 (patch)
treeb17e1447f358096168067901340d9958835f543b /components/script/script_task.rs
parent4848e37e2e0da2f83b1d7f0d231d59047012ff95 (diff)
downloadservo-1dc0d61c3cfbfbb856c970e9bb4e72f45837a457.tar.gz
servo-1dc0d61c3cfbfbb856c970e9bb4e72f45837a457.zip
script: Make timer events e10s-safe.
Closes #8235.
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs24
1 files changed, 7 insertions, 17 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index a824c3fb3dd..855e3cc3dcd 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -83,7 +83,7 @@ use script_traits::CompositorEvent::{MouseDownEvent, MouseUpEvent, TouchEvent};
use script_traits::{CompositorEvent, ConstellationControlMsg};
use script_traits::{InitialScriptState, MouseButton, NewLayoutInfo};
use script_traits::{OpaqueScriptLayoutChannel, ScriptState, ScriptTaskFactory};
-use script_traits::{TimerEvent, TimerEventChan, TimerEventRequest, TimerSource};
+use script_traits::{TimerEvent, TimerEventRequest, TimerSource};
use script_traits::{TouchEventType, TouchId};
use std::any::Any;
use std::borrow::ToOwned;
@@ -353,20 +353,6 @@ impl MainThreadScriptChan {
}
}
-pub struct MainThreadTimerEventChan(Sender<TimerEvent>);
-
-impl TimerEventChan for MainThreadTimerEventChan {
- fn send(&self, event: TimerEvent) -> Result<(), ()> {
- let MainThreadTimerEventChan(ref chan) = *self;
- chan.send(event).map_err(|_| ())
- }
-
- fn clone(&self) -> Box<TimerEventChan + Send> {
- let MainThreadTimerEventChan(ref chan) = *self;
- box MainThreadTimerEventChan((*chan).clone())
- }
-}
-
pub struct StackRootTLS<'a>(PhantomData<&'a u32>);
impl<'a> StackRootTLS<'a> {
@@ -449,7 +435,7 @@ pub struct ScriptTask {
/// List of pipelines that have been owned and closed by this script task.
closed_pipelines: DOMRefCell<HashSet<PipelineId>>,
- scheduler_chan: Sender<TimerEventRequest>,
+ scheduler_chan: IpcSender<TimerEventRequest>,
timer_event_chan: Sender<TimerEvent>,
timer_event_port: Receiver<TimerEvent>,
}
@@ -1607,6 +1593,10 @@ impl ScriptTask {
let mut page_remover = AutoPageRemover::new(self, page_to_remove);
let MainThreadScriptChan(ref sender) = self.chan;
+ let (ipc_timer_event_chan, ipc_timer_event_port) = ipc::channel().unwrap();
+ ROUTER.route_ipc_receiver_to_mpsc_sender(ipc_timer_event_port,
+ self.timer_event_chan.clone());
+
// Create the window and document objects.
let window = Window::new(self.js_runtime.clone(),
page.clone(),
@@ -1620,7 +1610,7 @@ impl ScriptTask {
self.devtools_chan.clone(),
self.constellation_chan.clone(),
self.scheduler_chan.clone(),
- MainThreadTimerEventChan(self.timer_event_chan.clone()),
+ ipc_timer_event_chan,
incomplete.layout_chan,
incomplete.pipeline_id,
incomplete.parent_info,