compositing: Make the constellation messages serializable.

This commit is contained in:
Patrick Walton 2015-07-10 11:16:27 -07:00
parent a0cf597946
commit b6485a9eaf
32 changed files with 316 additions and 229 deletions

View file

@ -48,6 +48,7 @@ git = "https://github.com/servo/rust-layers"
[dependencies.png]
git = "https://github.com/servo/rust-png"
features = [ "serde-serialization" ]
[dependencies.clipboard]
git = "https://github.com/aweinstock314/rust-clipboard"
@ -58,7 +59,7 @@ git = "https://github.com/pcwalton/ipc-channel"
[dependencies]
log = "*"
num = "0.1.24"
url = "0.2.35"
url = "0.2.36"
time = "0.1.17"
libc = "*"
gleam = "0.1"

View file

@ -13,7 +13,7 @@ use windowing::{WindowEvent, WindowMethods};
use euclid::point::Point2D;
use euclid::rect::Rect;
use ipc_channel::ipc::IpcReceiver;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use layers::platform::surface::NativeDisplay;
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
use msg::compositor_msg::{Epoch, LayerId, LayerProperties, FrameTreeId};
@ -183,7 +183,7 @@ pub enum Msg {
/// Changes the cursor.
SetCursor(Cursor),
/// Composite to a PNG file and return the Image over a passed channel.
CreatePng(Sender<Option<png::Image>>),
CreatePng(IpcSender<Option<png::Image>>),
/// Informs the compositor that the paint task for the given pipeline has exited.
PaintTaskExited(PipelineId),
/// Alerts the compositor that the viewport has been constrained in some manner

View file

@ -19,7 +19,7 @@ use euclid::rect::{Rect, TypedRect};
use euclid::size::Size2D;
use euclid::scale_factor::ScaleFactor;
use gfx::font_cache_task::FontCacheTask;
use ipc_channel::ipc;
use ipc_channel::ipc::{self, IpcSender};
use layout_traits::{LayoutControlChan, LayoutTaskFactory};
use libc;
use msg::compositor_msg::{Epoch, LayerId};
@ -44,7 +44,7 @@ use std::collections::HashMap;
use std::io::{self, Write};
use std::marker::PhantomData;
use std::mem::replace;
use std::sync::mpsc::{Sender, Receiver, channel};
use std::sync::mpsc::{Receiver, channel};
use style::viewport::ViewportConstraints;
use url::Url;
use util::cursor::Cursor;
@ -191,7 +191,7 @@ pub struct SendableFrameTree {
}
struct WebDriverData {
load_channel: Option<(PipelineId, Sender<webdriver_msg::LoadStatus>)>
load_channel: Option<(PipelineId, IpcSender<webdriver_msg::LoadStatus>)>
}
impl WebDriverData {
@ -849,7 +849,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
fn handle_get_pipeline(&mut self, frame_id: Option<FrameId>,
resp_chan: Sender<Option<PipelineId>>) {
resp_chan: IpcSender<Option<PipelineId>>) {
let current_pipeline_id = frame_id.or(self.root_frame_id).map(|frame_id| {
let frame = self.frames.get(&frame_id).unwrap();
frame.current
@ -863,7 +863,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
fn handle_get_frame(&mut self,
containing_pipeline_id: PipelineId,
subpage_id: SubpageId,
resp_chan: Sender<Option<FrameId>>) {
resp_chan: IpcSender<Option<FrameId>>) {
let frame_id = self.subpage_map.get(&(containing_pipeline_id, subpage_id)).and_then(
|x| self.pipeline_to_frame_map.get(&x)).map(|x| *x);
resp_chan.send(frame_id).unwrap();