diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-01-01 14:31:51 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-01-01 14:31:51 +0530 |
commit | b8e7cd71d6aada507a7eab1ddad44181b0d2d029 (patch) | |
tree | 6297cd0576b99ac8de31f06edee8b4a8c6d30656 /components/script/dom/window.rs | |
parent | 61314f5253ec4ef53fce2bb6846c1592bcff86a3 (diff) | |
parent | f478194736100ab1284e7e47ecfbe36a31bd6630 (diff) | |
download | servo-b8e7cd71d6aada507a7eab1ddad44181b0d2d029.tar.gz servo-b8e7cd71d6aada507a7eab1ddad44181b0d2d029.zip |
Auto merge of #8871 - KiChjang:task-source-channels, r=KiChjang
Add 5 different task source channels
This is **not** complete. I really need feedback right away since I felt that the direction I'm heading is very wrong.
Partial #7959.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8871)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r-- | components/script/dom/window.rs | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 5651519318f..c373fc7eb38 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -55,8 +55,9 @@ use page::Page; use profile_traits::mem; use reporter::CSSErrorReporter; use rustc_serialize::base64::{FromBase64, STANDARD, ToBase64}; -use script_task::{ScriptChan, ScriptPort, MainThreadScriptMsg, RunnableWrapper}; -use script_task::{SendableMainThreadScriptChan, MainThreadScriptChan}; +use script_task::{DOMManipulationTaskSource, UserInteractionTaskSource, NetworkingTaskSource}; +use script_task::{HistoryTraversalTaskSource, FileReadingTaskSource, SendableMainThreadScriptChan}; +use script_task::{ScriptChan, ScriptPort, MainThreadScriptChan, MainThreadScriptMsg, RunnableWrapper}; use script_traits::ScriptMsg as ConstellationMsg; use script_traits::{MsDuration, ScriptToCompositorMsg, TimerEvent, TimerEventId, TimerEventRequest, TimerSource}; use selectors::parser::PseudoElement; @@ -115,6 +116,16 @@ pub struct Window { eventtarget: EventTarget, #[ignore_heap_size_of = "trait objects are hard"] script_chan: MainThreadScriptChan, + #[ignore_heap_size_of = "task sources are hard"] + dom_manipulation_task_source: DOMManipulationTaskSource, + #[ignore_heap_size_of = "task sources are hard"] + user_interaction_task_source: UserInteractionTaskSource, + #[ignore_heap_size_of = "task sources are hard"] + networking_task_source: NetworkingTaskSource, + #[ignore_heap_size_of = "task sources are hard"] + history_traversal_task_source: HistoryTraversalTaskSource, + #[ignore_heap_size_of = "task sources are hard"] + file_reading_task_source: FileReadingTaskSource, console: MutNullableHeap<JS<Console>>, crypto: MutNullableHeap<JS<Crypto>>, navigator: MutNullableHeap<JS<Navigator>>, @@ -239,28 +250,23 @@ impl Window { } pub fn dom_manipulation_task_source(&self) -> Box<ScriptChan + Send> { - // FIXME: Use a different channel instead of the generic script_chan - self.script_chan.clone() + self.dom_manipulation_task_source.clone() } pub fn user_interaction_task_source(&self) -> Box<ScriptChan + Send> { - // FIXME: Use a different channel instead of the generic script_chan - self.script_chan.clone() + self.user_interaction_task_source.clone() } pub fn networking_task_source(&self) -> Box<ScriptChan + Send> { - // FIXME: Use a different channel instead of the generic script_chan - self.script_chan.clone() + self.networking_task_source.clone() } pub fn history_traversal_task_source(&self) -> Box<ScriptChan + Send> { - // FIXME: Use a different channel instead of the generic script_chan - self.script_chan.clone() + self.history_traversal_task_source.clone() } pub fn file_reading_task_source(&self) -> Box<ScriptChan + Send> { - // FIXME: Use a different channel instead of the generic script_chan - self.script_chan.clone() + self.file_reading_task_source.clone() } pub fn main_thread_script_chan(&self) -> &Sender<MainThreadScriptMsg> { @@ -1284,6 +1290,11 @@ impl Window { pub fn new(runtime: Rc<Runtime>, page: Rc<Page>, script_chan: MainThreadScriptChan, + dom_task_source: DOMManipulationTaskSource, + user_task_source: UserInteractionTaskSource, + network_task_source: NetworkingTaskSource, + history_task_source: HistoryTraversalTaskSource, + file_task_source: FileReadingTaskSource, image_cache_chan: ImageCacheChan, compositor: IpcSender<ScriptToCompositorMsg>, image_cache_task: ImageCacheTask, @@ -1309,6 +1320,11 @@ impl Window { let win = box Window { eventtarget: EventTarget::new_inherited(), script_chan: script_chan, + dom_manipulation_task_source: dom_task_source, + user_interaction_task_source: user_task_source, + networking_task_source: network_task_source, + history_traversal_task_source: history_task_source, + file_reading_task_source: file_task_source, image_cache_chan: image_cache_chan, console: Default::default(), crypto: Default::default(), |