Move CompositorMsg to script_traits.

This commit is contained in:
Ms2ger 2016-05-24 11:36:59 +02:00
parent 6aa31c01b2
commit 47933479da
2 changed files with 53 additions and 45 deletions

View file

@ -29,7 +29,6 @@ extern crate net_traits;
#[macro_use] #[macro_use]
extern crate profile_traits; extern crate profile_traits;
extern crate script_traits; extern crate script_traits;
extern crate serde;
extern crate style_traits; extern crate style_traits;
extern crate time; extern crate time;
extern crate url; extern crate url;
@ -39,18 +38,13 @@ extern crate webrender;
extern crate webrender_traits; extern crate webrender_traits;
pub use compositor_thread::{CompositorEventListener, CompositorProxy, CompositorThread}; pub use compositor_thread::{CompositorEventListener, CompositorProxy, CompositorThread};
use euclid::size::{Size2D, TypedSize2D}; use euclid::size::TypedSize2D;
use gfx::paint_thread::ChromeToPaintMsg; use gfx::paint_thread::ChromeToPaintMsg;
use gfx_traits::Epoch;
use ipc_channel::ipc::{IpcSender}; use ipc_channel::ipc::{IpcSender};
use layout_traits::LayoutControlChan; use layout_traits::LayoutControlChan;
use msg::constellation_msg::{FrameId, Key, KeyState, KeyModifiers, LoadData}; use msg::constellation_msg::PipelineId;
use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId};
use msg::constellation_msg::{WebDriverCommandMsg, WindowSizeData, WindowSizeType};
use script_traits::ConstellationControlMsg; use script_traits::ConstellationControlMsg;
use std::collections::HashMap;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use url::Url;
use util::geometry::PagePx; use util::geometry::PagePx;
mod compositor; mod compositor;
@ -61,40 +55,7 @@ mod surface_map;
mod touch; mod touch;
pub mod windowing; pub mod windowing;
/// Specifies whether the script or layout thread needs to be ticked for animation. pub use script_traits::{AnimationTickType, ConstellationMsg as CompositorMsg};
#[derive(Deserialize, Serialize)]
pub enum AnimationTickType {
Script,
Layout,
}
/// 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.
/// Also returns a boolean saying whether the document has finished loading or not.
GetPipeline(Option<FrameId>, IpcSender<Option<(PipelineId, bool)>>),
/// 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),
WindowSize(WindowSizeData, WindowSizeType),
/// Requests that the constellation instruct layout to begin a new tick of the animation.
TickAnimation(PipelineId, AnimationTickType),
/// Dispatch a webdriver command
WebDriverCommand(WebDriverCommandMsg),
}
pub struct SendableFrameTree { pub struct SendableFrameTree {
pub pipeline: CompositionPipeline, pub pipeline: CompositionPipeline,

View file

@ -41,9 +41,10 @@ use gfx_traits::Epoch;
use gfx_traits::LayerId; use gfx_traits::LayerId;
use ipc_channel::ipc::{IpcReceiver, IpcSender}; use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::c_void; use libc::c_void;
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{FrameId, Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{PanicMsg, PipelineId, PipelineNamespaceId}; use msg::constellation_msg::{NavigationDirection, PanicMsg, PipelineId};
use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType}; use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeData};
use msg::constellation_msg::{WebDriverCommandMsg, WindowSizeType};
use msg::webdriver_msg::WebDriverScriptCommand; use msg::webdriver_msg::WebDriverScriptCommand;
use net_traits::ResourceThreads; use net_traits::ResourceThreads;
use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::bluetooth_thread::BluetoothMethodMsg;
@ -51,6 +52,8 @@ use net_traits::image_cache_thread::ImageCacheThread;
use net_traits::response::HttpsState; use net_traits::response::HttpsState;
use profile_traits::mem; use profile_traits::mem;
use std::any::Any; use std::any::Any;
use std::collections::HashMap;
use url::Url;
use util::ipc::OptionalOpaqueIpcSender; use util::ipc::OptionalOpaqueIpcSender;
pub use script_msg::{LayoutMsg, ScriptMsg}; pub use script_msg::{LayoutMsg, ScriptMsg};
@ -491,3 +494,47 @@ impl MozBrowserErrorType {
} }
} }
} }
/// Specifies whether the script or layout thread needs to be ticked for animation.
#[derive(Deserialize, Serialize)]
pub enum AnimationTickType {
/// The script thread.
Script,
/// The layout thread.
Layout,
}
/// Messages to the constellation.
#[derive(Deserialize, Serialize)]
pub enum ConstellationMsg {
/// Exit the constellation.
Exit,
/// Inform the constellation of the size of the viewport.
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.
/// Also returns a boolean saying whether the document has finished loading or not.
GetPipeline(Option<FrameId>, IpcSender<Option<(PipelineId, bool)>>),
/// Requests that the constellation inform the compositor of the title of the pipeline
/// immediately.
GetPipelineTitle(PipelineId),
/// Request to load the initial page.
InitLoadUrl(Url),
/// Query the constellation to see if the current compositor output is stable
IsReadyToSaveImage(HashMap<PipelineId, Epoch>),
/// Inform the constellation of a key event.
KeyEvent(Key, KeyState, KeyModifiers),
/// Request to load a page.
LoadUrl(PipelineId, LoadData),
/// Request to navigate a frame.
Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection),
/// Inform the constellation of a window being resized.
WindowSize(WindowSizeData, WindowSizeType),
/// Requests that the constellation instruct layout to begin a new tick of the animation.
TickAnimation(PipelineId, AnimationTickType),
/// Dispatch a webdriver command
WebDriverCommand(WebDriverCommandMsg),
}