Update crossbeam-channel to 0.3

This commit is contained in:
Bastien Orivel 2018-11-07 19:48:07 +01:00
parent 76195e0779
commit 9a7eeb349a
74 changed files with 303 additions and 521 deletions

View file

@ -16,6 +16,7 @@ unstable = ["parking_lot/nightly"]
[dependencies]
app_units = "0.7"
atomic_refcell = "0.1"
crossbeam-channel = "0.3"
embedder_traits = {path = "../embedder_traits"}
euclid = "0.19"
fnv = "1.0"
@ -47,7 +48,6 @@ serde_json = "1.0"
servo_allocator = {path = "../allocator"}
servo_arc = {path = "../servo_arc"}
servo_atoms = {path = "../atoms"}
servo_channel = {path = "../channel"}
servo_config = {path = "../config"}
servo_geometry = {path = "../geometry"}
servo_url = {path = "../url"}

View file

@ -5,6 +5,8 @@
//! The layout thread. Performs layout on the DOM, builds display lists and sends them to be
//! painted.
#[macro_use]
extern crate crossbeam_channel;
#[macro_use]
extern crate html5ever;
#[macro_use]
@ -15,14 +17,13 @@ extern crate lazy_static;
extern crate log;
#[macro_use]
extern crate profile_traits;
#[macro_use]
extern crate servo_channel;
mod dom_wrapper;
use app_units::Au;
use crate::dom_wrapper::drop_style_and_layout_data;
use crate::dom_wrapper::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode};
use crossbeam_channel::{unbounded, Receiver, Sender};
use embedder_traits::resources::{self, Resource};
use euclid::{Point2D, Rect, Size2D, TypedScale, TypedSize2D};
use fnv::FnvHashMap;
@ -33,6 +34,7 @@ use gfx::font_context;
use gfx_traits::{node_id_from_scroll_id, Epoch};
use histogram::Histogram;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use layout::animation;
use layout::construct::ConstructionResult;
use layout::context::malloc_size_of_persistent_local_context;
@ -82,7 +84,6 @@ use script_traits::{ScrollState, UntrustedNodeAddress};
use selectors::Element;
use servo_arc::Arc as ServoArc;
use servo_atoms::Atom;
use servo_channel::{channel, route_ipc_receiver_to_new_servo_receiver, Receiver, Sender};
use servo_config::opts;
use servo_config::prefs::PREFS;
use servo_geometry::MaxRect;
@ -474,14 +475,15 @@ impl LayoutThread {
debug!("Possible layout Threads: {}", layout_threads);
// Create the channel on which new animations can be sent.
let (new_animations_sender, new_animations_receiver) = channel();
let (new_animations_sender, new_animations_receiver) = unbounded();
// Proxy IPC messages from the pipeline to the layout thread.
let pipeline_receiver = route_ipc_receiver_to_new_servo_receiver(pipeline_port);
let pipeline_receiver = ROUTER.route_ipc_receiver_to_new_crossbeam_receiver(pipeline_port);
// Ask the router to proxy IPC messages from the font cache thread to the layout thread.
let (ipc_font_cache_sender, ipc_font_cache_receiver) = ipc::channel().unwrap();
let font_cache_receiver = route_ipc_receiver_to_new_servo_receiver(ipc_font_cache_receiver);
let font_cache_receiver =
ROUTER.route_ipc_receiver_to_new_crossbeam_receiver(ipc_font_cache_receiver);
LayoutThread {
id: id,
@ -612,9 +614,9 @@ impl LayoutThread {
}
let request = select! {
recv(self.pipeline_port.select(), msg) => Request::FromPipeline(msg.unwrap()),
recv(self.port.select(), msg) => Request::FromScript(msg.unwrap()),
recv(self.font_cache_receiver.select(), msg) => { msg.unwrap(); Request::FromFontCache }
recv(self.pipeline_port) -> msg => Request::FromPipeline(msg.unwrap()),
recv(self.port) -> msg => Request::FromScript(msg.unwrap()),
recv(self.font_cache_receiver) -> msg => { msg.unwrap(); Request::FromFontCache }
};
match request {