aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_traits/lib.rs
blob: bbcb1d612d8f6257f44ac3558499cbf090cf07cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#![feature(custom_derive, plugin)]
#![plugin(serde_macros)]

extern crate euclid;
extern crate gfx;
extern crate ipc_channel;
extern crate msg;
extern crate net_traits;
extern crate profile_traits;
extern crate script_traits;
extern crate serde;
extern crate url;
extern crate util;

// This module contains traits in layout used generically
//   in the rest of Servo.
// The traits are here instead of in layout so
//   that these modules won't have to depend on layout.

use gfx::font_cache_task::FontCacheTask;
use gfx::paint_task::LayoutToPaintMsg;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use net_traits::image_cache_task::ImageCacheTask;
use profile_traits::{mem, time};
use script_traits::{LayoutControlMsg, ConstellationControlMsg, OpaqueScriptLayoutChannel};
use url::Url;
use util::ipc::OptionalIpcSender;

/// A channel wrapper for constellation messages
#[derive(Clone, Deserialize, Serialize)]
pub struct LayoutControlChan(pub IpcSender<LayoutControlMsg>);

// A static method creating a layout task
// Here to remove the compositor -> layout dependency
pub trait LayoutTaskFactory {
    // FIXME: use a proper static method
    fn create(_phantom: Option<&mut Self>,
              id: PipelineId,
              url: Url,
              is_iframe: bool,
              chan: OpaqueScriptLayoutChannel,
              pipeline_port: IpcReceiver<LayoutControlMsg>,
              constellation_chan: ConstellationChan<ConstellationMsg>,
              failure_msg: Failure,
              script_chan: IpcSender<ConstellationControlMsg>,
              layout_to_paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
              image_cache_task: ImageCacheTask,
              font_cache_task: FontCacheTask,
              time_profiler_chan: time::ProfilerChan,
              mem_profiler_chan: mem::ProfilerChan,
              shutdown_chan: IpcSender<()>,
              content_process_shutdown_chan: IpcSender<()>);
}