Use associated types to improve LayoutThreadFactory and ScriptThreadFactory.

This commit is contained in:
Ms2ger 2016-05-24 17:50:06 +02:00
parent cd1396fa9a
commit 49d244d39c
8 changed files with 47 additions and 78 deletions

View file

@ -30,7 +30,8 @@ use msg::constellation_msg::{PanicMsg, PipelineId, PipelineNamespaceId, Pipeline
use net_traits::image_cache_thread::ImageCacheThread;
use profile_traits::{mem, time};
use script_traits::LayoutMsg as ConstellationMsg;
use script_traits::{LayoutControlMsg, ConstellationControlMsg, OpaqueScriptLayoutChannel};
use script_traits::{LayoutControlMsg, ConstellationControlMsg};
use std::sync::mpsc::{Sender, Receiver};
use url::Url;
use util::ipc::OptionalIpcSender;
@ -41,10 +42,11 @@ pub struct LayoutControlChan(pub IpcSender<LayoutControlMsg>);
// A static method creating a layout thread
// Here to remove the compositor -> layout dependency
pub trait LayoutThreadFactory {
type Message;
fn create(id: PipelineId,
url: Url,
is_iframe: bool,
chan: OpaqueScriptLayoutChannel,
chan: (Sender<Self::Message>, Receiver<Self::Message>),
pipeline_port: IpcReceiver<LayoutControlMsg>,
constellation_chan: IpcSender<ConstellationMsg>,
panic_chan: IpcSender<PanicMsg>,