Store a Sender<ConstellationControlMsg> in LayoutTask.

This commit is contained in:
Ms2ger 2015-08-12 15:55:16 +02:00
parent 4f9ec8915d
commit fdafc5c360
4 changed files with 11 additions and 13 deletions

View file

@ -351,7 +351,7 @@ impl PipelineContent {
self.pipeline_port.unwrap(), self.pipeline_port.unwrap(),
self.constellation_chan, self.constellation_chan,
self.failure, self.failure,
self.script_chan.clone(), self.script_chan.0.clone(),
self.layout_to_paint_chan.clone(), self.layout_to_paint_chan.clone(),
self.image_cache_task, self.image_cache_task,
self.font_cache_task, self.font_cache_task,

View file

@ -12,7 +12,7 @@ use gfx::display_list::OpaqueNode;
use layout_task::{LayoutTask, LayoutTaskData}; use layout_task::{LayoutTask, LayoutTaskData};
use msg::constellation_msg::{AnimationState, Msg, PipelineId}; use msg::constellation_msg::{AnimationState, Msg, PipelineId};
use script::layout_interface::Animation; use script::layout_interface::Animation;
use script_traits::{ConstellationControlMsg, ScriptControlChan}; use script_traits::ConstellationControlMsg;
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
use std::sync::Arc; use std::sync::Arc;
@ -128,7 +128,6 @@ pub fn recalc_style_for_animations(flow: &mut Flow,
pub fn tick_all_animations(layout_task: &LayoutTask, rw_data: &mut LayoutTaskData) { pub fn tick_all_animations(layout_task: &LayoutTask, rw_data: &mut LayoutTaskData) {
layout_task.tick_animations(rw_data); layout_task.tick_animations(rw_data);
let ScriptControlChan(ref chan) = layout_task.script_chan; layout_task.script_chan.send(ConstellationControlMsg::TickAllAnimations(layout_task.id)).unwrap();
chan.send(ConstellationControlMsg::TickAllAnimations(layout_task.id)).unwrap();
} }

View file

@ -59,7 +59,7 @@ use script::layout_interface::{LayoutChan, LayoutRPC, OffsetParentResponse};
use script::layout_interface::{NewLayoutTaskInfo, Msg, Reflow, ReflowGoal, ReflowQueryType}; use script::layout_interface::{NewLayoutTaskInfo, Msg, Reflow, ReflowGoal, ReflowQueryType};
use script::layout_interface::{ScriptLayoutChan, ScriptReflow, TrustedNodeAddress}; use script::layout_interface::{ScriptLayoutChan, ScriptReflow, TrustedNodeAddress};
use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel}; use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel};
use script_traits::{ScriptControlChan, StylesheetLoadResponder}; use script_traits::StylesheetLoadResponder;
use selectors::parser::PseudoElement; use selectors::parser::PseudoElement;
use serde_json; use serde_json;
use std::borrow::ToOwned; use std::borrow::ToOwned;
@ -186,7 +186,7 @@ pub struct LayoutTask {
pub constellation_chan: ConstellationChan, pub constellation_chan: ConstellationChan,
/// The channel on which messages can be sent to the script task. /// The channel on which messages can be sent to the script task.
pub script_chan: ScriptControlChan, pub script_chan: Sender<ConstellationControlMsg>,
/// The channel on which messages can be sent to the painting task. /// The channel on which messages can be sent to the painting task.
pub paint_chan: OptionalIpcSender<LayoutToPaintMsg>, pub paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
@ -228,7 +228,7 @@ impl LayoutTaskFactory for LayoutTask {
pipeline_port: IpcReceiver<LayoutControlMsg>, pipeline_port: IpcReceiver<LayoutControlMsg>,
constellation_chan: ConstellationChan, constellation_chan: ConstellationChan,
failure_msg: Failure, failure_msg: Failure,
script_chan: ScriptControlChan, script_chan: Sender<ConstellationControlMsg>,
paint_chan: OptionalIpcSender<LayoutToPaintMsg>, paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
image_cache_task: ImageCacheTask, image_cache_task: ImageCacheTask,
font_cache_task: FontCacheTask, font_cache_task: FontCacheTask,
@ -311,7 +311,7 @@ impl LayoutTask {
chan: LayoutChan, chan: LayoutChan,
pipeline_port: IpcReceiver<LayoutControlMsg>, pipeline_port: IpcReceiver<LayoutControlMsg>,
constellation_chan: ConstellationChan, constellation_chan: ConstellationChan,
script_chan: ScriptControlChan, script_chan: Sender<ConstellationControlMsg>,
paint_chan: OptionalIpcSender<LayoutToPaintMsg>, paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
image_cache_task: ImageCacheTask, image_cache_task: ImageCacheTask,
font_cache_task: FontCacheTask, font_cache_task: FontCacheTask,
@ -645,7 +645,7 @@ impl LayoutTask {
info.pipeline_port, info.pipeline_port,
info.constellation_chan, info.constellation_chan,
info.failure, info.failure,
ScriptControlChan(info.script_chan.clone()), info.script_chan.clone(),
*info.paint_chan *info.paint_chan
.downcast::<OptionalIpcSender<LayoutToPaintMsg>>() .downcast::<OptionalIpcSender<LayoutToPaintMsg>>()
.unwrap(), .unwrap(),
@ -726,8 +726,7 @@ impl LayoutTask {
Origin::Author); Origin::Author);
//TODO: mark critical subresources as blocking load as well (#5974) //TODO: mark critical subresources as blocking load as well (#5974)
let ScriptControlChan(ref chan) = self.script_chan; self.script_chan.send(ConstellationControlMsg::StylesheetLoadComplete(self.id, url, responder)).unwrap();
chan.send(ConstellationControlMsg::StylesheetLoadComplete(self.id, url, responder)).unwrap();
self.handle_add_stylesheet(sheet, mq, possibly_locked_rw_data); self.handle_add_stylesheet(sheet, mq, possibly_locked_rw_data);
} }

View file

@ -28,7 +28,7 @@ use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use profile_traits::mem; use profile_traits::mem;
use profile_traits::time; use profile_traits::time;
use net_traits::image_cache_task::ImageCacheTask; use net_traits::image_cache_task::ImageCacheTask;
use script_traits::{LayoutControlMsg, ScriptControlChan, OpaqueScriptLayoutChannel}; use script_traits::{LayoutControlMsg, ConstellationControlMsg, OpaqueScriptLayoutChannel};
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use url::Url; use url::Url;
use util::ipc::OptionalIpcSender; use util::ipc::OptionalIpcSender;
@ -49,7 +49,7 @@ pub trait LayoutTaskFactory {
pipeline_port: IpcReceiver<LayoutControlMsg>, pipeline_port: IpcReceiver<LayoutControlMsg>,
constellation_chan: ConstellationChan, constellation_chan: ConstellationChan,
failure_msg: Failure, failure_msg: Failure,
script_chan: ScriptControlChan, script_chan: Sender<ConstellationControlMsg>,
layout_to_paint_chan: OptionalIpcSender<LayoutToPaintMsg>, layout_to_paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
image_cache_task: ImageCacheTask, image_cache_task: ImageCacheTask,
font_cache_task: FontCacheTask, font_cache_task: FontCacheTask,