Remove LayoutControlChan.

This commit is contained in:
Ms2ger 2016-05-27 14:00:42 +02:00
parent e3b2d6aef0
commit ec03c367ab
8 changed files with 14 additions and 31 deletions

View file

@ -27,7 +27,7 @@ use layers::platform::surface::NativeDisplay;
use layers::rendergl; use layers::rendergl;
use layers::rendergl::RenderContext; use layers::rendergl::RenderContext;
use layers::scene::Scene; use layers::scene::Scene;
use layout_traits::{ConvertPipelineIdToWebRender, LayoutControlChan}; use layout_traits::ConvertPipelineIdToWebRender;
use msg::constellation_msg::{Image, PixelFormat}; use msg::constellation_msg::{Image, PixelFormat};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{NavigationDirection, PipelineId, PipelineIndex, PipelineNamespaceId}; use msg::constellation_msg::{NavigationDirection, PipelineId, PipelineIndex, PipelineNamespaceId};
@ -1668,9 +1668,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
for (pipeline_id, new_visible_rects) in &new_visible_rects { for (pipeline_id, new_visible_rects) in &new_visible_rects {
if let Some(pipeline_details) = self.pipeline_details.get(&pipeline_id) { if let Some(pipeline_details) = self.pipeline_details.get(&pipeline_id) {
if let Some(ref pipeline) = pipeline_details.pipeline { if let Some(ref pipeline) = pipeline_details.pipeline {
let LayoutControlChan(ref sender) = pipeline.layout_chan;
let msg = LayoutControlMsg::SetVisibleRects((*new_visible_rects).clone()); let msg = LayoutControlMsg::SetVisibleRects((*new_visible_rects).clone());
if let Err(e) = sender.send(msg) { if let Err(e) = pipeline.layout_chan.send(msg) {
warn!("Sending layout control message failed ({}).", e); warn!("Sending layout control message failed ({}).", e);
} }
} }

View file

@ -41,9 +41,8 @@ pub use compositor_thread::{CompositorEventListener, CompositorProxy, Compositor
use euclid::size::TypedSize2D; use euclid::size::TypedSize2D;
use gfx::paint_thread::ChromeToPaintMsg; use gfx::paint_thread::ChromeToPaintMsg;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use layout_traits::LayoutControlChan;
use msg::constellation_msg::PipelineId; use msg::constellation_msg::PipelineId;
use script_traits::ConstellationControlMsg; use script_traits::{ConstellationControlMsg, LayoutControlMsg};
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use util::geometry::PagePx; use util::geometry::PagePx;
@ -66,6 +65,6 @@ pub struct SendableFrameTree {
pub struct CompositionPipeline { pub struct CompositionPipeline {
pub id: PipelineId, pub id: PipelineId,
pub script_chan: IpcSender<ConstellationControlMsg>, pub script_chan: IpcSender<ConstellationControlMsg>,
pub layout_chan: LayoutControlChan, pub layout_chan: IpcSender<LayoutControlMsg>,
pub chrome_to_paint_chan: Sender<ChromeToPaintMsg>, pub chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
} }

View file

@ -23,7 +23,7 @@ use gfx::font_cache_thread::FontCacheThread;
use gfx_traits::Epoch; use gfx_traits::Epoch;
use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
use layout_traits::{LayoutControlChan, LayoutThreadFactory}; use layout_traits::LayoutThreadFactory;
use msg::constellation_msg::WebDriverCommandMsg; use msg::constellation_msg::WebDriverCommandMsg;
use msg::constellation_msg::{FrameId, FrameType, PipelineId}; use msg::constellation_msg::{FrameId, FrameType, PipelineId};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
@ -1057,7 +1057,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
AnimationTickType::Layout => { AnimationTickType::Layout => {
let msg = LayoutControlMsg::TickAnimations; let msg = LayoutControlMsg::TickAnimations;
match self.pipelines.get(&pipeline_id) { match self.pipelines.get(&pipeline_id) {
Some(pipeline) => pipeline.layout_chan.0.send(msg), Some(pipeline) => pipeline.layout_chan.send(msg),
None => return warn!("Pipeline {:?} got script tick after closure.", pipeline_id), None => return warn!("Pipeline {:?} got script tick after closure.", pipeline_id),
} }
} }
@ -1757,7 +1757,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// there's a race condition where a webfont has finished loading, // there's a race condition where a webfont has finished loading,
// but hasn't yet notified the document. // but hasn't yet notified the document.
let msg = LayoutControlMsg::GetWebFontLoadState(state_sender.clone()); let msg = LayoutControlMsg::GetWebFontLoadState(state_sender.clone());
if let Err(e) = pipeline.layout_chan.0.send(msg) { if let Err(e) = pipeline.layout_chan.send(msg) {
warn!("Get web font failed ({})", e); warn!("Get web font failed ({})", e);
} }
if state_receiver.recv().unwrap_or(true) { if state_receiver.recv().unwrap_or(true) {
@ -1792,8 +1792,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// epoch matches what the compositor has drawn. If they match // epoch matches what the compositor has drawn. If they match
// (and script is idle) then this pipeline won't change again // (and script is idle) then this pipeline won't change again
// and can be considered stable. // and can be considered stable.
let LayoutControlChan(ref layout_chan) = pipeline.layout_chan; let message = LayoutControlMsg::GetCurrentEpoch(epoch_sender.clone());
if let Err(e) = layout_chan.send(LayoutControlMsg::GetCurrentEpoch(epoch_sender.clone())) { if let Err(e) = pipeline.layout_chan.send(message) {
warn!("Failed to send GetCurrentEpoch ({}).", e); warn!("Failed to send GetCurrentEpoch ({}).", e);
} }
match epoch_receiver.recv() { match epoch_receiver.recv() {

View file

@ -15,7 +15,7 @@ use gfx::paint_thread::{ChromeToPaintMsg, LayoutToPaintMsg, PaintThread};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use layout_traits::{LayoutControlChan, LayoutThreadFactory}; use layout_traits::LayoutThreadFactory;
use msg::constellation_msg::{FrameId, FrameType, LoadData, PanicMsg, PipelineId}; use msg::constellation_msg::{FrameId, FrameType, LoadData, PanicMsg, PipelineId};
use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeData}; use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeData};
use net_traits::ResourceThreads; use net_traits::ResourceThreads;
@ -51,7 +51,7 @@ pub struct Pipeline {
pub parent_info: Option<(PipelineId, SubpageId, FrameType)>, pub parent_info: Option<(PipelineId, SubpageId, FrameType)>,
pub script_chan: IpcSender<ConstellationControlMsg>, pub script_chan: IpcSender<ConstellationControlMsg>,
/// A channel to layout, for performing reflows and shutdown. /// A channel to layout, for performing reflows and shutdown.
pub layout_chan: LayoutControlChan, pub layout_chan: IpcSender<LayoutControlMsg>,
/// A channel to the compositor. /// A channel to the compositor.
pub compositor_proxy: Box<CompositorProxy + 'static + Send>, pub compositor_proxy: Box<CompositorProxy + 'static + Send>,
pub chrome_to_paint_chan: Sender<ChromeToPaintMsg>, pub chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
@ -254,7 +254,7 @@ impl Pipeline {
let pipeline = Pipeline::new(state.id, let pipeline = Pipeline::new(state.id,
state.parent_info, state.parent_info,
script_chan, script_chan,
LayoutControlChan(pipeline_chan), pipeline_chan,
state.compositor_proxy, state.compositor_proxy,
chrome_to_paint_chan, chrome_to_paint_chan,
layout_shutdown_port, layout_shutdown_port,
@ -268,7 +268,7 @@ impl Pipeline {
fn new(id: PipelineId, fn new(id: PipelineId,
parent_info: Option<(PipelineId, SubpageId, FrameType)>, parent_info: Option<(PipelineId, SubpageId, FrameType)>,
script_chan: IpcSender<ConstellationControlMsg>, script_chan: IpcSender<ConstellationControlMsg>,
layout_chan: LayoutControlChan, layout_chan: IpcSender<LayoutControlMsg>,
compositor_proxy: Box<CompositorProxy + 'static + Send>, compositor_proxy: Box<CompositorProxy + 'static + Send>,
chrome_to_paint_chan: Sender<ChromeToPaintMsg>, chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
layout_shutdown_port: IpcReceiver<()>, layout_shutdown_port: IpcReceiver<()>,
@ -347,8 +347,7 @@ impl Pipeline {
if let Err(e) = self.chrome_to_paint_chan.send(ChromeToPaintMsg::Exit) { if let Err(e) = self.chrome_to_paint_chan.send(ChromeToPaintMsg::Exit) {
warn!("Sending paint exit message failed ({}).", e); warn!("Sending paint exit message failed ({}).", e);
} }
let LayoutControlChan(ref layout_channel) = self.layout_chan; if let Err(e) = self.layout_chan.send(LayoutControlMsg::ExitNow) {
if let Err(e) = layout_channel.send(LayoutControlMsg::ExitNow) {
warn!("Sending layout exit message failed ({}).", e); warn!("Sending layout exit message failed ({}).", e);
} }
} }

View file

@ -17,6 +17,4 @@ profile_traits = {path = "../profile_traits"}
util = {path = "../util"} util = {path = "../util"}
ipc-channel = {git = "https://github.com/servo/ipc-channel"} ipc-channel = {git = "https://github.com/servo/ipc-channel"}
webrender_traits = {git = "https://github.com/servo/webrender_traits"} webrender_traits = {git = "https://github.com/servo/webrender_traits"}
serde = "0.7"
serde_macros = "0.7"
url = {version = "1.0.0", features = ["heap_size"]} url = {version = "1.0.0", features = ["heap_size"]}

View file

@ -2,9 +2,6 @@
* 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/. */
#![feature(custom_derive, plugin)]
#![plugin(serde_macros)]
#![deny(unsafe_code)] #![deny(unsafe_code)]
extern crate gfx; extern crate gfx;
@ -13,7 +10,6 @@ extern crate msg;
extern crate net_traits; extern crate net_traits;
extern crate profile_traits; extern crate profile_traits;
extern crate script_traits; extern crate script_traits;
extern crate serde;
extern crate url; extern crate url;
extern crate util; extern crate util;
extern crate webrender_traits; extern crate webrender_traits;
@ -35,10 +31,6 @@ use std::sync::mpsc::{Sender, Receiver};
use url::Url; use url::Url;
use util::ipc::OptionalIpcSender; use util::ipc::OptionalIpcSender;
/// A channel wrapper for constellation messages
#[derive(Clone, Deserialize, Serialize)]
pub struct LayoutControlChan(pub IpcSender<LayoutControlMsg>);
// A static method creating a layout thread // A static method creating a layout thread
// Here to remove the compositor -> layout dependency // Here to remove the compositor -> layout dependency
pub trait LayoutThreadFactory { pub trait LayoutThreadFactory {

View file

@ -1180,8 +1180,6 @@ dependencies = [
"net_traits 0.0.1", "net_traits 0.0.1",
"profile_traits 0.0.1", "profile_traits 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1", "util 0.0.1",
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)", "webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",

2
ports/cef/Cargo.lock generated
View file

@ -1085,8 +1085,6 @@ dependencies = [
"net_traits 0.0.1", "net_traits 0.0.1",
"profile_traits 0.0.1", "profile_traits 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1", "util 0.0.1",
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)", "webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",