Auto merge of #8898 - vwvww:compositor_msg_refactor, r=Ms2ger

Moved CompositorMsg enum into compositing crate.

moved CompositorMsg enum into compositing crate.
moved from components/msg/constellation_msg.rs
            to components/compositing/lib.rs
fixes #8832

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8898)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-12-11 12:02:52 +05:30
commit 4e73a30b00
11 changed files with 47 additions and 35 deletions

View file

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use CompositorMsg as ConstellationMsg;
use app_units::Au; use app_units::Au;
use compositor_layer::{CompositorData, CompositorLayer, RcCompositorLayer, WantsScrollEventsFlag}; use compositor_layer::{CompositorData, CompositorLayer, RcCompositorLayer, WantsScrollEventsFlag};
use compositor_task::{CompositorEventListener, CompositorProxy}; use compositor_task::{CompositorEventListener, CompositorProxy};
@ -28,7 +29,6 @@ use layers::scene::Scene;
use layout_traits::LayoutControlChan; use layout_traits::LayoutControlChan;
use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerKind}; use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerKind};
use msg::compositor_msg::{LayerProperties, ScrollPolicy}; use msg::compositor_msg::{LayerProperties, ScrollPolicy};
use msg::constellation_msg::CompositorMsg as ConstellationMsg;
use msg::constellation_msg::{AnimationState, Image, PixelFormat}; use msg::constellation_msg::{AnimationState, Image, PixelFormat};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, MouseButton}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, MouseButton};
use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData}; use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData};

View file

@ -4,6 +4,7 @@
//! Communication with the compositor task. //! Communication with the compositor task.
use CompositorMsg as ConstellationMsg;
use compositor; use compositor;
use euclid::point::Point2D; use euclid::point::Point2D;
use euclid::size::Size2D; use euclid::size::Size2D;
@ -13,7 +14,6 @@ use layers::layers::{BufferRequest, LayerBufferSet};
use layers::platform::surface::{NativeDisplay, NativeSurface}; use layers::platform::surface::{NativeDisplay, NativeSurface};
use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerProperties}; use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerProperties};
use msg::compositor_msg::{PaintListener, ScriptToCompositorMsg}; use msg::compositor_msg::{PaintListener, ScriptToCompositorMsg};
use msg::constellation_msg::CompositorMsg as ConstellationMsg;
use msg::constellation_msg::{AnimationState, PipelineId}; use msg::constellation_msg::{AnimationState, PipelineId};
use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState}; use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState};
use profile_traits::mem; use profile_traits::mem;

View file

@ -9,6 +9,7 @@
//! navigation context, each `Pipeline` encompassing a `ScriptTask`, //! navigation context, each `Pipeline` encompassing a `ScriptTask`,
//! `LayoutTask`, and `PaintTask`. //! `LayoutTask`, and `PaintTask`.
use CompositorMsg as FromCompositorMsg;
use canvas::canvas_paint_task::CanvasPaintTask; use canvas::canvas_paint_task::CanvasPaintTask;
use canvas::webgl_paint_task::WebGLPaintTask; use canvas::webgl_paint_task::WebGLPaintTask;
use canvas_traits::CanvasMsg; use canvas_traits::CanvasMsg;
@ -26,7 +27,6 @@ use ipc_channel::router::ROUTER;
use layout_traits::{LayoutControlChan, LayoutTaskFactory}; use layout_traits::{LayoutControlChan, LayoutTaskFactory};
use msg::compositor_msg::Epoch; use msg::compositor_msg::Epoch;
use msg::constellation_msg::AnimationState; use msg::constellation_msg::AnimationState;
use msg::constellation_msg::CompositorMsg as FromCompositorMsg;
use msg::constellation_msg::PaintMsg as FromPaintMsg; use msg::constellation_msg::PaintMsg as FromPaintMsg;
use msg::constellation_msg::WebDriverCommandMsg; use msg::constellation_msg::WebDriverCommandMsg;
use msg::constellation_msg::{FrameId, PipelineId}; use msg::constellation_msg::{FrameId, PipelineId};

View file

