servo: Merge #11484 - Remove LayoutControlChan (from Ms2ger:LayoutControlChan); r=nox

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because refactoring

Source-Repo: https://github.com/servo/servo
Source-Revision: 2b58586299b1017838ccc622d1ba12183fb7eb38
This commit is contained in:
Ms2ger 2016-05-28 05:02:26 -05:00
parent 94c38d54c6
commit 119b24766c
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::RenderContext;
use layers::scene::Scene;
use layout_traits::{ConvertPipelineIdToWebRender, LayoutControlChan};
use layout_traits::ConvertPipelineIdToWebRender;
use msg::constellation_msg::{Image, PixelFormat};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
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 {
if let Some(pipeline_details) = self.pipeline_details.get(&pipeline_id) {
if let Some(ref pipeline) = pipeline_details.pipeline {
let LayoutControlChan(ref sender) = pipeline.layout_chan;
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);
}
}

View File

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

View File

@ -23,7 +23,7 @@ use gfx::font_cache_thread::FontCacheThread;
use gfx_traits::Epoch;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use layout_traits::{LayoutControlChan, LayoutThreadFactory};
use layout_traits::LayoutThreadFactory;
use msg::constellation_msg::WebDriverCommandMsg;
use msg::constellation_msg::{FrameId, FrameType, PipelineId};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
@ -1057,7 +1057,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
AnimationTickType::Layout => {
let msg = LayoutControlMsg::TickAnimations;
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),
}
}
@ -1757,7 +1757,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// there's a race condition where a webfont has finished loading,
// but hasn't yet notified the document.
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);
}
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
// (and script is idle) then this pipeline won't change again
// and can be considered stable.
let LayoutControlChan(ref layout_chan) = pipeline.layout_chan;
if let Err(e) = layout_chan.send(LayoutControlMsg::GetCurrentEpoch(epoch_sender.clone())) {
let message = LayoutControlMsg::GetCurrentEpoch(epoch_sender.clone());
if let Err(e) = pipeline.layout_chan.send(message) {
warn!("Failed to send GetCurrentEpoch ({}).", e);
}
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::router::ROUTER;
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::{PipelineNamespaceId, SubpageId, WindowSizeData};
use net_traits::ResourceThreads;
@ -51,7 +51,7 @@ pub struct Pipeline {
pub parent_info: Option<(PipelineId, SubpageId, FrameType)>,
pub script_chan: IpcSender<ConstellationControlMsg>,
/// A channel to layout, for performing reflows and shutdown.
pub layout_chan: LayoutControlChan,
pub layout_chan: IpcSender<LayoutControlMsg>,
/// A channel to the compositor.
pub compositor_proxy: Box<CompositorProxy + 'static + Send>,
pub chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
@ -254,7 +254,7 @@ impl Pipeline {
let pipeline = Pipeline::new(state.id,
state.parent_info,
script_chan,
LayoutControlChan(pipeline_chan),
pipeline_chan,
state.compositor_proxy,
chrome_to_paint_chan,
layout_shutdown_port,
@ -268,7 +268,7 @@ impl Pipeline {
fn new(id: PipelineId,
parent_info: Option<(PipelineId, SubpageId, FrameType)>,
script_chan: IpcSender<ConstellationControlMsg>,
layout_chan: LayoutControlChan,
layout_chan: IpcSender<LayoutControlMsg>,
compositor_proxy: Box<CompositorProxy + 'static + Send>,
chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
layout_shutdown_port: IpcReceiver<()>,
@ -347,8 +347,7 @@ impl Pipeline {
if let Err(e) = self.chrome_to_paint_chan.send(ChromeToPaintMsg::Exit) {
warn!("Sending paint exit message failed ({}).", e);
}
let LayoutControlChan(ref layout_channel) = self.layout_chan;
if let Err(e) = layout_channel.send(LayoutControlMsg::ExitNow) {
if let Err(e) = self.layout_chan.send(LayoutControlMsg::ExitNow) {
warn!("Sending layout exit message failed ({}).", e);
}
}

View File

@ -17,6 +17,4 @@ profile_traits = {path = "../profile_traits"}
util = {path = "../util"}
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
webrender_traits = {git = "https://github.com/servo/webrender_traits"}
serde = "0.7"
serde_macros = "0.7"
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
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(custom_derive, plugin)]
#![plugin(serde_macros)]
#![deny(unsafe_code)]
extern crate gfx;
@ -13,7 +10,6 @@ extern crate msg;
extern crate net_traits;
extern crate profile_traits;
extern crate script_traits;
extern crate serde;
extern crate url;
extern crate util;
extern crate webrender_traits;
@ -35,10 +31,6 @@ use std::sync::mpsc::{Sender, Receiver};
use url::Url;
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
// Here to remove the compositor -> layout dependency
pub trait LayoutThreadFactory {

View File

@ -1180,8 +1180,6 @@ dependencies = [
"net_traits 0.0.1",
"profile_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)",
"util 0.0.1",
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",

View File

@ -1085,8 +1085,6 @@ dependencies = [
"net_traits 0.0.1",
"profile_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)",
"util 0.0.1",
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",