Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove util::ipc module (use ipc_channel instead; fixes #12312) #12558

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Remove util::ipc module (use ipc_channel instead)

  • Loading branch information
djc committed Jul 22, 2016
commit 222feb477c04b832b27c42bf438856df69bd9727
@@ -33,8 +33,6 @@ use std::process;
use std::sync::mpsc::{Sender, channel};
use style_traits::{PagePx, ViewportPx};
use url::Url;
use util;
use util::ipc::OptionalIpcSender;
use util::opts::{self, Opts};
use util::prefs::{PREFS, Pref};
use webrender_traits;
@@ -138,7 +136,8 @@ impl Pipeline {
{
// Note: we allow channel creation to panic, since recovering from this
// probably requires a general low-memory strategy.
let (layout_to_paint_chan, layout_to_paint_port) = util::ipc::optional_ipc_channel();
let (layout_to_paint_chan, layout_to_paint_port) = ipc::channel()
.expect("Layout to paint chan");
let (chrome_to_paint_chan, chrome_to_paint_port) = channel();
let (pipeline_chan, pipeline_port) = ipc::channel()
.expect("Pipeline main chan");;
@@ -422,7 +421,7 @@ pub struct UnprivilegedPipelineContent {
script_chan: IpcSender<ConstellationControlMsg>,
load_data: LoadData,
script_port: IpcReceiver<ConstellationControlMsg>,
layout_to_paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
layout_to_paint_chan: IpcSender<LayoutToPaintMsg>,
opts: Opts,
prefs: HashMap<String, Pref>,
pipeline_port: IpcReceiver<LayoutControlMsg>,
@@ -17,6 +17,8 @@ use font_cache_thread::FontCacheThread;
use font_context::FontContext;
use gfx_traits::{ChromeToPaintMsg, Epoch, LayerId, LayerKind, LayerProperties};
use gfx_traits::{PaintListener, PaintRequest, StackingContextId};
use ipc_channel::ipc::IpcReceiver;
use ipc_channel::router::ROUTER;
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
use layers::platform::surface::{NativeDisplay, NativeSurface};
use msg::constellation_msg::PipelineId;
@@ -373,7 +375,7 @@ impl<C> PaintThread<C> where C: PaintListener + Send + 'static {
pub fn create(id: PipelineId,
url: Url,
chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
layout_to_paint_port: Receiver<LayoutToPaintMsg>,
layout_to_paint_port: IpcReceiver<LayoutToPaintMsg>,

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Jul 29, 2016

Member

Ah, is this replacing a channel by an ipc channel? Is this the source of slowdown?

This comment has been minimized.

Copy link
@pcwalton

pcwalton Jul 29, 2016

Contributor

Oh, definitely don't do that. That will be very slow!

This comment has been minimized.

Copy link
@antrik

antrik Jul 29, 2016

Contributor

This is replacing MPSC channels with IPC channels for the single-process case (still the default); it was (obviously) already using IPC channels in the multi-process case.

I don't think we should rely on single-process optimisation if we ever want to make the multi-process case default and/or actually viable. So I don't think this change is bad per se -- it just brings out problems that would have come up anyway if the tests were run with -M...

chrome_to_paint_port: Receiver<ChromeToPaintMsg>,
mut compositor: C,
font_cache_thread: FontCacheThread,
@@ -392,7 +394,8 @@ impl<C> PaintThread<C> where C: PaintListener + Send + 'static {
let mut paint_thread = PaintThread {
id: id,
_url: url,
layout_to_paint_port: layout_to_paint_port,
layout_to_paint_port:
ROUTER.route_ipc_receiver_to_new_mpsc_receiver(layout_to_paint_port),

This comment has been minimized.

Copy link
@antrik

antrik Jul 29, 2016

Contributor

It seems a little arbitrary, and possibly confusing, to do the wrapping here: I think it might be clearer to do it right at the place where layout_to_paint_port is originally created -- thus keeping it closer to what the original code did...

chrome_to_paint_port: chrome_to_paint_port,
compositor: compositor,
time_profiler_chan: time_profiler_chan,
@@ -114,7 +114,6 @@ use style::timer::Timer;
use style::workqueue::WorkQueue;
use url::Url;
use util::geometry::MAX_RECT;
use util::ipc::OptionalIpcSender;
use util::opts;
use util::prefs::PREFS;
use util::thread;
@@ -159,7 +158,7 @@ pub struct LayoutThread {
script_chan: IpcSender<ConstellationControlMsg>,

/// The channel on which messages can be sent to the painting thread.
paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
paint_chan: IpcSender<LayoutToPaintMsg>,

/// The channel on which messages can be sent to the time profiler.
time_profiler_chan: time::ProfilerChan,
@@ -245,7 +244,7 @@ impl LayoutThreadFactory for LayoutThread {
pipeline_port: IpcReceiver<LayoutControlMsg>,
constellation_chan: IpcSender<ConstellationMsg>,
script_chan: IpcSender<ConstellationControlMsg>,
paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
paint_chan: IpcSender<LayoutToPaintMsg>,
image_cache_thread: ImageCacheThread,
font_cache_thread: FontCacheThread,
time_profiler_chan: time::ProfilerChan,
@@ -376,7 +375,7 @@ impl LayoutThread {
pipeline_port: IpcReceiver<LayoutControlMsg>,
constellation_chan: IpcSender<ConstellationMsg>,
script_chan: IpcSender<ConstellationControlMsg>,
paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
paint_chan: IpcSender<LayoutToPaintMsg>,
image_cache_thread: ImageCacheThread,
font_cache_thread: FontCacheThread,
time_profiler_chan: time::ProfilerChan,
@@ -15,7 +15,6 @@ script_traits = {path = "../script_traits"}
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
profile_traits = {path = "../profile_traits"}
util = {path = "../util"}
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
url = {version = "1.0.0", features = ["heap_size"]}

@@ -11,7 +11,6 @@ extern crate net_traits;
extern crate profile_traits;
extern crate script_traits;
extern crate url;
extern crate util;
extern crate webrender_traits;

// This module contains traits in layout used generically
@@ -29,7 +28,6 @@ use script_traits::LayoutMsg as ConstellationMsg;
use script_traits::{LayoutControlMsg, ConstellationControlMsg};
use std::sync::mpsc::{Sender, Receiver};
use url::Url;
use util::ipc::OptionalIpcSender;

// A static method creating a layout thread
// Here to remove the compositor -> layout dependency
@@ -42,7 +40,7 @@ pub trait LayoutThreadFactory {
pipeline_port: IpcReceiver<LayoutControlMsg>,
constellation_chan: IpcSender<ConstellationMsg>,
script_chan: IpcSender<ConstellationControlMsg>,
layout_to_paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
layout_to_paint_chan: IpcSender<LayoutToPaintMsg>,
image_cache_thread: ImageCacheThread,
font_cache_thread: FontCacheThread,
time_profiler_chan: time::ProfilerChan,
@@ -31,4 +31,3 @@ selectors = {version = "0.7", features = ["heap_size"]}
string_cache = {version = "0.2.20", features = ["heap_size"]}
style = {path = "../style"}
url = {version = "1.0.0", features = ["heap_size"]}
util = {path = "../util"}
@@ -39,7 +39,6 @@ extern crate selectors;
extern crate string_cache;
extern crate style;
extern crate url;
extern crate util;

pub mod message;
pub mod reporter;
@@ -6,7 +6,7 @@ use app_units::Au;
use euclid::point::Point2D;
use euclid::rect::Rect;
use gfx_traits::{Epoch, LayerId};
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use ipc_channel::ipc::{IpcReceiver, IpcSender, OpaqueIpcSender};
use msg::constellation_msg::PipelineId;
use net_traits::image_cache_thread::ImageCacheThread;
use profile_traits::mem::ReportsChan;
@@ -20,7 +20,6 @@ use style::context::ReflowGoal;
use style::selector_impl::PseudoElement;
use style::stylesheets::Stylesheet;
use url::Url;
use util::ipc::OptionalOpaqueIpcSender;
use {OpaqueStyleAndLayoutData, TrustedNodeAddress};

/// Asynchronous messages that script can send to layout.
@@ -147,6 +146,6 @@ pub struct NewLayoutThreadInfo {
pub constellation_chan: IpcSender<ConstellationMsg>,
pub script_chan: IpcSender<ConstellationControlMsg>,
pub image_cache_thread: ImageCacheThread,
pub paint_chan: OptionalOpaqueIpcSender,
pub paint_chan: OpaqueIpcSender,
pub content_process_shutdown_chan: IpcSender<()>,
}
@@ -32,4 +32,3 @@ serde_macros = "0.7.11"
style_traits = {path = "../style_traits", features = ["servo"]}
time = "0.1.12"
url = {version = "1.0.0", features = ["heap_size"]}
util = {path = "../util"}
@@ -30,7 +30,6 @@ extern crate serde;
extern crate style_traits;
extern crate time;
extern crate url;
extern crate util;

mod script_msg;
pub mod webdriver_msg;
@@ -47,7 +46,7 @@ use gfx_traits::Epoch;
use gfx_traits::LayerId;
use gfx_traits::StackingContextId;
use heapsize::HeapSizeOf;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use ipc_channel::ipc::{IpcReceiver, IpcSender, OpaqueIpcSender};
use layers::geometry::DevicePixel;
use libc::c_void;
use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState, LoadData};
@@ -65,7 +64,6 @@ use std::fmt;
use std::sync::mpsc::{Sender, Receiver};
use style_traits::{PagePx, ViewportPx};
use url::Url;
use util::ipc::OptionalOpaqueIpcSender;
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};

pub use script_msg::{LayoutMsg, ScriptMsg, EventResult, LogEntry};
@@ -139,7 +137,7 @@ pub struct NewLayoutInfo {
pub load_data: LoadData,
/// The paint channel, cast to `OptionalOpaqueIpcSender`. This is really an
/// `Sender<LayoutToPaintMsg>`.
pub paint_chan: OptionalOpaqueIpcSender,
pub paint_chan: OpaqueIpcSender,
/// A port on which layout can receive messages from the pipeline.
pub pipeline_port: IpcReceiver<LayoutControlMsg>,
/// A sender for the layout thread to communicate to the constellation.

Some generated files are not rendered by default. Learn more.

@@ -11,16 +11,15 @@ path = "lib.rs"

[features]
# servo as opposed to geckolib
servo = ["serde", "serde_macros", "ipc-channel", "app_units/plugins",
"euclid/plugins", "euclid/unstable", "url/heap_size", "url/serde", "plugins"]
servo = ["serde", "serde_macros", "app_units/plugins", "euclid/plugins",
"euclid/unstable", "url/heap_size", "url/serde", "plugins"]

[dependencies]
app_units = "0.2.5"
bitflags = "0.7"
euclid = "0.7.1"
getopts = "0.2.11"
heapsize = "0.3.0"
ipc-channel = {git = "https://github.com/servo/ipc-channel", optional = true}
lazy_static = "0.2"
log = "0.3.5"
num_cpus = "0.2.2"
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.