@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use CompositorMsg as ConstellationMsg;
use compositor_task::{CompositorEventListener, CompositorReceiver}; use compositor_task::{CompositorEventListener, CompositorReceiver};
use compositor_task::{InitialCompositorState, Msg}; use compositor_task::{InitialCompositorState, Msg};
use euclid::scale_factor::ScaleFactor; use euclid::scale_factor::ScaleFactor;
use euclid::{Point2D, Size2D}; use euclid::{Point2D, Size2D};
use msg::constellation_msg::AnimationState; use msg::constellation_msg::AnimationState;
use msg::constellation_msg::CompositorMsg as ConstellationMsg;
use msg::constellation_msg::WindowSizeData; use msg::constellation_msg::WindowSizeData;
use profile_traits::mem; use profile_traits::mem;
use profile_traits::time; use profile_traits::time;

View file

@ -53,6 +53,14 @@ extern crate util;
pub use compositor_task::{CompositorEventListener, CompositorProxy, CompositorTask}; pub use compositor_task::{CompositorEventListener, CompositorProxy, CompositorTask};
pub use constellation::Constellation; pub use constellation::Constellation;
use euclid::size::{Size2D};
use ipc_channel::ipc::{IpcSender};
use msg::compositor_msg::Epoch;
use msg::constellation_msg::{FrameId, Key, KeyState, KeyModifiers, LoadData};
use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId};
use msg::constellation_msg::{WebDriverCommandMsg, WindowSizeData};
use std::collections::HashMap;
use url::Url;
mod compositor; mod compositor;
mod compositor_layer; mod compositor_layer;
@ -65,3 +73,30 @@ mod scrolling;
mod surface_map; mod surface_map;
mod timer_scheduler; mod timer_scheduler;
pub mod windowing; pub mod windowing;
/// Messages from the compositor to the constellation.
#[derive(Deserialize, Serialize)]
pub enum CompositorMsg {
Exit,
FrameSize(PipelineId, Size2D<f32>),
/// Request that the constellation send the FrameId corresponding to the document
/// with the provided pipeline id
GetFrame(PipelineId, IpcSender<Option<FrameId>>),
/// Request that the constellation send the current pipeline id for the provided frame
/// id, or for the root frame if this is None, over a provided channel
GetPipeline(Option<FrameId>, IpcSender<Option<PipelineId>>),
/// Requests that the constellation inform the compositor of the title of the pipeline
/// immediately.
GetPipelineTitle(PipelineId),
InitLoadUrl(Url),
/// Query the constellation to see if the current compositor output is stable
IsReadyToSaveImage(HashMap<PipelineId, Epoch>),
KeyEvent(Key, KeyState, KeyModifiers),
LoadUrl(PipelineId, LoadData),
Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection),
ResizedWindow(WindowSizeData),
/// Requests that the constellation instruct layout to begin a new tick of the animation.
TickAnimation(PipelineId),
/// Dispatch a webdriver command
WebDriverCommand(WebDriverCommandMsg),
}

View file

