Skip to content

Commit

Permalink
Moved CompositorMsg enum into compositing crate.
Browse files Browse the repository at this point in the history
moved from components/msg/constellation_msg.rs
      to components/compositing/lib.rs

dependencies on compositing crate added in ports/cef/Cargo.lock
  • Loading branch information
kimumetal committed Dec 11, 2015
1 parent 996c0a6 commit 729812f
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 35 deletions.
2 changes: 1 addition & 1 deletion components/compositing/compositor.rs
Expand Up @@ -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};
Expand All @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion components/compositing/compositor_task.rs
Expand Up @@ -4,6 +4,7 @@

//! Communication with the compositor task.

use CompositorMsg as ConstellationMsg;
use compositor;
use euclid::point::Point2D;
use euclid::size::Size2D;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/compositing/constellation.rs
Expand Up @@ -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;
Expand All @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion components/compositing/headless.rs
Expand Up @@ -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;
Expand Down
35 changes: 35 additions & 0 deletions components/compositing/lib.rs
Expand Up @@ -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;
Expand All @@ -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<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),
}
29 changes: 0 additions & 29 deletions components/msg/constellation_msg.rs
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<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)]
pub enum MouseEventType {
Click,
Expand Down
1 change: 1 addition & 0 deletions components/servo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/servo/lib.rs
Expand Up @@ -57,6 +57,7 @@ fn webdriver(port: u16, constellation: Sender<ConstellationMsg>) {
fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) { }

use compositing::CompositorEventListener;
use compositing::CompositorMsg as ConstellationMsg;
use compositing::compositor_task::InitialCompositorState;
use compositing::constellation::InitialConstellationState;
use compositing::pipeline::UnprivilegedPipelineContent;
Expand All @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions components/webdriver_server/Cargo.toml
Expand Up @@ -7,6 +7,9 @@ authors = ["The Servo Project Developers"]
name = "webdriver_server"
path = "lib.rs"

[dependencies.compositing]
path = "../compositing"

[dependencies.msg]
path = "../msg"

Expand Down
3 changes: 2 additions & 1 deletion components/webdriver_server/lib.rs
Expand Up @@ -8,6 +8,7 @@
#![feature(ip_addr, plugin)]
#![plugin(plugins)]

extern crate compositing;
extern crate hyper;
extern crate image;
extern crate ipc_channel;
Expand All @@ -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};
Expand Down
1 change: 1 addition & 0 deletions ports/cef/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 729812f

Please sign in to comment.