From 729812f383f076e892975357b6d675dc7cf26dcd Mon Sep 17 00:00:00 2001 From: Beomjin Kim Date: Wed, 9 Dec 2015 14:39:58 +0900 Subject: [PATCH] Moved CompositorMsg enum into compositing crate. moved from components/msg/constellation_msg.rs to components/compositing/lib.rs dependencies on compositing crate added in ports/cef/Cargo.lock --- components/compositing/compositor.rs | 2 +- components/compositing/compositor_task.rs | 2 +- components/compositing/constellation.rs | 2 +- components/compositing/headless.rs | 2 +- components/compositing/lib.rs | 35 +++++++++++++++++++++++ components/msg/constellation_msg.rs | 29 ------------------- components/servo/Cargo.lock | 1 + components/servo/lib.rs | 2 +- components/webdriver_server/Cargo.toml | 3 ++ components/webdriver_server/lib.rs | 3 +- ports/cef/Cargo.lock | 1 + 11 files changed, 47 insertions(+), 35 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 3e259a7b35a0..417f90729746 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -2,6 +2,7 @@ * 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/. */ +use CompositorMsg as ConstellationMsg; use app_units::Au; use compositor_layer::{CompositorData, CompositorLayer, RcCompositorLayer, WantsScrollEventsFlag}; use compositor_task::{CompositorEventListener, CompositorProxy}; @@ -28,7 +29,6 @@ use layers::scene::Scene; use layout_traits::LayoutControlChan; use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerKind}; use msg::compositor_msg::{LayerProperties, ScrollPolicy}; -use msg::constellation_msg::CompositorMsg as ConstellationMsg; use msg::constellation_msg::{AnimationState, Image, PixelFormat}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, MouseButton}; use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData}; diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs index 8a0921e4b8eb..532590665f2c 100644 --- a/components/compositing/compositor_task.rs +++ b/components/compositing/compositor_task.rs @@ -4,6 +4,7 @@ //! Communication with the compositor task. +use CompositorMsg as ConstellationMsg; use compositor; use euclid::point::Point2D; use euclid::size::Size2D; @@ -13,7 +14,6 @@ use layers::layers::{BufferRequest, LayerBufferSet}; use layers::platform::surface::{NativeDisplay, NativeSurface}; use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerProperties}; use msg::compositor_msg::{PaintListener, ScriptToCompositorMsg}; -use msg::constellation_msg::CompositorMsg as ConstellationMsg; use msg::constellation_msg::{AnimationState, PipelineId}; use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState}; use profile_traits::mem; diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 01cd79ca6ef4..5cedb80cdcd5 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -9,6 +9,7 @@ //! navigation context, each `Pipeline` encompassing a `ScriptTask`, //! `LayoutTask`, and `PaintTask`. +use CompositorMsg as FromCompositorMsg; use canvas::canvas_paint_task::CanvasPaintTask; use canvas::webgl_paint_task::WebGLPaintTask; use canvas_traits::CanvasMsg; @@ -26,7 +27,6 @@ use ipc_channel::router::ROUTER; use layout_traits::{LayoutControlChan, LayoutTaskFactory}; use msg::compositor_msg::Epoch; use msg::constellation_msg::AnimationState; -use msg::constellation_msg::CompositorMsg as FromCompositorMsg; use msg::constellation_msg::PaintMsg as FromPaintMsg; use msg::constellation_msg::WebDriverCommandMsg; use msg::constellation_msg::{FrameId, PipelineId}; diff --git a/components/compositing/headless.rs b/components/compositing/headless.rs index a31d1b3c5315..85af3b7f6220 100644 --- a/components/compositing/headless.rs +++ b/components/compositing/headless.rs @@ -2,12 +2,12 @@ * 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/. */ +use CompositorMsg as ConstellationMsg; use compositor_task::{CompositorEventListener, CompositorReceiver}; use compositor_task::{InitialCompositorState, Msg}; use euclid::scale_factor::ScaleFactor; use euclid::{Point2D, Size2D}; use msg::constellation_msg::AnimationState; -use msg::constellation_msg::CompositorMsg as ConstellationMsg; use msg::constellation_msg::WindowSizeData; use profile_traits::mem; use profile_traits::time; diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index b4c0e780051f..65444e6d4433 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -54,6 +54,14 @@ extern crate util; pub use compositor_task::{CompositorEventListener, CompositorProxy, CompositorTask}; 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_layer; @@ -66,3 +74,30 @@ mod scrolling; mod surface_map; mod timer_scheduler; pub mod windowing; + +/// Messages from the compositor to the constellation. +#[derive(Deserialize, Serialize)] +pub enum CompositorMsg { + Exit, + FrameSize(PipelineId, Size2D), + /// Request that the constellation send the FrameId corresponding to the document + /// with the provided pipeline id + GetFrame(PipelineId, IpcSender>), + /// 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, IpcSender>), + /// 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), + 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), +} diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 0edf9c38075c..7a77b78774a4 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -5,7 +5,6 @@ //! The high-level interface from script to constellation. Using this abstract interface helps //! reduce coupling between these two components. -use compositor_msg::Epoch; use euclid::scale_factor::ScaleFactor; use euclid::size::{Size2D, TypedSize2D}; use hyper::header::Headers; @@ -14,7 +13,6 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender, IpcSharedMemory}; use layers::geometry::DevicePixel; use serde::{Deserialize, Serialize}; use std::cell::Cell; -use std::collections::HashMap; use std::fmt; use std::sync::mpsc::channel; use url::Url; @@ -225,33 +223,6 @@ pub struct IframeLoadInfo { pub sandbox: IFrameSandboxState, } -/// Messages from the compositor to the constellation. -#[derive(Deserialize, Serialize)] -pub enum CompositorMsg { - Exit, - FrameSize(PipelineId, Size2D), - /// Request that the constellation send the FrameId corresponding to the document - /// with the provided pipeline id - GetFrame(PipelineId, IpcSender>), - /// 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, IpcSender>), - /// 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), - 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)] pub enum MouseEventType { Click, diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index ec0ea24c1b2f..8f525198765d 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -2039,6 +2039,7 @@ dependencies = [ name = "webdriver_server" version = "0.0.1" dependencies = [ + "compositing 0.0.1", "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)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 8c0f920554fc..0f2654aef0f5 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -57,6 +57,7 @@ fn webdriver(port: u16, constellation: Sender) { fn webdriver(_port: u16, _constellation: Sender) { } use compositing::CompositorEventListener; +use compositing::CompositorMsg as ConstellationMsg; use compositing::compositor_task::InitialCompositorState; use compositing::constellation::InitialConstellationState; use compositing::pipeline::UnprivilegedPipelineContent; @@ -67,7 +68,6 @@ use compositing::{CompositorProxy, CompositorTask, Constellation}; use gaol::sandbox::{ChildSandbox, ChildSandboxMethods}; use gfx::font_cache_task::FontCacheTask; use ipc_channel::ipc::{self, IpcSender}; -use msg::constellation_msg::CompositorMsg as ConstellationMsg; use net::image_cache_task::new_image_cache_task; use net::resource_task::new_resource_task; use net::storage_task::StorageTaskFactory; diff --git a/components/webdriver_server/Cargo.toml b/components/webdriver_server/Cargo.toml index 8b091bb802a5..3b034f1b3da4 100644 --- a/components/webdriver_server/Cargo.toml +++ b/components/webdriver_server/Cargo.toml @@ -7,6 +7,9 @@ authors = ["The Servo Project Developers"] name = "webdriver_server" path = "lib.rs" +[dependencies.compositing] +path = "../compositing" + [dependencies.msg] path = "../msg" diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 1acd63f352ab..a96f7db3cb47 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -8,6 +8,7 @@ #![feature(ip_addr, plugin)] #![plugin(plugins)] +extern crate compositing; extern crate hyper; extern crate image; extern crate ipc_channel; @@ -23,11 +24,11 @@ extern crate webdriver; mod keys; +use compositing::CompositorMsg as ConstellationMsg; use hyper::method::Method::{self, Post}; use image::{DynamicImage, ImageFormat, RgbImage}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use keys::keycodes_to_keys; -use msg::constellation_msg::CompositorMsg as ConstellationMsg; use msg::constellation_msg::{FrameId, LoadData, PipelineId}; use msg::constellation_msg::{NavigationDirection, PixelFormat, WebDriverCommandMsg}; use msg::webdriver_msg::{LoadStatus, WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand}; diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 177aad203063..0f780c1d4bf2 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -1964,6 +1964,7 @@ dependencies = [ name = "webdriver_server" version = "0.0.1" dependencies = [ + "compositing 0.0.1", "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)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",