@ -5,7 +5,6 @@
//! The high-level interface from script to constellation. Using this abstract interface helps //! The high-level interface from script to constellation. Using this abstract interface helps
//! reduce coupling between these two components. //! reduce coupling between these two components.
use compositor_msg::Epoch;
use euclid::scale_factor::ScaleFactor; use euclid::scale_factor::ScaleFactor;
use euclid::size::{Size2D, TypedSize2D}; use euclid::size::{Size2D, TypedSize2D};
use hyper::header::Headers; use hyper::header::Headers;
@ -14,7 +13,6 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender, IpcSharedMemory};
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::cell::Cell; use std::cell::Cell;
use std::collections::HashMap;
use std::fmt; use std::fmt;
use std::sync::mpsc::channel; use std::sync::mpsc::channel;
use url::Url; use url::Url;
@ -225,33 +223,6 @@ pub struct IframeLoadInfo {
pub sandbox: IFrameSandboxState, pub sandbox: IFrameSandboxState,
} }
/// Messages from the compositor to the constellation.
#[derive(Deserialize, Serialize)]
pub enum CompositorMsg {
Exit,
FrameSize(PipelineId, Size2D<f32>),
/// Request that the constellation send the FrameId corresponding to the document
/// with the provided pipeline id
GetFrame(PipelineId, IpcSender<Option<FrameId>>),
/// Request that the constellation send the current pipeline id for the provided frame
/// id, or for the root frame if this is None, over a provided channel
GetPipeline(Option<FrameId>, IpcSender<Option<PipelineId>>),
/// Requests that the constellation inform the compositor of the title of the pipeline
/// immediately.
GetPipelineTitle(PipelineId),
InitLoadUrl(Url),
/// Query the constellation to see if the current compositor output is stable
IsReadyToSaveImage(HashMap<PipelineId, Epoch>),
KeyEvent(Key, KeyState, KeyModifiers),
LoadUrl(PipelineId, LoadData),
Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection),
ResizedWindow(WindowSizeData),
/// Requests that the constellation instruct layout to begin a new tick of the animation.
TickAnimation(PipelineId),
/// Dispatch a webdriver command
WebDriverCommand(WebDriverCommandMsg),
}
#[derive(Deserialize, HeapSizeOf, Serialize)] #[derive(Deserialize, HeapSizeOf, Serialize)]
pub enum MouseEventType { pub enum MouseEventType {
Click, Click,

View file

@ -2039,6 +2039,7 @@ dependencies = [
name = "webdriver_server" name = "webdriver_server"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"compositing 0.0.1",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",

View file

@ -57,6 +57,7 @@ fn webdriver(port: u16, constellation: Sender<ConstellationMsg>) {
fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) { } fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) { }
use compositing::CompositorEventListener; use compositing::CompositorEventListener;
use compositing::CompositorMsg as ConstellationMsg;
use compositing::compositor_task::InitialCompositorState; use compositing::compositor_task::InitialCompositorState;
use compositing::constellation::InitialConstellationState; use compositing::constellation::InitialConstellationState;
use compositing::pipeline::UnprivilegedPipelineContent; use compositing::pipeline::UnprivilegedPipelineContent;
@ -67,7 +68,6 @@ use compositing::{CompositorProxy, CompositorTask, Constellation};
use gaol::sandbox::{ChildSandbox, ChildSandboxMethods}; use gaol::sandbox::{ChildSandbox, ChildSandboxMethods};
use gfx::font_cache_task::FontCacheTask; use gfx::font_cache_task::FontCacheTask;
use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::ipc::{self, IpcSender};
use msg::constellation_msg::CompositorMsg as ConstellationMsg;
use net::image_cache_task::new_image_cache_task; use net::image_cache_task::new_image_cache_task;
use net::resource_task::new_resource_task; use net::resource_task::new_resource_task;
use net::storage_task::StorageTaskFactory; use net::storage_task::StorageTaskFactory;

View file

@ -7,6 +7,9 @@ authors = ["The Servo Project Developers"]
name = "webdriver_server" name = "webdriver_server"
path = "lib.rs" path = "lib.rs"
[dependencies.compositing]
path = "../compositing"
[dependencies.msg] [dependencies.msg]
path = "../msg" path = "../msg"

View file

@ -8,6 +8,7 @@
#![feature(ip_addr, plugin)] #![feature(ip_addr, plugin)]
#![plugin(plugins)] #![plugin(plugins)]
extern crate compositing;
extern crate hyper; extern crate hyper;
extern crate image; extern crate image;
extern crate ipc_channel; extern crate ipc_channel;
@ -23,11 +24,11 @@ extern crate webdriver;
mod keys; mod keys;
use compositing::CompositorMsg as ConstellationMsg;
use hyper::method::Method::{self, Post}; use hyper::method::Method::{self, Post};
use image::{DynamicImage, ImageFormat, RgbImage}; use image::{DynamicImage, ImageFormat, RgbImage};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use keys::keycodes_to_keys; use keys::keycodes_to_keys;
use msg::constellation_msg::CompositorMsg as ConstellationMsg;
use msg::constellation_msg::{FrameId, LoadData, PipelineId}; use msg::constellation_msg::{FrameId, LoadData, PipelineId};
use msg::constellation_msg::{NavigationDirection, PixelFormat, WebDriverCommandMsg}; use msg::constellation_msg::{NavigationDirection, PixelFormat, WebDriverCommandMsg};
use msg::webdriver_msg::{LoadStatus, WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand}; use msg::webdriver_msg::{LoadStatus, WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand};

1
ports/cef/Cargo.lock generated
View file

@ -1964,6 +1964,7 @@ dependencies = [
name = "webdriver_server" name = "webdriver_server"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"compositing 0.0.1",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",