mirror of
https://github.com/servo/servo.git
synced 2025-07-16 03:43:38 +01:00
Replace mpsc with crossbeam/servo channel, update ipc-channel
Co-authored-by: Gregory Terzian <gterzian@users.noreply.github.com>
This commit is contained in:
parent
b977b4994c
commit
2a996fbc8f
89 changed files with 341 additions and 377 deletions
|
@ -14,7 +14,7 @@ bitflags = "1.0"
|
|||
bluetooth_traits = {path = "../bluetooth_traits"}
|
||||
device = {git = "https://github.com/servo/devices", features = ["bluetooth-test"]}
|
||||
embedder_traits = {path = "../embedder_traits"}
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
log = "0.4"
|
||||
servo_config = {path = "../config"}
|
||||
servo_rand = {path = "../rand"}
|
||||
|
|
|
@ -10,7 +10,7 @@ name = "bluetooth_traits"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
regex = "1.0"
|
||||
serde = "1.0"
|
||||
embedder_traits = { path = "../embedder_traits" }
|
||||
|
|
|
@ -17,7 +17,7 @@ cssparser = "0.24"
|
|||
euclid = "0.19"
|
||||
fnv = "1.0"
|
||||
gleam = "0.6"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
log = "0.4"
|
||||
num-traits = "0.2"
|
||||
offscreen_gl_context = {version = "0.21", features = ["serde", "osmesa"]}
|
||||
|
|
|
@ -12,7 +12,7 @@ path = "lib.rs"
|
|||
[dependencies]
|
||||
cssparser = "0.24.0"
|
||||
euclid = "0.19"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
gleam = "0.6"
|
||||
lazy_static = "1"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
|
|
|
@ -19,13 +19,14 @@ euclid = "0.19"
|
|||
gfx_traits = {path = "../gfx_traits"}
|
||||
gleam = {version = "0.6", optional = true}
|
||||
image = "0.19"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
libc = "0.2"
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
net_traits = {path = "../net_traits"}
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
script_traits = {path = "../script_traits"}
|
||||
servo_channel = {path = "../channel"}
|
||||
servo_config = {path = "../config"}
|
||||
servo_geometry = {path = "../geometry"}
|
||||
servo_url = {path = "../url"}
|
||||
|
|
|
@ -23,6 +23,7 @@ use script_traits::{AnimationState, AnimationTickType, ConstellationMsg, LayoutC
|
|||
use script_traits::{MouseButton, MouseEventType, ScrollState, TouchEventType, TouchId};
|
||||
use script_traits::{UntrustedNodeAddress, WindowSizeData, WindowSizeType};
|
||||
use script_traits::CompositorEvent::{MouseMoveEvent, MouseButtonEvent, TouchEvent};
|
||||
use servo_channel::Sender;
|
||||
use servo_config::opts;
|
||||
use servo_geometry::DeviceIndependentPixel;
|
||||
use std::collections::HashMap;
|
||||
|
@ -31,7 +32,6 @@ use std::fs::{File, create_dir_all};
|
|||
use std::io::Write;
|
||||
use std::num::NonZeroU32;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::Sender;
|
||||
use std::time::Instant;
|
||||
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
|
||||
use style_traits::cursor::CursorKind;
|
||||
|
@ -358,7 +358,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
fn start_shutting_down(&mut self) {
|
||||
debug!("Compositor sending Exit message to Constellation");
|
||||
if let Err(e) = self.constellation_chan.send(ConstellationMsg::Exit) {
|
||||
warn!("Sending exit message to constellation failed ({}).", e);
|
||||
warn!("Sending exit message to constellation failed ({:?}).", e);
|
||||
}
|
||||
|
||||
self.shutdown_state = ShutdownState::ShuttingDown;
|
||||
|
@ -420,7 +420,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
let img = res.unwrap_or(None);
|
||||
if let Err(e) = reply.send(img) {
|
||||
warn!("Sending reply to create png failed ({}).", e);
|
||||
warn!("Sending reply to create png failed ({:?}).", e);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -494,19 +494,19 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
|
||||
(Msg::GetClientWindow(req), ShutdownState::NotShuttingDown) => {
|
||||
if let Err(e) = req.send(self.embedder_coordinates.window) {
|
||||
warn!("Sending response to get client window failed ({}).", e);
|
||||
warn!("Sending response to get client window failed ({:?}).", e);
|
||||
}
|
||||
},
|
||||
|
||||
(Msg::GetScreenSize(req), ShutdownState::NotShuttingDown) => {
|
||||
if let Err(e) = req.send(self.embedder_coordinates.screen) {
|
||||
warn!("Sending response to get screen size failed ({}).", e);
|
||||
warn!("Sending response to get screen size failed ({:?}).", e);
|
||||
}
|
||||
},
|
||||
|
||||
(Msg::GetScreenAvailSize(req), ShutdownState::NotShuttingDown) => {
|
||||
if let Err(e) = req.send(self.embedder_coordinates.screen_avail) {
|
||||
warn!("Sending response to get screen avail size failed ({}).", e);
|
||||
warn!("Sending response to get screen avail size failed ({:?}).", e);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -634,7 +634,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
let msg = ConstellationMsg::WindowSize(top_level_browsing_context_id, data, size_type);
|
||||
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending window resize to constellation failed ({}).", e);
|
||||
warn!("Sending window resize to constellation failed ({:?}).", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
let pipeline_id = PipelineId::from_webrender(result.pipeline);
|
||||
let msg = ConstellationMsg::ForwardEvent(pipeline_id, event_to_send);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending event to constellation failed ({}).", e);
|
||||
warn!("Sending event to constellation failed ({:?}).", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -743,13 +743,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
let pipeline_id = PipelineId::from_webrender(item.pipeline);
|
||||
let msg = ConstellationMsg::ForwardEvent(pipeline_id, event);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending event to constellation failed ({}).", e);
|
||||
warn!("Sending event to constellation failed ({:?}).", e);
|
||||
}
|
||||
|
||||
if let Some(cursor) = CursorKind::from_u8(item.tag.1 as _).ok() {
|
||||
let msg = ConstellationMsg::SetCursor(cursor);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending event to constellation failed ({}).", e);
|
||||
warn!("Sending event to constellation failed ({:?}).", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -772,7 +772,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
let pipeline_id = PipelineId::from_webrender(item.pipeline);
|
||||
let msg = ConstellationMsg::ForwardEvent(pipeline_id, event);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending event to constellation failed ({}).", e);
|
||||
warn!("Sending event to constellation failed ({:?}).", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1008,7 +1008,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
if animation_callbacks_running {
|
||||
let msg = ConstellationMsg::TickAnimation(pipeline_id, AnimationTickType::Script);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending tick to constellation failed ({}).", e);
|
||||
warn!("Sending tick to constellation failed ({:?}).", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
if animations_running {
|
||||
let msg = ConstellationMsg::TickAnimation(pipeline_id, AnimationTickType::Layout);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending tick to constellation failed ({}).", e);
|
||||
warn!("Sending tick to constellation failed ({:?}).", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1160,7 +1160,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
// if it's safe to output the image.
|
||||
let msg = ConstellationMsg::IsReadyToSaveImage(pipeline_epochs);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending ready to save to constellation failed ({}).", e);
|
||||
warn!("Sending ready to save to constellation failed ({:?}).", e);
|
||||
}
|
||||
self.ready_to_save_state = ReadyState::WaitingForConstellationReply;
|
||||
Err(NotReadyToPaint::JustNotifiedConstellation)
|
||||
|
@ -1288,8 +1288,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
if let Some(pipeline) = self.pipeline(*id) {
|
||||
// and inform the layout thread with the measured paint time.
|
||||
let msg = LayoutControlMsg::PaintMetric(epoch, paint_time);
|
||||
if let Err(e) = pipeline.layout_chan.send(msg) {
|
||||
warn!("Sending PaintMetric message to layout failed ({}).", e);
|
||||
if let Err(e) = pipeline.layout_chan.send(msg) {
|
||||
warn!("Sending PaintMetric message to layout failed ({:?}).", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ use net_traits::image::base::Image;
|
|||
use profile_traits::mem;
|
||||
use profile_traits::time;
|
||||
use script_traits::{AnimationState, ConstellationMsg, EventResult};
|
||||
use servo_channel::{Receiver, Sender};
|
||||
use std::fmt::{Debug, Error, Formatter};
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
use webrender;
|
||||
use webrender_api::{self, DeviceIntPoint, DeviceUintSize};
|
||||
|
@ -28,9 +28,8 @@ pub struct CompositorProxy {
|
|||
|
||||
impl CompositorProxy {
|
||||
pub fn send(&self, msg: Msg) {
|
||||
// Send a message and kick the OS event loop awake.
|
||||
if let Err(err) = self.sender.send(msg) {
|
||||
warn!("Failed to send response ({}).", err);
|
||||
warn!("Failed to send response ({:?}).", err);
|
||||
}
|
||||
self.event_loop_waker.wake();
|
||||
}
|
||||
|
@ -52,7 +51,7 @@ pub struct CompositorReceiver {
|
|||
|
||||
impl CompositorReceiver {
|
||||
pub fn try_recv_compositor_msg(&mut self) -> Option<Msg> {
|
||||
self.receiver.try_recv().ok()
|
||||
self.receiver.try_recv()
|
||||
}
|
||||
pub fn recv_compositor_msg(&mut self) -> Msg {
|
||||
self.receiver.recv().unwrap()
|
||||
|
|
|
@ -19,6 +19,7 @@ extern crate msg;
|
|||
extern crate net_traits;
|
||||
extern crate profile_traits;
|
||||
extern crate script_traits;
|
||||
extern crate servo_channel;
|
||||
extern crate servo_config;
|
||||
extern crate servo_geometry;
|
||||
extern crate servo_url;
|
||||
|
|
|
@ -23,7 +23,7 @@ embedder_traits = { path = "../embedder_traits" }
|
|||
gfx = {path = "../gfx"}
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
hyper = "0.10"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
layout_traits = {path = "../layout_traits"}
|
||||
log = "0.4"
|
||||
metrics = {path = "../metrics"}
|
||||
|
@ -33,6 +33,7 @@ net_traits = {path = "../net_traits"}
|
|||
profile_traits = {path = "../profile_traits"}
|
||||
script_traits = {path = "../script_traits"}
|
||||
serde = "1.0"
|
||||
servo_channel = {path = "../channel"}
|
||||
style_traits = {path = "../style_traits"}
|
||||
servo_config = {path = "../config"}
|
||||
servo_rand = {path = "../rand"}
|
||||
|
|
|
@ -132,6 +132,7 @@ use script_traits::{LogEntry, ScriptToConstellationChan, ServiceWorkerMsg, webdr
|
|||
use script_traits::{SWManagerMsg, ScopeThings, UpdatePipelineIdReason, WebDriverCommandMsg};
|
||||
use script_traits::{WindowSizeData, WindowSizeType};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use servo_channel::{Receiver, Sender, channel};
|
||||
use servo_config::opts;
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_rand::{Rng, SeedableRng, ServoRng, random};
|
||||
|
@ -145,7 +146,6 @@ use std::mem::replace;
|
|||
use std::process;
|
||||
use std::rc::{Rc, Weak};
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
use std::thread;
|
||||
use style_traits::CSSPixel;
|
||||
use style_traits::cursor::CursorKind;
|
||||
|
@ -875,7 +875,6 @@ where
|
|||
}
|
||||
|
||||
/// Handles loading pages, navigation, and granting access to the compositor
|
||||
#[allow(unsafe_code)]
|
||||
fn handle_request(&mut self) {
|
||||
enum Request {
|
||||
Script((PipelineId, FromScriptMsg)),
|
||||
|
@ -896,25 +895,23 @@ where
|
|||
// produces undefined behaviour, resulting in the destructor
|
||||
// being called. If this happens, there's not much we can do
|
||||
// other than panic.
|
||||
let request = {
|
||||
let receiver_from_script = &self.script_receiver;
|
||||
let receiver_from_compositor = &self.compositor_receiver;
|
||||
let receiver_from_layout = &self.layout_receiver;
|
||||
let receiver_from_network_listener = &self.network_listener_receiver;
|
||||
let receiver_from_swmanager = &self.swmanager_receiver;
|
||||
select! {
|
||||
msg = receiver_from_script.recv() =>
|
||||
msg.expect("Unexpected script channel panic in constellation").map(Request::Script),
|
||||
msg = receiver_from_compositor.recv() =>
|
||||
Ok(Request::Compositor(msg.expect("Unexpected compositor channel panic in constellation"))),
|
||||
msg = receiver_from_layout.recv() =>
|
||||
msg.expect("Unexpected layout channel panic in constellation").map(Request::Layout),
|
||||
msg = receiver_from_network_listener.recv() =>
|
||||
Ok(Request::NetworkListener(
|
||||
msg.expect("Unexpected network listener channel panic in constellation")
|
||||
)),
|
||||
msg = receiver_from_swmanager.recv() =>
|
||||
msg.expect("Unexpected panic channel panic in constellation").map(Request::FromSWManager)
|
||||
let request = select! {
|
||||
recv(self.script_receiver.select(), msg) => {
|
||||
msg.expect("Unexpected script channel panic in constellation").map(Request::Script)
|
||||
}
|
||||
recv(self.compositor_receiver.select(), msg) => {
|
||||
Ok(Request::Compositor(msg.expect("Unexpected compositor channel panic in constellation")))
|
||||
}
|
||||
recv(self.layout_receiver.select(), msg) => {
|
||||
msg.expect("Unexpected layout channel panic in constellation").map(Request::Layout)
|
||||
}
|
||||
recv(self.network_listener_receiver.select(), msg) => {
|
||||
Ok(Request::NetworkListener(
|
||||
msg.expect("Unexpected network listener channel panic in constellation")
|
||||
))
|
||||
}
|
||||
recv(self.swmanager_receiver.select(), msg) => {
|
||||
msg.expect("Unexpected panic channel panic in constellation").map(Request::FromSWManager)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1442,7 +1439,7 @@ where
|
|||
debug!("Exiting devtools.");
|
||||
let msg = DevtoolsControlMsg::FromChrome(ChromeToDevtoolsControlMsg::ServerExitMsg);
|
||||
if let Err(e) = chan.send(msg) {
|
||||
warn!("Exit devtools failed ({})", e);
|
||||
warn!("Exit devtools failed ({:?})", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#![deny(unsafe_code)]
|
||||
#![cfg_attr(feature = "unstable", feature(conservative_impl_trait))]
|
||||
#![feature(mpsc_select)]
|
||||
|
||||
extern crate backtrace;
|
||||
extern crate bluetooth_traits;
|
||||
|
@ -32,7 +31,6 @@ extern crate net;
|
|||
extern crate net_traits;
|
||||
extern crate profile_traits;
|
||||
extern crate script_traits;
|
||||
#[macro_use]
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate servo_channel;
|
||||
|
|
|
@ -15,7 +15,7 @@ use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseMsg
|
|||
use net_traits::{IpcSend, NetworkError, ResourceThreads};
|
||||
use net_traits::request::{Destination, RequestInit};
|
||||
use net_traits::response::ResponseInit;
|
||||
use std::sync::mpsc::Sender;
|
||||
use servo_channel::Sender;
|
||||
|
||||
pub struct NetworkListener {
|
||||
res_init: Option<ResponseInit>,
|
||||
|
|
|
@ -28,6 +28,7 @@ use script_traits::{DocumentActivity, InitialScriptState};
|
|||
use script_traits::{LayoutControlMsg, LayoutMsg, LoadData};
|
||||
use script_traits::{NewLayoutInfo, SWManagerMsg, SWManagerSenders};
|
||||
use script_traits::{ScriptThreadFactory, TimerSchedulerMsg, WindowSizeData};
|
||||
use servo_channel::Sender;
|
||||
use servo_config::opts::{self, Opts};
|
||||
use servo_config::prefs::{PREFS, Pref};
|
||||
use servo_url::ServoUrl;
|
||||
|
@ -38,7 +39,6 @@ use std::ffi::OsStr;
|
|||
use std::process;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::Sender;
|
||||
use style_traits::CSSPixel;
|
||||
use style_traits::DevicePixel;
|
||||
use webrender_api;
|
||||
|
@ -255,7 +255,7 @@ impl Pipeline {
|
|||
Ok(message) => if let Err(e) =
|
||||
devtools_chan.send(DevtoolsControlMsg::FromScript(message))
|
||||
{
|
||||
warn!("Sending to devtools failed ({})", e)
|
||||
warn!("Sending to devtools failed ({:?})", e)
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use script_traits::{TimerEvent, TimerEventRequest, TimerSchedulerMsg};
|
||||
use servo_channel::base_channel;
|
||||
use std::cmp::{self, Ord};
|
||||
use std::collections::BinaryHeap;
|
||||
use servo_channel::base_channel;
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
|
@ -69,26 +69,29 @@ impl TimerScheduler {
|
|||
scheduled_events.pop();
|
||||
}
|
||||
// Look to see if there are any incoming events
|
||||
match req_receiver.try_recv() {
|
||||
// If there is an event, add it to the priority queue
|
||||
Ok(TimerSchedulerMsg::Request(req)) => {
|
||||
let TimerEventRequest(_, _, _, delay) = req;
|
||||
let schedule = Instant::now() + Duration::from_millis(delay.get());
|
||||
let event = ScheduledEvent {
|
||||
request: req,
|
||||
for_time: schedule,
|
||||
};
|
||||
scheduled_events.push(event);
|
||||
select! {
|
||||
recv(req_receiver, msg) => match msg {
|
||||
// If there is an event, add it to the priority queue
|
||||
Some(TimerSchedulerMsg::Request(req)) => {
|
||||
let TimerEventRequest(_, _, _, delay) = req;
|
||||
let schedule = Instant::now() + Duration::from_millis(delay.get());
|
||||
let event = ScheduledEvent {
|
||||
request: req,
|
||||
for_time: schedule,
|
||||
};
|
||||
scheduled_events.push(event);
|
||||
},
|
||||
// If the channel is closed or we are shutting down, we are done.
|
||||
Some(TimerSchedulerMsg::Exit) |
|
||||
None => break,
|
||||
},
|
||||
// If there is no incoming event, park the thread,
|
||||
// it will either be unparked when a new event arrives,
|
||||
// or by a timeout.
|
||||
Err(Empty) => match scheduled_events.peek() {
|
||||
default => match scheduled_events.peek() {
|
||||
None => thread::park(),
|
||||
Some(event) => thread::park_timeout(event.for_time - now),
|
||||
},
|
||||
// If the channel is closed or we are shutting down, we are done.
|
||||
Ok(TimerSchedulerMsg::Exit) | Err(Disconnected) => break,
|
||||
}
|
||||
}
|
||||
// This thread can terminate if the req_ipc_sender is dropped.
|
||||
|
|
|
@ -12,4 +12,5 @@ crate_type = ["rlib"]
|
|||
|
||||
[dependencies]
|
||||
log = "0.4"
|
||||
servo_channel = {path = "../channel"}
|
||||
ws = "0.7.3"
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate servo_channel;
|
||||
extern crate ws;
|
||||
|
||||
use std::sync::mpsc;
|
||||
use std::sync::mpsc::channel;
|
||||
use std::thread;
|
||||
use ws::{Builder, CloseCode, Handler, Handshake};
|
||||
|
||||
|
@ -15,7 +14,7 @@ enum Message {
|
|||
ShutdownServer,
|
||||
}
|
||||
|
||||
pub struct Sender(mpsc::Sender<Message>);
|
||||
pub struct Sender(servo_channel::Sender<Message>);
|
||||
|
||||
struct Connection {
|
||||
sender: ws::Sender,
|
||||
|
@ -38,7 +37,7 @@ impl Handler for Connection {
|
|||
|
||||
pub fn start_server(port: u16) -> Sender {
|
||||
debug!("Starting server.");
|
||||
let (sender, receiver) = channel();
|
||||
let (sender, receiver) = servo_channel::channel();
|
||||
thread::Builder::new()
|
||||
.name("debugger".to_owned())
|
||||
.spawn(move || {
|
||||
|
@ -51,7 +50,7 @@ pub fn start_server(port: u16) -> Sender {
|
|||
.spawn(move || {
|
||||
socket.listen(("127.0.0.1", port)).unwrap();
|
||||
}).expect("Thread spawning failed");
|
||||
while let Ok(message) = receiver.recv() {
|
||||
while let Some(message) = receiver.recv() {
|
||||
match message {
|
||||
Message::ShutdownServer => {
|
||||
break;
|
||||
|
|
|
@ -13,9 +13,10 @@ path = "lib.rs"
|
|||
devtools_traits = {path = "../devtools_traits"}
|
||||
hyper = "0.10"
|
||||
hyper_serde = "0.8"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
servo_channel = {path = "../channel"}
|
||||
time = "0.1"
|
||||
|
|
|
@ -21,6 +21,7 @@ extern crate msg;
|
|||
#[macro_use]
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
extern crate servo_channel;
|
||||
extern crate time;
|
||||
|
||||
use actor::{Actor, ActorRegistry};
|
||||
|
@ -41,13 +42,13 @@ use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
|||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use protocol::JsonPacketStream;
|
||||
use servo_channel::{Receiver, Sender, channel};
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||
use std::net::{Shutdown, TcpListener, TcpStream};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
use std::thread;
|
||||
use time::precise_time_ns;
|
||||
|
||||
|
@ -509,7 +510,7 @@ fn run_server(
|
|||
}
|
||||
}).expect("Thread spawning failed");
|
||||
|
||||
while let Ok(msg) = receiver.recv() {
|
||||
while let Some(msg) = receiver.recv() {
|
||||
match msg {
|
||||
DevtoolsControlMsg::FromChrome(ChromeToDevtoolsControlMsg::AddClient(stream)) => {
|
||||
let actors = actors.clone();
|
||||
|
|
|
@ -13,7 +13,7 @@ path = "lib.rs"
|
|||
bitflags = "1.0"
|
||||
hyper = "0.10"
|
||||
hyper_serde = "0.8"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
msg = {path = "../msg"}
|
||||
|
|
|
@ -13,11 +13,12 @@ path = "lib.rs"
|
|||
tests = []
|
||||
|
||||
[dependencies]
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
lazy_static = "1"
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
serde = "1.0"
|
||||
servo_channel = {path = "../channel"}
|
||||
servo_url = {path = "../url"}
|
||||
style_traits = {path = "../style_traits"}
|
||||
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||
|
|
|
@ -10,6 +10,7 @@ extern crate log;
|
|||
extern crate msg;
|
||||
#[macro_use]
|
||||
extern crate serde;
|
||||
extern crate servo_channel;
|
||||
extern crate servo_url;
|
||||
extern crate style_traits;
|
||||
extern crate webrender_api;
|
||||
|
@ -18,9 +19,9 @@ pub mod resources;
|
|||
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::{InputMethodType, Key, KeyModifiers, KeyState, TopLevelBrowsingContextId};
|
||||
use servo_channel::{Receiver, Sender};
|
||||
use servo_url::ServoUrl;
|
||||
use std::fmt::{Debug, Error, Formatter};
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
use style_traits::cursor::CursorKind;
|
||||
use webrender_api::{DeviceIntPoint, DeviceUintSize};
|
||||
|
||||
|
@ -40,7 +41,7 @@ impl EmbedderProxy {
|
|||
pub fn send(&self, msg: (Option<TopLevelBrowsingContextId>, EmbedderMsg)) {
|
||||
// Send a message and kick the OS event loop awake.
|
||||
if let Err(err) = self.sender.send(msg) {
|
||||
warn!("Failed to send response ({}).", err);
|
||||
warn!("Failed to send response ({:?}).", err);
|
||||
}
|
||||
self.event_loop_waker.wake();
|
||||
}
|
||||
|
@ -64,7 +65,7 @@ impl EmbedderReceiver {
|
|||
pub fn try_recv_embedder_msg(
|
||||
&mut self,
|
||||
) -> Option<(Option<TopLevelBrowsingContextId>, EmbedderMsg)> {
|
||||
self.receiver.try_recv().ok()
|
||||
self.receiver.try_recv()
|
||||
}
|
||||
pub fn recv_embedder_msg(&mut self) -> (Option<TopLevelBrowsingContextId>, EmbedderMsg) {
|
||||
self.receiver.recv().unwrap()
|
||||
|
|
|
@ -23,7 +23,7 @@ fnv = "1.0"
|
|||
fontsan = {git = "https://github.com/servo/fontsan"}
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
harfbuzz-sys = "0.2"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
lazy_static = "1"
|
||||
libc = "0.2"
|
||||
log = "0.4"
|
||||
|
|
|
@ -22,7 +22,7 @@ fxhash = "0.2"
|
|||
gfx = {path = "../gfx"}
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
html5ever = "0.22"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
libc = "0.2"
|
||||
log = "0.4"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
|
@ -39,6 +39,7 @@ selectors = { path = "../selectors" }
|
|||
serde = "1.0"
|
||||
servo_arc = {path = "../servo_arc"}
|
||||
servo_atoms = {path = "../atoms"}
|
||||
servo_channel = {path = "../channel"}
|
||||
servo_geometry = {path = "../geometry"}
|
||||
serde_json = "1.0"
|
||||
servo_config = {path = "../config"}
|
||||
|
|
|
@ -13,7 +13,7 @@ use msg::constellation_msg::PipelineId;
|
|||
use opaque_node::OpaqueNodeMethods;
|
||||
use script_traits::{AnimationState, ConstellationControlMsg, LayoutMsg as ConstellationMsg};
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
use std::sync::mpsc::Receiver;
|
||||
use servo_channel::Receiver;
|
||||
use style::animation::{Animation, update_style_for_animation};
|
||||
use style::dom::TElement;
|
||||
use style::font_metrics::ServoMetricsProvider;
|
||||
|
@ -36,7 +36,7 @@ pub fn update_animation_state<E>(
|
|||
E: TElement,
|
||||
{
|
||||
let mut new_running_animations = vec![];
|
||||
while let Ok(animation) = new_animations_receiver.try_recv() {
|
||||
while let Some(animation) = new_animations_receiver.try_recv() {
|
||||
let mut should_push = true;
|
||||
if let Animation::Keyframes(ref node, _, ref name, ref state) = animation {
|
||||
// If the animation was already present in the list for the
|
||||
|
|
|
@ -36,6 +36,7 @@ extern crate serde;
|
|||
extern crate serde_json;
|
||||
extern crate servo_arc;
|
||||
extern crate servo_atoms;
|
||||
extern crate servo_channel;
|
||||
extern crate servo_config;
|
||||
extern crate servo_geometry;
|
||||
extern crate servo_url;
|
||||
|
|
|
@ -23,7 +23,7 @@ gfx = {path = "../gfx"}
|
|||
gfx_traits = {path = "../gfx_traits"}
|
||||
histogram = "0.6.8"
|
||||
html5ever = "0.22"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
layout = {path = "../layout"}
|
||||
layout_traits = {path = "../layout_traits"}
|
||||
lazy_static = "1"
|
||||
|
@ -46,6 +46,7 @@ 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"}
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
//! The layout thread. Performs layout on the DOM, builds display lists and sends them to be
|
||||
//! painted.
|
||||
|
||||
#![feature(mpsc_select)]
|
||||
|
||||
extern crate app_units;
|
||||
extern crate atomic_refcell;
|
||||
extern crate embedder_traits;
|
||||
|
@ -69,7 +67,6 @@ use gfx::font_context;
|
|||
use gfx_traits::{Epoch, node_id_from_scroll_id};
|
||||
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::LayoutContext;
|
||||
|
@ -113,6 +110,7 @@ use script_traits::Painter;
|
|||
use selectors::Element;
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use servo_atoms::Atom;
|
||||
use servo_channel::{Receiver, Sender, channel, route_ipc_receiver_to_new_servo_receiver};
|
||||
use servo_config::opts;
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_geometry::MaxRect;
|
||||
|
@ -125,7 +123,6 @@ use std::ops::{Deref, DerefMut};
|
|||
use std::process;
|
||||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
use std::thread;
|
||||
use style::animation::Animation;
|
||||
use style::context::{QuirksMode, RegisteredSpeculativePainter, RegisteredSpeculativePainters};
|
||||
|
@ -506,12 +503,12 @@ impl LayoutThread {
|
|||
let (new_animations_sender, new_animations_receiver) = channel();
|
||||
|
||||
// Proxy IPC messages from the pipeline to the layout thread.
|
||||
let pipeline_receiver = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(pipeline_port);
|
||||
let pipeline_receiver = route_ipc_receiver_to_new_servo_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 =
|
||||
ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_font_cache_receiver);
|
||||
route_ipc_receiver_to_new_servo_receiver(ipc_font_cache_receiver);
|
||||
|
||||
LayoutThread {
|
||||
id: id,
|
||||
|
@ -641,22 +638,10 @@ impl LayoutThread {
|
|||
FromFontCache,
|
||||
}
|
||||
|
||||
let request = {
|
||||
let port_from_script = &self.port;
|
||||
let port_from_pipeline = &self.pipeline_port;
|
||||
let port_from_font_cache = &self.font_cache_receiver;
|
||||
select! {
|
||||
msg = port_from_pipeline.recv() => {
|
||||
Request::FromPipeline(msg.unwrap())
|
||||
},
|
||||
msg = port_from_script.recv() => {
|
||||
Request::FromScript(msg.unwrap())
|
||||
},
|
||||
msg = port_from_font_cache.recv() => {
|
||||
msg.unwrap();
|
||||
Request::FromFontCache
|
||||
}
|
||||
}
|
||||
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 }
|
||||
};
|
||||
|
||||
match request {
|
||||
|
|
|
@ -11,11 +11,12 @@ path = "lib.rs"
|
|||
|
||||
[dependencies]
|
||||
gfx = {path = "../gfx"}
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
metrics = {path = "../metrics"}
|
||||
msg = {path = "../msg"}
|
||||
net_traits = {path = "../net_traits"}
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
script_traits = {path = "../script_traits"}
|
||||
servo_channel = {path = "../channel"}
|
||||
servo_url = {path = "../url"}
|
||||
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||
|
|
|
@ -11,6 +11,7 @@ extern crate msg;
|
|||
extern crate net_traits;
|
||||
extern crate profile_traits;
|
||||
extern crate script_traits;
|
||||
extern crate servo_channel;
|
||||
extern crate servo_url;
|
||||
extern crate webrender_api;
|
||||
|
||||
|
@ -28,9 +29,9 @@ use net_traits::image_cache::ImageCache;
|
|||
use profile_traits::{mem, time};
|
||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg};
|
||||
use script_traits::LayoutMsg as ConstellationMsg;
|
||||
use servo_channel::{Receiver, Sender};
|
||||
use servo_url::ServoUrl;
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
|
||||
// A static method creating a layout thread
|
||||
// Here to remove the compositor -> layout dependency
|
||||
|
|
|
@ -34,6 +34,7 @@ selectors = { path = "../selectors" }
|
|||
serde = { version = "1.0.27", optional = true }
|
||||
serde_bytes = { version = "0.10", optional = true }
|
||||
servo_arc = { path = "../servo_arc" }
|
||||
servo_channel = {path = "../channel"}
|
||||
smallbitvec = "2.1.0"
|
||||
smallvec = "0.6"
|
||||
string_cache = { version = "0.7", optional = true }
|
||||
|
|
|
@ -59,6 +59,7 @@ extern crate serde;
|
|||
#[cfg(feature = "servo")]
|
||||
extern crate serde_bytes;
|
||||
extern crate servo_arc;
|
||||
extern crate servo_channel;
|
||||
extern crate smallbitvec;
|
||||
extern crate smallvec;
|
||||
#[cfg(feature = "servo")]
|
||||
|
@ -1023,7 +1024,7 @@ where
|
|||
|
||||
// Placeholder for unique case where internals of Sender cannot be measured.
|
||||
// malloc size of is 0 macro complains about type supplied!
|
||||
impl<T> MallocSizeOf for std::sync::mpsc::Sender<T> {
|
||||
impl<T> MallocSizeOf for servo_channel::Sender<T> {
|
||||
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
|
||||
0
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ path = "lib.rs"
|
|||
|
||||
[dependencies]
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
log = "0.4"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
|
|
|
@ -23,7 +23,7 @@ hyper = "0.10"
|
|||
hyper_serde = "0.8"
|
||||
hyper-openssl = "0.2.2"
|
||||
immeta = "0.4"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
lazy_static = "1"
|
||||
log = "0.4"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
|
@ -39,6 +39,7 @@ serde = "1.0"
|
|||
serde_json = "1.0"
|
||||
servo_allocator = {path = "../allocator"}
|
||||
servo_arc = {path = "../servo_arc"}
|
||||
servo_channel = {path = "../channel"}
|
||||
servo_config = {path = "../config"}
|
||||
servo_url = {path = "../url"}
|
||||
threadpool = "1.0"
|
||||
|
|
|
@ -21,6 +21,7 @@ use net_traits::{FetchTaskTarget, NetworkError, ReferrerPolicy};
|
|||
use net_traits::request::{CredentialsMode, Destination, Referrer, Request, RequestMode};
|
||||
use net_traits::request::{ResponseTainting, Origin, Window};
|
||||
use net_traits::response::{Response, ResponseBody, ResponseType};
|
||||
use servo_channel::{channel, Sender, Receiver};
|
||||
use servo_url::ServoUrl;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
|
@ -30,7 +31,6 @@ use std::mem;
|
|||
use std::str;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::mpsc::{Sender, Receiver, channel};
|
||||
use std::thread;
|
||||
use subresource_integrity::is_response_integrity_valid;
|
||||
|
||||
|
|
|
@ -20,13 +20,13 @@ use net_traits::{Metadata, FetchMetadata};
|
|||
use net_traits::request::Request;
|
||||
use net_traits::response::{HttpsState, Response, ResponseBody};
|
||||
use servo_arc::Arc;
|
||||
use servo_channel::{Sender, channel};
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_url::ServoUrl;
|
||||
use std::collections::HashMap;
|
||||
use std::str;
|
||||
use std::sync::Mutex;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::{channel, Sender};
|
||||
use time;
|
||||
use time::{Duration, Tm};
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ use net_traits::request::{RedirectMode, Referrer, Request, RequestMode};
|
|||
use net_traits::request::{ResponseTainting, ServiceWorkersMode};
|
||||
use net_traits::response::{HttpsState, Response, ResponseBody, ResponseType};
|
||||
use resource_thread::AuthCache;
|
||||
use servo_channel::{channel, Sender};
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::error::Error;
|
||||
|
@ -48,7 +49,6 @@ use std::mem;
|
|||
use std::ops::Deref;
|
||||
use std::str::FromStr;
|
||||
use std::sync::RwLock;
|
||||
use std::sync::mpsc::{channel, Sender};
|
||||
use std::thread;
|
||||
use time;
|
||||
use time::Tm;
|
||||
|
|
|
@ -33,6 +33,7 @@ extern crate profile_traits;
|
|||
extern crate serde_json;
|
||||
extern crate servo_allocator;
|
||||
extern crate servo_arc;
|
||||
extern crate servo_channel;
|
||||
extern crate servo_config;
|
||||
extern crate servo_url;
|
||||
extern crate time;
|
||||
|
|
|
@ -32,6 +32,7 @@ use profile_traits::time::ProfilerChan;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use serde_json;
|
||||
use servo_allocator;
|
||||
use servo_channel::Sender;
|
||||
use servo_config::opts;
|
||||
use servo_url::ServoUrl;
|
||||
use std::borrow::{Cow, ToOwned};
|
||||
|
@ -42,7 +43,6 @@ use std::io::prelude::*;
|
|||
use std::ops::Deref;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::sync::mpsc::Sender;
|
||||
use std::thread;
|
||||
use storage_thread::StorageThreadFactory;
|
||||
use websocket_loader;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use {DEFAULT_USER_AGENT, new_fetch_context, create_embedder_proxy, fetch, make_server};
|
||||
use devtools_traits::DevtoolsControlMsg;
|
||||
use devtools_traits::HttpRequest as DevtoolsHttpRequest;
|
||||
use devtools_traits::HttpResponse as DevtoolsHttpResponse;
|
||||
use fetch_with_context;
|
||||
|
@ -34,13 +33,13 @@ use net_traits::NetworkError;
|
|||
use net_traits::ReferrerPolicy;
|
||||
use net_traits::request::{Destination, Origin, RedirectMode, Referrer, Request, RequestMode};
|
||||
use net_traits::response::{CacheState, Response, ResponseBody, ResponseType};
|
||||
use servo_channel::{channel, Sender};
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::mpsc::{Sender, channel};
|
||||
use time::{self, Duration};
|
||||
use unicase::UniCase;
|
||||
|
||||
|
@ -774,17 +773,17 @@ fn test_fetch_redirect_updates_method() {
|
|||
assert_eq!(rx.recv().unwrap(), true);
|
||||
assert_eq!(rx.recv().unwrap(), true);
|
||||
// make sure the test doesn't send more data than expected
|
||||
assert_eq!(rx.try_recv().is_err(), true);
|
||||
assert_eq!(rx.try_recv().is_none(), true);
|
||||
|
||||
test_fetch_redirect_updates_method_runner(tx.clone(), StatusCode::Found, Method::Post);
|
||||
assert_eq!(rx.recv().unwrap(), true);
|
||||
assert_eq!(rx.recv().unwrap(), true);
|
||||
assert_eq!(rx.try_recv().is_err(), true);
|
||||
assert_eq!(rx.try_recv().is_none(), true);
|
||||
|
||||
test_fetch_redirect_updates_method_runner(tx.clone(), StatusCode::SeeOther, Method::Get);
|
||||
assert_eq!(rx.recv().unwrap(), true);
|
||||
assert_eq!(rx.recv().unwrap(), true);
|
||||
assert_eq!(rx.try_recv().is_err(), true);
|
||||
assert_eq!(rx.try_recv().is_none(), true);
|
||||
|
||||
let extension = Method::Extension("FOO".to_owned());
|
||||
|
||||
|
@ -792,18 +791,18 @@ fn test_fetch_redirect_updates_method() {
|
|||
assert_eq!(rx.recv().unwrap(), true);
|
||||
// for MovedPermanently and Found, Method should only be changed if it was Post
|
||||
assert_eq!(rx.recv().unwrap(), false);
|
||||
assert_eq!(rx.try_recv().is_err(), true);
|
||||
assert_eq!(rx.try_recv().is_none(), true);
|
||||
|
||||
test_fetch_redirect_updates_method_runner(tx.clone(), StatusCode::Found, extension.clone());
|
||||
assert_eq!(rx.recv().unwrap(), true);
|
||||
assert_eq!(rx.recv().unwrap(), false);
|
||||
assert_eq!(rx.try_recv().is_err(), true);
|
||||
assert_eq!(rx.try_recv().is_none(), true);
|
||||
|
||||
test_fetch_redirect_updates_method_runner(tx.clone(), StatusCode::SeeOther, extension.clone());
|
||||
assert_eq!(rx.recv().unwrap(), true);
|
||||
// for SeeOther, Method should always be changed, so this should be true
|
||||
assert_eq!(rx.recv().unwrap(), true);
|
||||
assert_eq!(rx.try_recv().is_err(), true);
|
||||
assert_eq!(rx.try_recv().is_none(), true);
|
||||
}
|
||||
|
||||
fn response_is_done(response: &Response) -> bool {
|
||||
|
@ -912,7 +911,7 @@ fn test_fetch_with_devtools() {
|
|||
let mut request = Request::new(url.clone(), Some(origin), Some(TEST_PIPELINE_ID));
|
||||
request.referrer = Referrer::NoReferrer;
|
||||
|
||||
let (devtools_chan, devtools_port) = channel::<DevtoolsControlMsg>();
|
||||
let (devtools_chan, devtools_port) = channel();
|
||||
|
||||
let _ = fetch(&mut request, Some(devtools_chan));
|
||||
let _ = server.close();
|
||||
|
|
|
@ -30,13 +30,13 @@ use net_traits::{CookieSource, NetworkError};
|
|||
use net_traits::request::{Request, RequestInit, RequestMode, CredentialsMode, Destination};
|
||||
use net_traits::response::ResponseBody;
|
||||
use new_fetch_context;
|
||||
use servo_channel::{channel, Receiver};
|
||||
use servo_url::{ServoUrl, ImmutableOrigin};
|
||||
use std::collections::HashMap;
|
||||
use std::io::{Read, Write};
|
||||
use std::str::FromStr;
|
||||
use std::sync::{Arc, Mutex, RwLock, mpsc};
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::Receiver;
|
||||
|
||||
fn mock_origin() -> ImmutableOrigin {
|
||||
ServoUrl::parse("http://servo.org").unwrap().origin()
|
||||
|
@ -213,7 +213,7 @@ fn test_request_and_response_data_with_network_messages() {
|
|||
pipeline_id: Some(TEST_PIPELINE_ID),
|
||||
.. RequestInit::default()
|
||||
});
|
||||
let (devtools_chan, devtools_port) = mpsc::channel();
|
||||
let (devtools_chan, devtools_port) = channel();
|
||||
let response = fetch(&mut request, Some(devtools_chan));
|
||||
assert!(response.internal_response.unwrap().status.unwrap().is_success());
|
||||
|
||||
|
@ -300,14 +300,14 @@ fn test_request_and_response_message_from_devtool_without_pipeline_id() {
|
|||
pipeline_id: None,
|
||||
.. RequestInit::default()
|
||||
});
|
||||
let (devtools_chan, devtools_port) = mpsc::channel();
|
||||
let (devtools_chan, devtools_port) = channel();
|
||||
let response = fetch(&mut request, Some(devtools_chan));
|
||||
assert!(response.internal_response.unwrap().status.unwrap().is_success());
|
||||
|
||||
let _ = server.close();
|
||||
|
||||
// notification received from devtools
|
||||
assert!(devtools_port.try_recv().is_err());
|
||||
assert!(devtools_port.try_recv().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -334,7 +334,7 @@ fn test_redirected_request_to_devtools() {
|
|||
pipeline_id: Some(TEST_PIPELINE_ID),
|
||||
.. RequestInit::default()
|
||||
});
|
||||
let (devtools_chan, devtools_port) = mpsc::channel();
|
||||
let (devtools_chan, devtools_port) = channel();
|
||||
fetch(&mut request, Some(devtools_chan));
|
||||
|
||||
let _ = pre_server.close();
|
||||
|
|
|
@ -16,6 +16,7 @@ extern crate msg;
|
|||
extern crate net;
|
||||
extern crate net_traits;
|
||||
extern crate profile_traits;
|
||||
extern crate servo_channel;
|
||||
extern crate servo_config;
|
||||
extern crate servo_url;
|
||||
extern crate time;
|
||||
|
@ -46,9 +47,9 @@ use net::test::HttpState;
|
|||
use net_traits::FetchTaskTarget;
|
||||
use net_traits::request::Request;
|
||||
use net_traits::response::Response;
|
||||
use servo_channel::{channel, Sender};
|
||||
use servo_url::ServoUrl;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::mpsc::{Sender, channel};
|
||||
|
||||
const DEFAULT_USER_AGENT: &'static str = "Such Browser. Very Layout. Wow.";
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ embedder_traits = { path = "../embedder_traits" }
|
|||
hyper = "0.10"
|
||||
hyper_serde = "0.8"
|
||||
image = "0.19"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
lazy_static = "1"
|
||||
log = "0.4"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
|
|
|
@ -15,7 +15,7 @@ unstable = ["jemalloc-sys"]
|
|||
[dependencies]
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
influent = "0.4"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
heartbeats-simple = "0.4"
|
||||
log = "0.4"
|
||||
serde = "1.0"
|
||||
|
|
|
@ -16,9 +16,10 @@ energy-profiling = ["energymon", "energy-monitor"]
|
|||
bincode = "1"
|
||||
energy-monitor = {version = "0.2.0", optional = true}
|
||||
energymon = {git = "https://github.com/energymon/energymon-rust.git", optional = true}
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
log = "0.4"
|
||||
serde = "1.0"
|
||||
servo_channel = {path = "../channel"}
|
||||
servo_config = {path = "../config"}
|
||||
signpost = {git = "https://github.com/pcwalton/signpost.git"}
|
||||
time = "0.1.12"
|
||||
|
|
|
@ -14,6 +14,7 @@ extern crate ipc_channel;
|
|||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate serde;
|
||||
extern crate servo_channel;
|
||||
extern crate servo_config;
|
||||
extern crate signpost;
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use serde;
|
||||
use servo_channel::Sender;
|
||||
use std::marker::Send;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
||||
/// A trait to abstract away the various kinds of message senders we use.
|
||||
pub trait OpaqueSender<T> {
|
||||
|
@ -22,7 +22,7 @@ impl<T> OpaqueSender<T> for Sender<T> {
|
|||
fn send(&self, message: T) {
|
||||
if let Err(e) = Sender::send(self, message) {
|
||||
warn!(
|
||||
"Error communicating with the target thread from the profiler: {}",
|
||||
"Error communicating with the target thread from the profiler: {:?}",
|
||||
e
|
||||
);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ html5ever = "0.22"
|
|||
hyper = "0.10"
|
||||
hyper_serde = "0.8"
|
||||
image = "0.19"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
itertools = "0.7.6"
|
||||
jstraceable_derive = {path = "../jstraceable_derive"}
|
||||
lazy_static = "1"
|
||||
|
@ -85,6 +85,7 @@ serde_bytes = "0.10"
|
|||
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-media = {git = "https://github.com/servo/media"}
|
||||
|
|
|
@ -11,7 +11,7 @@ use dom::globalscope::GlobalScope;
|
|||
use dom::worker::TrustedWorkerAddress;
|
||||
use dom::workerglobalscope::WorkerGlobalScope;
|
||||
use script_runtime::{ScriptChan, CommonScriptMsg, ScriptPort};
|
||||
use std::sync::mpsc::{Receiver, Select, Sender};
|
||||
use servo_channel::{Receiver, Sender};
|
||||
use task_queue::{QueuedTaskConversion, TaskQueue};
|
||||
|
||||
/// A ScriptChan that can be cloned freely and will silently send a TrustedWorkerAddress with
|
||||
|
@ -65,9 +65,9 @@ impl ScriptChan for WorkerThreadWorkerChan {
|
|||
impl ScriptPort for Receiver<DedicatedWorkerScriptMsg> {
|
||||
fn recv(&self) -> Result<CommonScriptMsg, ()> {
|
||||
let common_msg = match self.recv() {
|
||||
Ok(DedicatedWorkerScriptMsg::CommonWorker(_worker, common_msg)) => common_msg,
|
||||
Err(_) => return Err(()),
|
||||
Ok(DedicatedWorkerScriptMsg::WakeUp) => panic!("unexpected worker event message!")
|
||||
Some(DedicatedWorkerScriptMsg::CommonWorker(_worker, common_msg)) => common_msg,
|
||||
None => return Err(()),
|
||||
Some(DedicatedWorkerScriptMsg::WakeUp) => panic!("unexpected worker event message!")
|
||||
};
|
||||
match common_msg {
|
||||
WorkerScriptMsg::Common(script_msg) => Ok(script_msg),
|
||||
|
@ -89,7 +89,6 @@ pub trait WorkerEventLoopMethods {
|
|||
fn from_devtools_msg(&self, msg: DevtoolScriptControlMsg) -> Self::Event;
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
// https://html.spec.whatwg.org/multipage/#worker-event-loop
|
||||
pub fn run_worker_event_loop<T, TimerMsg, WorkerMsg, Event>(worker_scope: &T,
|
||||
worker: Option<&TrustedWorkerAddress>)
|
||||
|
@ -101,31 +100,18 @@ where
|
|||
+ DomObject {
|
||||
let scope = worker_scope.upcast::<WorkerGlobalScope>();
|
||||
let timer_event_port = worker_scope.timer_event_port();
|
||||
let devtools_port = scope.from_devtools_receiver();
|
||||
let devtools_port = match scope.from_devtools_sender() {
|
||||
Some(_) => Some(scope.from_devtools_receiver().select()),
|
||||
None => None,
|
||||
};
|
||||
let task_queue = worker_scope.task_queue();
|
||||
let sel = Select::new();
|
||||
let mut worker_handle = sel.handle(task_queue.select());
|
||||
let mut timer_event_handle = sel.handle(timer_event_port);
|
||||
let mut devtools_handle = sel.handle(devtools_port);
|
||||
unsafe {
|
||||
worker_handle.add();
|
||||
timer_event_handle.add();
|
||||
if scope.from_devtools_sender().is_some() {
|
||||
devtools_handle.add();
|
||||
}
|
||||
}
|
||||
let ret = sel.wait();
|
||||
let event = {
|
||||
if ret == worker_handle.id() {
|
||||
task_queue.take_tasks();
|
||||
let event = select! {
|
||||
recv(task_queue.select(), msg) => {
|
||||
task_queue.take_tasks(msg.unwrap());
|
||||
worker_scope.from_worker_msg(task_queue.recv().unwrap())
|
||||
} else if ret == timer_event_handle.id() {
|
||||
worker_scope.from_timer_msg(timer_event_port.recv().unwrap())
|
||||
} else if ret == devtools_handle.id() {
|
||||
worker_scope.from_devtools_msg(devtools_port.recv().unwrap())
|
||||
} else {
|
||||
panic!("unexpected select result!")
|
||||
}
|
||||
},
|
||||
recv(timer_event_port.select(), msg) => worker_scope.from_timer_msg(msg.unwrap()),
|
||||
recv(devtools_port, msg) => worker_scope.from_devtools_msg(msg.unwrap()),
|
||||
};
|
||||
let mut sequential = vec![];
|
||||
sequential.push(event);
|
||||
|
@ -138,14 +124,14 @@ where
|
|||
// Batch all events that are ready.
|
||||
// The task queue will throttle non-priority tasks if necessary.
|
||||
match task_queue.try_recv() {
|
||||
Err(_) => match timer_event_port.try_recv() {
|
||||
Err(_) => match devtools_port.try_recv() {
|
||||
Err(_) => break,
|
||||
Ok(ev) => sequential.push(worker_scope.from_devtools_msg(ev)),
|
||||
None => match timer_event_port.try_recv() {
|
||||
None => match devtools_port.and_then(|port| port.try_recv()) {
|
||||
None => break,
|
||||
Some(ev) => sequential.push(worker_scope.from_devtools_msg(ev)),
|
||||
},
|
||||
Ok(ev) => sequential.push(worker_scope.from_timer_msg(ev)),
|
||||
Some(ev) => sequential.push(worker_scope.from_timer_msg(ev)),
|
||||
},
|
||||
Ok(ev) => sequential.push(worker_scope.from_worker_msg(ev)),
|
||||
Some(ev) => sequential.push(worker_scope.from_worker_msg(ev)),
|
||||
}
|
||||
}
|
||||
// Step 3
|
||||
|
|
|
@ -88,6 +88,7 @@ use selectors::matching::ElementSelectorFlags;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use servo_atoms::Atom;
|
||||
use servo_channel::{Receiver, Sender};
|
||||
use servo_media::Backend;
|
||||
use servo_media::audio::buffer_source_node::AudioBuffer;
|
||||
use servo_media::audio::context::AudioContext;
|
||||
|
@ -104,7 +105,6 @@ use std::path::PathBuf;
|
|||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, AtomicUsize};
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
use std::time::{SystemTime, Instant};
|
||||
use style::attr::{AttrIdentifier, AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::context::QuirksMode;
|
||||
|
|
|
@ -36,12 +36,12 @@ use net_traits::request::{CredentialsMode, Destination, RequestInit};
|
|||
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, new_rt_and_cx, Runtime};
|
||||
use script_runtime::ScriptThreadEventCategory::WorkerEvent;
|
||||
use script_traits::{TimerEvent, TimerSource, WorkerGlobalScopeInit, WorkerScriptLoadOrigin};
|
||||
use servo_channel::{channel, route_ipc_receiver_to_new_servo_sender, Sender, Receiver};
|
||||
use servo_rand::random;
|
||||
use servo_url::ServoUrl;
|
||||
use std::mem::replace;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
use std::thread;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
use task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue};
|
||||
|
@ -313,7 +313,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
let runtime = unsafe { new_rt_and_cx() };
|
||||
|
||||
let (devtools_mpsc_chan, devtools_mpsc_port) = channel();
|
||||
ROUTER.route_ipc_receiver_to_mpsc_sender(from_devtools_receiver, devtools_mpsc_chan);
|
||||
route_ipc_receiver_to_new_servo_sender(from_devtools_receiver, devtools_mpsc_chan);
|
||||
|
||||
let (timer_tx, timer_rx) = channel();
|
||||
let (timer_ipc_chan, timer_ipc_port) = ipc::channel().unwrap();
|
||||
|
|
|
@ -60,8 +60,6 @@ use std::ptr::null_mut;
|
|||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
use std::sync::mpsc;
|
||||
use std::sync::mpsc::Sender;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use style_traits::CSSPixel;
|
||||
|
@ -352,7 +350,7 @@ impl PaintWorkletGlobalScope {
|
|||
arguments: Vec<String>)
|
||||
-> Result<DrawAPaintImageResult, PaintWorkletError> {
|
||||
let name = self.name.clone();
|
||||
let (sender, receiver) = mpsc::channel();
|
||||
let (sender, receiver) = channel();
|
||||
let task = PaintWorkletTask::DrawAPaintImage(name,
|
||||
size,
|
||||
device_pixel_ratio,
|
||||
|
|
|
@ -22,17 +22,16 @@ use dom::worker::TrustedWorkerAddress;
|
|||
use dom::workerglobalscope::WorkerGlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::{self, IpcSender, IpcReceiver};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use js::jsapi::{JSAutoCompartment, JSContext, JS_AddInterruptCallback};
|
||||
use js::jsval::UndefinedValue;
|
||||
use net_traits::{load_whole_resource, IpcSend, CustomResponseMediator};
|
||||
use net_traits::request::{CredentialsMode, Destination, RequestInit};
|
||||
use script_runtime::{CommonScriptMsg, ScriptChan, new_rt_and_cx, Runtime};
|
||||
use script_traits::{TimerEvent, WorkerGlobalScopeInit, ScopeThings, ServiceWorkerMsg, WorkerScriptLoadOrigin};
|
||||
use servo_channel::{channel, route_ipc_receiver_to_new_servo_sender, Receiver, Sender};
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_rand::random;
|
||||
use servo_url::ServoUrl;
|
||||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
|
@ -272,7 +271,7 @@ impl ServiceWorkerGlobalScope {
|
|||
let runtime = unsafe { new_rt_and_cx() };
|
||||
|
||||
let (devtools_mpsc_chan, devtools_mpsc_port) = channel();
|
||||
ROUTER.route_ipc_receiver_to_mpsc_sender(devtools_receiver, devtools_mpsc_chan);
|
||||
route_ipc_receiver_to_new_servo_sender(devtools_receiver, devtools_mpsc_chan);
|
||||
// TODO XXXcreativcoder use this timer_ipc_port, when we have a service worker instance here
|
||||
let (timer_ipc_chan, _timer_ipc_port) = ipc::channel().unwrap();
|
||||
let (timer_chan, timer_port) = channel();
|
||||
|
|
|
@ -27,12 +27,12 @@ use html5ever::tendril::fmt::UTF8;
|
|||
use html5ever::tokenizer::{Tokenizer as HtmlTokenizer, TokenizerOpts, TokenizerResult};
|
||||
use html5ever::tree_builder::{ElementFlags, NodeOrText as HtmlNodeOrText, NextParserState, QuirksMode, TreeSink};
|
||||
use html5ever::tree_builder::{TreeBuilder, TreeBuilderOpts};
|
||||
use servo_channel::{channel, Receiver, Sender};
|
||||
use servo_url::ServoUrl;
|
||||
use std::borrow::Cow;
|
||||
use std::cell::Cell;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::vec_deque::VecDeque;
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use std::thread;
|
||||
use style::context::QuirksMode as ServoQuirksMode;
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ use dom::workletglobalscope::WorkletGlobalScopeInit;
|
|||
use dom_struct::dom_struct;
|
||||
use js::rust::Runtime;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use servo_channel::Sender;
|
||||
use servo_url::ServoUrl;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
||||
// check-tidy: no specs after this line
|
||||
|
||||
|
|
|
@ -36,11 +36,11 @@ use profile_traits::ipc;
|
|||
use script_runtime::CommonScriptMsg;
|
||||
use script_runtime::ScriptThreadEventCategory::WebVREvent;
|
||||
use serde_bytes::ByteBuf;
|
||||
use servo_channel::{channel, Sender};
|
||||
use std::cell::Cell;
|
||||
use std::mem;
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc;
|
||||
use std::thread;
|
||||
use task_source::TaskSourceName;
|
||||
use webvr_traits::{WebVRDisplayData, WebVRDisplayEvent, WebVRFrameData, WebVRLayer, WebVRMsg};
|
||||
|
@ -505,7 +505,7 @@ impl VRDisplay {
|
|||
// while the render thread is syncing the VRFrameData to be used for the current frame.
|
||||
// This thread runs until the user calls ExitPresent, the tab is closed or some unexpected error happened.
|
||||
thread::Builder::new().name("WebVR_RAF".into()).spawn(move || {
|
||||
let (raf_sender, raf_receiver) = mpsc::channel();
|
||||
let (raf_sender, raf_receiver) = channel();
|
||||
let mut near = near_init;
|
||||
let mut far = far_init;
|
||||
|
||||
|
@ -581,7 +581,7 @@ impl VRDisplay {
|
|||
self.frame_data_status.set(status);
|
||||
}
|
||||
|
||||
fn handle_raf(&self, end_sender: &mpsc::Sender<Result<(f64, f64), ()>>) {
|
||||
fn handle_raf(&self, end_sender: &Sender<Result<(f64, f64), ()>>) {
|
||||
self.frame_data_status.set(VRFrameDataStatus::Waiting);
|
||||
self.running_display_raf.set(true);
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ use script_traits::{TimerSchedulerMsg, UntrustedNodeAddress, WindowSizeData, Win
|
|||
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use servo_arc;
|
||||
use servo_channel::{channel, Sender};
|
||||
use servo_config::opts;
|
||||
use servo_geometry::{f32_rect_to_au_rect, MaxRect};
|
||||
use servo_url::{Host, MutableOrigin, ImmutableOrigin, ServoUrl};
|
||||
|
@ -109,8 +110,6 @@ use std::mem;
|
|||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::{Sender, channel};
|
||||
use std::sync::mpsc::TryRecvError::{Disconnected, Empty};
|
||||
use style::error_reporting::ParseErrorReporter;
|
||||
use style::media_queries;
|
||||
use style::parser::ParserContext as CssParserContext;
|
||||
|
@ -1376,15 +1375,16 @@ impl Window {
|
|||
|
||||
debug!("script: layout forked");
|
||||
|
||||
let complete = match join_port.try_recv() {
|
||||
Err(Empty) => {
|
||||
let complete = select! {
|
||||
recv(join_port.select(), msg) => if let Some(reflow_complete) = msg {
|
||||
reflow_complete
|
||||
} else {
|
||||
panic!("Layout thread failed while script was waiting for a result.");
|
||||
},
|
||||
default => {
|
||||
info!("script: waiting on layout");
|
||||
join_port.recv().unwrap()
|
||||
}
|
||||
Ok(reflow_complete) => reflow_complete,
|
||||
Err(Disconnected) => {
|
||||
panic!("Layout thread failed while script was waiting for a result.");
|
||||
}
|
||||
};
|
||||
|
||||
debug!("script: layout joined");
|
||||
|
|
|
@ -25,10 +25,10 @@ use js::jsapi::{JSAutoCompartment, JSContext, JS_RequestInterruptCallback};
|
|||
use js::jsval::UndefinedValue;
|
||||
use js::rust::HandleValue;
|
||||
use script_traits::WorkerScriptLoadOrigin;
|
||||
use servo_channel::{channel, Sender};
|
||||
use std::cell::Cell;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::{Sender, channel};
|
||||
use task::TaskOnce;
|
||||
|
||||
pub type TrustedWorkerAddress = Trusted<Worker>;
|
||||
|
|
|
@ -36,12 +36,12 @@ use net_traits::request::{CredentialsMode, Destination, RequestInit as NetReques
|
|||
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, get_reports, Runtime};
|
||||
use script_traits::{TimerEvent, TimerEventId};
|
||||
use script_traits::WorkerGlobalScopeInit;
|
||||
use servo_channel::Receiver;
|
||||
use servo_url::{MutableOrigin, ServoUrl};
|
||||
use std::default::Default;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::Receiver;
|
||||
use task::TaskCanceller;
|
||||
use task_source::file_reading::FileReadingTaskSource;
|
||||
use task_source::networking::NetworkingTaskSource;
|
||||
|
|
|
@ -48,6 +48,7 @@ use script_runtime::Runtime;
|
|||
use script_runtime::ScriptThreadEventCategory;
|
||||
use script_runtime::new_rt_and_cx;
|
||||
use script_thread::{MainThreadScriptMsg, ScriptThread};
|
||||
use servo_channel::{channel, Sender, Receiver};
|
||||
use servo_rand;
|
||||
use servo_url::ImmutableOrigin;
|
||||
use servo_url::ServoUrl;
|
||||
|
@ -58,9 +59,6 @@ use std::rc::Rc;
|
|||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicIsize;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::mpsc;
|
||||
use std::sync::mpsc::Receiver;
|
||||
use std::sync::mpsc::Sender;
|
||||
use std::thread;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
use swapper::Swapper;
|
||||
|
@ -309,7 +307,7 @@ impl WorkletThreadPool {
|
|||
|
||||
/// For testing.
|
||||
pub fn test_worklet_lookup(&self, id: WorkletId, key: String) -> Option<String> {
|
||||
let (sender, receiver) = mpsc::channel();
|
||||
let (sender, receiver) = channel();
|
||||
let msg = WorkletData::Task(id, WorkletTask::Test(TestWorkletTask::Lookup(key, sender)));
|
||||
let _ = self.primary_sender.send(msg);
|
||||
receiver.recv().expect("Test worklet has died?")
|
||||
|
@ -355,7 +353,7 @@ struct WorkletThreadRole {
|
|||
|
||||
impl WorkletThreadRole {
|
||||
fn new(is_hot_backup: bool, is_cold_backup: bool) -> WorkletThreadRole {
|
||||
let (sender, receiver) = mpsc::channel();
|
||||
let (sender, receiver) = channel();
|
||||
WorkletThreadRole {
|
||||
sender: sender,
|
||||
receiver: receiver,
|
||||
|
@ -419,7 +417,7 @@ impl WorkletThread {
|
|||
#[allow(unsafe_code)]
|
||||
#[allow(unrooted_must_root)]
|
||||
fn spawn(role: WorkletThreadRole, init: WorkletThreadInit) -> Sender<WorkletControl> {
|
||||
let (control_sender, control_receiver) = mpsc::channel();
|
||||
let (control_sender, control_receiver) = channel();
|
||||
// TODO: name this thread
|
||||
thread::spawn(move || {
|
||||
// TODO: add a new IN_WORKLET thread state?
|
||||
|
@ -488,12 +486,12 @@ impl WorkletThread {
|
|||
if let Some(control) = self.control_buffer.take() {
|
||||
self.process_control(control);
|
||||
}
|
||||
while let Ok(control) = self.control_receiver.try_recv() {
|
||||
while let Some(control) = self.control_receiver.try_recv() {
|
||||
self.process_control(control);
|
||||
}
|
||||
self.gc();
|
||||
} else if self.control_buffer.is_none() {
|
||||
if let Ok(control) = self.control_receiver.try_recv() {
|
||||
if let Some(control) = self.control_receiver.try_recv() {
|
||||
self.control_buffer = Some(control);
|
||||
let msg = WorkletData::StartSwapRoles(self.role.sender.clone());
|
||||
let _ = self.cold_backup_sender.send(msg);
|
||||
|
|
|
@ -26,11 +26,11 @@ use script_thread::MainThreadScriptMsg;
|
|||
use script_traits::{Painter, ScriptMsg};
|
||||
use script_traits::{ScriptToConstellationChan, TimerSchedulerMsg};
|
||||
use servo_atoms::Atom;
|
||||
use servo_channel::Sender;
|
||||
use servo_url::ImmutableOrigin;
|
||||
use servo_url::MutableOrigin;
|
||||
use servo_url::ServoUrl;
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
||||
#[dom_struct]
|
||||
/// <https://drafts.css-houdini.org/worklets/#workletglobalscope>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#![cfg_attr(feature = "unstable", feature(on_unimplemented))]
|
||||
#![feature(const_fn)]
|
||||
#![feature(drain_filter)]
|
||||
#![feature(mpsc_select)]
|
||||
#![feature(plugin)]
|
||||
#![feature(try_from)]
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@ use hyper::header::ReferrerPolicy as ReferrerPolicyHeader;
|
|||
use hyper::mime::{Mime, SubLevel, TopLevel};
|
||||
use hyper_serde::Serde;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use js::glue::GetWindowProxyClass;
|
||||
use js::jsapi::{JSAutoCompartment, JSContext, JS_SetWrapObjectCallbacks};
|
||||
use js::jsapi::{JSTracer, SetWindowProxyClass};
|
||||
|
@ -101,6 +100,8 @@ use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent,
|
|||
use script_traits::webdriver_msg::WebDriverScriptCommand;
|
||||
use serviceworkerjob::{Job, JobQueue};
|
||||
use servo_atoms::Atom;
|
||||
use servo_channel::{channel, Receiver, Sender};
|
||||
use servo_channel::{route_ipc_receiver_to_new_servo_receiver, route_ipc_receiver_to_new_servo_sender};
|
||||
use servo_config::opts;
|
||||
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
||||
use std::cell::Cell;
|
||||
|
@ -113,7 +114,6 @@ use std::ptr;
|
|||
use std::rc::Rc;
|
||||
use std::result::Result;
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, Select, Sender, channel};
|
||||
use std::thread;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
use task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue};
|
||||
|
@ -300,39 +300,39 @@ impl OpaqueSender<CommonScriptMsg> for Box<ScriptChan + Send> {
|
|||
|
||||
impl ScriptPort for Receiver<CommonScriptMsg> {
|
||||
fn recv(&self) -> Result<CommonScriptMsg, ()> {
|
||||
self.recv().map_err(|_| ())
|
||||
self.recv().ok_or(())
|
||||
}
|
||||
}
|
||||
|
||||
impl ScriptPort for Receiver<MainThreadScriptMsg> {
|
||||
fn recv(&self) -> Result<CommonScriptMsg, ()> {
|
||||
match self.recv() {
|
||||
Ok(MainThreadScriptMsg::Common(script_msg)) => Ok(script_msg),
|
||||
Ok(_) => panic!("unexpected main thread event message!"),
|
||||
_ => Err(()),
|
||||
Some(MainThreadScriptMsg::Common(script_msg)) => Ok(script_msg),
|
||||
Some(_) => panic!("unexpected main thread event message!"),
|
||||
None => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ScriptPort for Receiver<(TrustedWorkerAddress, CommonScriptMsg)> {
|
||||
fn recv(&self) -> Result<CommonScriptMsg, ()> {
|
||||
self.recv().map(|(_, msg)| msg).map_err(|_| ())
|
||||
self.recv().map(|(_, msg)| msg).ok_or(())
|
||||
}
|
||||
}
|
||||
|
||||
impl ScriptPort for Receiver<(TrustedWorkerAddress, MainThreadScriptMsg)> {
|
||||
fn recv(&self) -> Result<CommonScriptMsg, ()> {
|
||||
match self.recv().map(|(_, msg)| msg) {
|
||||
Ok(MainThreadScriptMsg::Common(script_msg)) => Ok(script_msg),
|
||||
Ok(_) => panic!("unexpected main thread event message!"),
|
||||
_ => Err(()),
|
||||
Some(MainThreadScriptMsg::Common(script_msg)) => Ok(script_msg),
|
||||
Some(_) => panic!("unexpected main thread event message!"),
|
||||
None => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ScriptPort for Receiver<(TrustedServiceWorkerAddress, CommonScriptMsg)> {
|
||||
fn recv(&self) -> Result<CommonScriptMsg, ()> {
|
||||
self.recv().map(|(_, msg)| msg).map_err(|_| ())
|
||||
self.recv().map(|(_, msg)| msg).ok_or(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -896,12 +896,12 @@ impl ScriptThread {
|
|||
|
||||
// Ask the router to proxy IPC messages from the devtools to us.
|
||||
let (ipc_devtools_sender, ipc_devtools_receiver) = ipc::channel().unwrap();
|
||||
let devtools_port = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_devtools_receiver);
|
||||
let devtools_port = route_ipc_receiver_to_new_servo_receiver(ipc_devtools_receiver);
|
||||
|
||||
let (timer_event_chan, timer_event_port) = channel();
|
||||
|
||||
// Ask the router to proxy IPC messages from the control port to us.
|
||||
let control_port = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(state.control_port);
|
||||
let control_port = route_ipc_receiver_to_new_servo_receiver(state.control_port);
|
||||
|
||||
let boxed_script_sender = Box::new(MainThreadScriptChan(chan.clone()));
|
||||
|
||||
|
@ -1019,37 +1019,15 @@ impl ScriptThread {
|
|||
|
||||
// Receive at least one message so we don't spinloop.
|
||||
debug!("Waiting for event.");
|
||||
let mut event = {
|
||||
let sel = Select::new();
|
||||
let mut script_port = sel.handle(self.task_queue.select());
|
||||
let mut control_port = sel.handle(&self.control_port);
|
||||
let mut timer_event_port = sel.handle(&self.timer_event_port);
|
||||
let mut devtools_port = sel.handle(&self.devtools_port);
|
||||
let mut image_cache_port = sel.handle(&self.image_cache_port);
|
||||
unsafe {
|
||||
script_port.add();
|
||||
control_port.add();
|
||||
timer_event_port.add();
|
||||
if self.devtools_chan.is_some() {
|
||||
devtools_port.add();
|
||||
}
|
||||
image_cache_port.add();
|
||||
}
|
||||
let ret = sel.wait();
|
||||
if ret == script_port.id() {
|
||||
self.task_queue.take_tasks();
|
||||
let mut event = select! {
|
||||
recv(self.task_queue.select(), msg) => {
|
||||
self.task_queue.take_tasks(msg.unwrap());
|
||||
FromScript(self.task_queue.recv().unwrap())
|
||||
} else if ret == control_port.id() {
|
||||
FromConstellation(self.control_port.recv().unwrap())
|
||||
} else if ret == timer_event_port.id() {
|
||||
FromScheduler(self.timer_event_port.recv().unwrap())
|
||||
} else if ret == devtools_port.id() {
|
||||
FromDevtools(self.devtools_port.recv().unwrap())
|
||||
} else if ret == image_cache_port.id() {
|
||||
FromImageCache(self.image_cache_port.recv().unwrap())
|
||||
} else {
|
||||
panic!("unexpected select result")
|
||||
}
|
||||
},
|
||||
recv(self.control_port.select(), msg) => FromConstellation(msg.unwrap()),
|
||||
recv(self.timer_event_port.select(), msg) => FromScheduler(msg.unwrap()),
|
||||
recv(self.devtools_chan.as_ref().map(|_| self.devtools_port.select()), msg) => FromDevtools(msg.unwrap()),
|
||||
recv(self.image_cache_port.select(), msg) => FromImageCache(msg.unwrap()),
|
||||
};
|
||||
debug!("Got event.");
|
||||
|
||||
|
@ -1131,20 +1109,20 @@ impl ScriptThread {
|
|||
// and check for more resize events. If there are no events pending, we'll move
|
||||
// on and execute the sequential non-resize events we've seen.
|
||||
match self.control_port.try_recv() {
|
||||
Err(_) => match self.task_queue.try_recv() {
|
||||
Err(_) => match self.timer_event_port.try_recv() {
|
||||
Err(_) => match self.devtools_port.try_recv() {
|
||||
Err(_) => match self.image_cache_port.try_recv() {
|
||||
Err(_) => break,
|
||||
Ok(ev) => event = FromImageCache(ev),
|
||||
None => match self.task_queue.try_recv() {
|
||||
None => match self.timer_event_port.try_recv() {
|
||||
None => match self.devtools_port.try_recv() {
|
||||
None => match self.image_cache_port.try_recv() {
|
||||
None => break,
|
||||
Some(ev) => event = FromImageCache(ev),
|
||||
},
|
||||
Ok(ev) => event = FromDevtools(ev),
|
||||
Some(ev) => event = FromDevtools(ev),
|
||||
},
|
||||
Ok(ev) => event = FromScheduler(ev),
|
||||
Some(ev) => event = FromScheduler(ev),
|
||||
},
|
||||
Ok(ev) => event = FromScript(ev),
|
||||
Some(ev) => event = FromScript(ev),
|
||||
},
|
||||
Ok(ev) => event = FromConstellation(ev),
|
||||
Some(ev) => event = FromConstellation(ev),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2200,7 +2178,7 @@ impl ScriptThread {
|
|||
let HistoryTraversalTaskSource(ref history_sender) = self.history_traversal_task_source;
|
||||
|
||||
let (ipc_timer_event_chan, ipc_timer_event_port) = ipc::channel().unwrap();
|
||||
ROUTER.route_ipc_receiver_to_mpsc_sender(ipc_timer_event_port,
|
||||
route_ipc_receiver_to_new_servo_sender(ipc_timer_event_port,
|
||||
self.timer_event_chan.clone());
|
||||
|
||||
let origin = if final_url.as_str() == "about:blank" {
|
||||
|
|
|
@ -13,13 +13,12 @@ use dom::bindings::structuredclone::StructuredCloneData;
|
|||
use dom::serviceworkerglobalscope::{ServiceWorkerGlobalScope, ServiceWorkerScriptMsg};
|
||||
use dom::serviceworkerregistration::longest_prefix_match;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use net_traits::{CustomResponseMediator, CoreResourceMsg};
|
||||
use script_traits::{ServiceWorkerMsg, ScopeThings, SWManagerMsg, SWManagerSenders, DOMMessage};
|
||||
use servo_channel::{channel, route_ipc_receiver_to_new_servo_receiver, Sender, Receiver};
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_url::ServoUrl;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::mpsc::{channel, Sender, Receiver, RecvError};
|
||||
use std::thread;
|
||||
|
||||
enum Message {
|
||||
|
@ -56,8 +55,8 @@ impl ServiceWorkerManager {
|
|||
pub fn spawn_manager(sw_senders: SWManagerSenders) {
|
||||
let (own_sender, from_constellation_receiver) = ipc::channel().unwrap();
|
||||
let (resource_chan, resource_port) = ipc::channel().unwrap();
|
||||
let from_constellation = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(from_constellation_receiver);
|
||||
let resource_port = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(resource_port);
|
||||
let from_constellation = route_ipc_receiver_to_new_servo_receiver(from_constellation_receiver);
|
||||
let resource_port = route_ipc_receiver_to_new_servo_receiver(resource_port);
|
||||
let _ = sw_senders.resource_sender.send(CoreResourceMsg::NetworkMediator(resource_chan));
|
||||
let _ = sw_senders.swmanager_sender.send(SWManagerMsg::OwnSender(own_sender.clone()));
|
||||
thread::Builder::new().name("ServiceWorkerManager".to_owned()).spawn(move || {
|
||||
|
@ -108,7 +107,7 @@ impl ServiceWorkerManager {
|
|||
}
|
||||
|
||||
fn handle_message(&mut self) {
|
||||
while let Ok(message) = self.receive_message() {
|
||||
while let Some(message) = self.receive_message() {
|
||||
let should_continue = match message {
|
||||
Message::FromConstellation(msg) => {
|
||||
self.handle_message_from_constellation(msg)
|
||||
|
@ -184,13 +183,10 @@ impl ServiceWorkerManager {
|
|||
true
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn receive_message(&mut self) -> Result<Message, RecvError> {
|
||||
let msg_from_constellation = &self.own_port;
|
||||
let msg_from_resource = &self.resource_receiver;
|
||||
fn receive_message(&mut self) -> Option<Message> {
|
||||
select! {
|
||||
msg = msg_from_constellation.recv() => msg.map(Message::FromConstellation),
|
||||
msg = msg_from_resource.recv() => msg.map(Message::FromResource)
|
||||
recv(self.own_port.select(), msg) => msg.map(Message::FromConstellation),
|
||||
recv(self.resource_receiver.select(), msg) => msg.map(Message::FromResource),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ use dom::bindings::cell::DomRefCell;
|
|||
use dom::worker::TrustedWorkerAddress;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use script_runtime::ScriptThreadEventCategory;
|
||||
use servo_channel::{Receiver, Sender, base_channel};
|
||||
use std::cell::Cell;
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::default::Default;
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
use task::TaskBox;
|
||||
use task_source::TaskSourceName;
|
||||
|
||||
|
@ -59,13 +59,18 @@ impl<T: QueuedTaskConversion> TaskQueue<T> {
|
|||
|
||||
/// Process incoming tasks, immediately sending priority ones downstream,
|
||||
/// and categorizing potential throttles.
|
||||
fn process_incoming_tasks(&self) {
|
||||
let mut non_throttled: Vec<T> = self.port
|
||||
.try_iter()
|
||||
.filter(|msg| !msg.is_wake_up())
|
||||
.collect();
|
||||
fn process_incoming_tasks(&self, first_msg: T) {
|
||||
let mut incoming = Vec::with_capacity(self.port.len() + 1);
|
||||
if !first_msg.is_wake_up() {
|
||||
incoming.push(first_msg);
|
||||
}
|
||||
while let Some(msg) = self.port.try_recv() {
|
||||
if !msg.is_wake_up() {
|
||||
incoming.push(msg);
|
||||
}
|
||||
}
|
||||
|
||||
let to_be_throttled: Vec<T> = non_throttled.drain_filter(|msg|{
|
||||
let to_be_throttled: Vec<T> = incoming.drain_filter(|msg|{
|
||||
let task_source = match msg.task_source_name() {
|
||||
Some(task_source) => task_source,
|
||||
None => return false,
|
||||
|
@ -80,7 +85,7 @@ impl<T: QueuedTaskConversion> TaskQueue<T> {
|
|||
}
|
||||
}).collect();
|
||||
|
||||
for msg in non_throttled {
|
||||
for msg in incoming {
|
||||
// Immediately send non-throttled tasks for processing.
|
||||
let _ = self.msg_queue.borrow_mut().push_back(msg);
|
||||
}
|
||||
|
@ -101,31 +106,31 @@ impl<T: QueuedTaskConversion> TaskQueue<T> {
|
|||
|
||||
/// Reset the queue for a new iteration of the event-loop,
|
||||
/// returning the port about whose readiness we want to be notified.
|
||||
pub fn select(&self) -> &Receiver<T> {
|
||||
pub fn select(&self) -> &base_channel::Receiver<T> {
|
||||
// This is a new iteration of the event-loop, so we reset the "business" counter.
|
||||
self.taken_task_counter.set(0);
|
||||
// We want to be notified when the script-port is ready to receive.
|
||||
// Hence that's the one we need to include in the select.
|
||||
&self.port
|
||||
self.port.select()
|
||||
}
|
||||
|
||||
/// Take a message from the front of the queue, without waiting if empty.
|
||||
pub fn recv(&self) -> Result<T, ()> {
|
||||
self.msg_queue.borrow_mut().pop_front().ok_or(())
|
||||
pub fn recv(&self) -> Option<T> {
|
||||
self.msg_queue.borrow_mut().pop_front()
|
||||
}
|
||||
|
||||
/// Same as recv.
|
||||
pub fn try_recv(&self) -> Result<T, ()> {
|
||||
pub fn try_recv(&self) -> Option<T> {
|
||||
self.recv()
|
||||
}
|
||||
|
||||
/// Drain the queue for the current iteration of the event-loop.
|
||||
/// Holding-back throttles above a given high-water mark.
|
||||
pub fn take_tasks(&self) {
|
||||
pub fn take_tasks(&self, first_msg: T) {
|
||||
// High-watermark: once reached, throttled tasks will be held-back.
|
||||
const PER_ITERATION_MAX: u64 = 5;
|
||||
// Always first check for new tasks, but don't reset 'taken_task_counter'.
|
||||
self.process_incoming_tasks();
|
||||
self.process_incoming_tasks(first_msg);
|
||||
let mut throttled = self.throttled.borrow_mut();
|
||||
let mut throttled_length: usize = throttled.values().map(|queue| queue.len()).sum();
|
||||
let task_source_names = TaskSourceName::all();
|
||||
|
|
|
@ -11,9 +11,9 @@ use msg::constellation_msg::PipelineId;
|
|||
use script_runtime::{CommonScriptMsg, ScriptThreadEventCategory};
|
||||
use script_thread::MainThreadScriptMsg;
|
||||
use servo_atoms::Atom;
|
||||
use servo_channel::Sender;
|
||||
use std::fmt;
|
||||
use std::result::Result;
|
||||
use std::sync::mpsc::Sender;
|
||||
use task::{TaskCanceller, TaskOnce};
|
||||
use task_source::{TaskSource, TaskSourceName};
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use script_runtime::{ScriptChan, CommonScriptMsg};
|
||||
use script_thread::MainThreadScriptMsg;
|
||||
use std::sync::mpsc::Sender;
|
||||
use servo_channel::Sender;
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
pub struct HistoryTraversalTaskSource(pub Sender<MainThreadScriptMsg>);
|
||||
|
|
|
@ -11,9 +11,9 @@ use msg::constellation_msg::PipelineId;
|
|||
use script_runtime::{CommonScriptMsg, ScriptThreadEventCategory};
|
||||
use script_thread::MainThreadScriptMsg;
|
||||
use servo_atoms::Atom;
|
||||
use servo_channel::Sender;
|
||||
use std::fmt;
|
||||
use std::result::Result;
|
||||
use std::sync::mpsc::Sender;
|
||||
use task::{TaskCanceller, TaskOnce};
|
||||
use task_source::{TaskSource, TaskSourceName};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ cssparser = "0.24"
|
|||
euclid = "0.19"
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
html5ever = "0.22"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
libc = "0.2"
|
||||
log = "0.4"
|
||||
time = "0.1.17"
|
||||
|
@ -32,6 +32,7 @@ script_traits = {path = "../script_traits"}
|
|||
selectors = { path = "../selectors" }
|
||||
servo_arc = {path = "../servo_arc"}
|
||||
servo_atoms = {path = "../atoms"}
|
||||
servo_channel = {path = "../channel"}
|
||||
servo_url = {path = "../url"}
|
||||
style = {path = "../style"}
|
||||
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||
|
|
|
@ -31,6 +31,7 @@ extern crate script_traits;
|
|||
extern crate selectors;
|
||||
extern crate servo_arc;
|
||||
extern crate servo_atoms;
|
||||
extern crate servo_channel;
|
||||
extern crate servo_url;
|
||||
extern crate style;
|
||||
extern crate webrender_api;
|
||||
|
|
|
@ -17,9 +17,9 @@ use script_traits::{ScrollState, UntrustedNodeAddress, WindowSizeData};
|
|||
use script_traits::Painter;
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use servo_atoms::Atom;
|
||||
use servo_channel::{Receiver, Sender};
|
||||
use servo_url::ServoUrl;
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
use style::context::QuirksMode;
|
||||
use style::properties::PropertyId;
|
||||
use style::selector_parser::PseudoElement;
|
||||
|
|
|
@ -19,7 +19,7 @@ euclid = "0.19"
|
|||
gfx_traits = {path = "../gfx_traits"}
|
||||
hyper = "0.10"
|
||||
hyper_serde = "0.8"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
libc = "0.2"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
|
@ -29,6 +29,7 @@ profile_traits = {path = "../profile_traits"}
|
|||
rustc-serialize = "0.3.4"
|
||||
serde = "1.0"
|
||||
servo_atoms = {path = "../atoms"}
|
||||
servo_channel = {path = "../channel"}
|
||||
servo_url = {path = "../url"}
|
||||
style_traits = {path = "../style_traits", features = ["servo"]}
|
||||
time = "0.1.12"
|
||||
|
|
|
@ -30,6 +30,7 @@ extern crate profile_traits;
|
|||
extern crate rustc_serialize;
|
||||
#[macro_use] extern crate serde;
|
||||
extern crate servo_atoms;
|
||||
extern crate servo_channel;
|
||||
extern crate servo_url;
|
||||
extern crate style_traits;
|
||||
extern crate time;
|
||||
|
@ -60,12 +61,12 @@ use profile_traits::mem;
|
|||
use profile_traits::time as profile_time;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use servo_atoms::Atom;
|
||||
use servo_channel::{Receiver, Sender};
|
||||
use servo_url::ImmutableOrigin;
|
||||
use servo_url::ServoUrl;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, Sender, RecvTimeoutError};
|
||||
use style_traits::CSSPixel;
|
||||
use style_traits::SpeculativePainter;
|
||||
use style_traits::cursor::CursorKind;
|
||||
|
@ -804,12 +805,6 @@ pub enum PaintWorkletError {
|
|||
WorkletNotFound,
|
||||
}
|
||||
|
||||
impl From<RecvTimeoutError> for PaintWorkletError {
|
||||
fn from(_: RecvTimeoutError) -> PaintWorkletError {
|
||||
PaintWorkletError::Timeout
|
||||
}
|
||||
}
|
||||
|
||||
/// Execute paint code in the worklet thread pool.
|
||||
pub trait Painter: SpeculativePainter {
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image>
|
||||
|
|
|
@ -32,6 +32,7 @@ canvas = {path = "../canvas"}
|
|||
canvas_traits = {path = "../canvas_traits"}
|
||||
compositing = {path = "../compositing", features = ["gleam"]}
|
||||
constellation = {path = "../constellation"}
|
||||
crossbeam-channel = "0.2"
|
||||
debugger = {path = "../debugger"}
|
||||
devtools = {path = "../devtools"}
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
|
@ -40,7 +41,7 @@ env_logger = "0.5"
|
|||
euclid = "0.19"
|
||||
gfx = {path = "../gfx"}
|
||||
gleam = "0.6"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
layout_thread = {path = "../layout_thread"}
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
|
|
|
@ -28,7 +28,6 @@ pub extern crate bluetooth;
|
|||
pub extern crate bluetooth_traits;
|
||||
pub extern crate canvas;
|
||||
pub extern crate canvas_traits;
|
||||
pub extern crate servo_channel;
|
||||
pub extern crate compositing;
|
||||
pub extern crate constellation;
|
||||
pub extern crate debugger;
|
||||
|
@ -47,6 +46,7 @@ pub extern crate profile_traits;
|
|||
pub extern crate script;
|
||||
pub extern crate script_traits;
|
||||
pub extern crate script_layout_interface;
|
||||
pub extern crate servo_channel;
|
||||
pub extern crate servo_config;
|
||||
pub extern crate servo_geometry;
|
||||
pub extern crate servo_url;
|
||||
|
@ -96,13 +96,13 @@ use profile::time as profile_time;
|
|||
use profile_traits::mem;
|
||||
use profile_traits::time;
|
||||
use script_traits::{ConstellationMsg, SWManagerSenders, ScriptToConstellationChan};
|
||||
use servo_channel::{Sender, channel};
|
||||
use servo_config::opts;
|
||||
use servo_config::prefs::PREFS;
|
||||
use std::borrow::Cow;
|
||||
use std::cmp::max;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::{Sender, channel};
|
||||
use webrender::RendererKind;
|
||||
use webvr::{WebVRThread, WebVRCompositorHandler};
|
||||
|
||||
|
@ -276,7 +276,7 @@ where
|
|||
WindowEvent::LoadUrl(top_level_browsing_context_id, url) => {
|
||||
let msg = ConstellationMsg::LoadUrl(top_level_browsing_context_id, url);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending load url to constellation failed ({}).", e);
|
||||
warn!("Sending load url to constellation failed ({:?}).", e);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -314,14 +314,14 @@ where
|
|||
let msg =
|
||||
ConstellationMsg::TraverseHistory(top_level_browsing_context_id, direction);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending navigation to constellation failed ({}).", e);
|
||||
warn!("Sending navigation to constellation failed ({:?}).", e);
|
||||
}
|
||||
},
|
||||
|
||||
WindowEvent::KeyEvent(ch, key, state, modifiers) => {
|
||||
let msg = ConstellationMsg::KeyEvent(ch, key, state, modifiers);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending key event to constellation failed ({}).", e);
|
||||
warn!("Sending key event to constellation failed ({:?}).", e);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -332,7 +332,7 @@ where
|
|||
WindowEvent::Reload(top_level_browsing_context_id) => {
|
||||
let msg = ConstellationMsg::Reload(top_level_browsing_context_id);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending reload to constellation failed ({}).", e);
|
||||
warn!("Sending reload to constellation failed ({:?}).", e);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -348,7 +348,7 @@ where
|
|||
let msg = ConstellationMsg::NewBrowser(url, browser_id);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!(
|
||||
"Sending NewBrowser message to constellation failed ({}).",
|
||||
"Sending NewBrowser message to constellation failed ({:?}).",
|
||||
e
|
||||
);
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ where
|
|||
let msg = ConstellationMsg::SelectBrowser(ctx);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!(
|
||||
"Sending SelectBrowser message to constellation failed ({}).",
|
||||
"Sending SelectBrowser message to constellation failed ({:?}).",
|
||||
e
|
||||
);
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ where
|
|||
let msg = ConstellationMsg::CloseBrowser(ctx);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!(
|
||||
"Sending CloseBrowser message to constellation failed ({}).",
|
||||
"Sending CloseBrowser message to constellation failed ({:?}).",
|
||||
e
|
||||
);
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ where
|
|||
WindowEvent::SendError(ctx, e) => {
|
||||
let msg = ConstellationMsg::SendError(ctx, e);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending SendError message to constellation failed ({}).", e);
|
||||
warn!("Sending SendError message to constellation failed ({:?}).", e);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ gecko = ["num_cpus",
|
|||
use_bindgen = ["bindgen", "regex", "toml"]
|
||||
servo = ["serde", "style_traits/servo", "servo_atoms", "servo_config", "html5ever",
|
||||
"cssparser/serde", "encoding_rs", "malloc_size_of/servo", "arrayvec/use_union",
|
||||
"servo_url", "string_cache"]
|
||||
"servo_url", "string_cache", "servo_channel"]
|
||||
gecko_debug = []
|
||||
|
||||
[dependencies]
|
||||
|
@ -59,6 +59,7 @@ selectors = { path = "../selectors" }
|
|||
serde = {version = "1.0", optional = true, features = ["derive"]}
|
||||
servo_arc = { path = "../servo_arc" }
|
||||
servo_atoms = {path = "../atoms", optional = true}
|
||||
servo_channel = {path = "../channel", optional = true}
|
||||
servo_config = {path = "../config", optional = true}
|
||||
smallbitvec = "2.1.1"
|
||||
smallvec = "0.6.2"
|
||||
|
|
|
@ -15,8 +15,8 @@ use properties::longhands::animation_direction::computed_value::single_value::T
|
|||
use properties::longhands::animation_play_state::computed_value::single_value::T as AnimationPlayState;
|
||||
use rule_tree::CascadeLevel;
|
||||
use servo_arc::Arc;
|
||||
use servo_channel::Sender;
|
||||
use std::fmt;
|
||||
use std::sync::mpsc::Sender;
|
||||
use stylesheets::keyframes_rule::{KeyframesAnimation, KeyframesStep, KeyframesStepValue};
|
||||
use timer::Timer;
|
||||
use values::computed::Time;
|
||||
|
|
|
@ -32,14 +32,14 @@ use selectors::matching::ElementSelectorFlags;
|
|||
use servo_arc::Arc;
|
||||
#[cfg(feature = "servo")]
|
||||
use servo_atoms::Atom;
|
||||
#[cfg(feature = "servo")]
|
||||
use servo_channel::Sender;
|
||||
use shared_lock::StylesheetGuards;
|
||||
use sharing::StyleSharingCache;
|
||||
use std::fmt;
|
||||
use std::ops;
|
||||
#[cfg(feature = "servo")]
|
||||
use std::sync::Mutex;
|
||||
#[cfg(feature = "servo")]
|
||||
use std::sync::mpsc::Sender;
|
||||
use style_traits::CSSPixel;
|
||||
use style_traits::DevicePixel;
|
||||
#[cfg(feature = "servo")]
|
||||
|
|
|
@ -84,6 +84,7 @@ pub extern crate servo_arc;
|
|||
#[cfg(feature = "servo")]
|
||||
#[macro_use]
|
||||
extern crate servo_atoms;
|
||||
#[cfg(feature = "servo")] extern crate servo_channel;
|
||||
#[cfg(feature = "servo")]
|
||||
extern crate servo_config;
|
||||
#[cfg(feature = "servo")]
|
||||
|
|
|
@ -15,13 +15,14 @@ cookie = "0.10"
|
|||
euclid = "0.19"
|
||||
hyper = "0.10"
|
||||
image = "0.19"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
net_traits = {path = "../net_traits"}
|
||||
regex = "1.0"
|
||||
rustc-serialize = "0.3.4"
|
||||
script_traits = {path = "../script_traits"}
|
||||
servo_channel = {path = "../channel"}
|
||||
servo_config = {path = "../config"}
|
||||
servo_url = {path = "../url"}
|
||||
url = "1.2"
|
||||
|
|
|
@ -19,6 +19,7 @@ extern crate net_traits;
|
|||
extern crate regex;
|
||||
extern crate rustc_serialize;
|
||||
extern crate script_traits;
|
||||
extern crate servo_channel;
|
||||
extern crate servo_config;
|
||||
extern crate servo_url;
|
||||
extern crate uuid;
|
||||
|
@ -38,12 +39,12 @@ use rustc_serialize::json::{Json, ToJson};
|
|||
use script_traits::{ConstellationMsg, LoadData, WebDriverCommandMsg};
|
||||
use script_traits::webdriver_msg::{LoadStatus, WebDriverCookieError, WebDriverFrameId};
|
||||
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand};
|
||||
use servo_channel::Sender;
|
||||
use servo_config::prefs::{PREFS, PrefValue};
|
||||
use servo_url::ServoUrl;
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::BTreeMap;
|
||||
use std::net::{SocketAddr, SocketAddrV4};
|
||||
use std::sync::mpsc::Sender;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use uuid::Uuid;
|
||||
|
@ -1180,7 +1181,7 @@ impl WebDriverHandler<ServoExtensionRoute> for Handler {
|
|||
|
||||
fn delete_session(&mut self, _session: &Option<Session>) {
|
||||
// Servo doesn't support multiple sessions, so we exit on session deletion
|
||||
let _ = self.constellation_chan.send(ConstellationMsg::Exit);
|
||||
let _ = self.constellation_chan.send(ConstellationMsg::Exit).unwrap();
|
||||
self.session = None;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,10 +16,11 @@ oculusvr = ['rust-webvr/oculusvr']
|
|||
[dependencies]
|
||||
canvas_traits = {path = "../canvas_traits"}
|
||||
euclid = "0.19"
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
rust-webvr = {version = "0.9", features = ["openvr"]}
|
||||
script_traits = {path = "../script_traits"}
|
||||
servo_channel = {path = "../channel"}
|
||||
servo_config = {path = "../config"}
|
||||
webvr_traits = {path = "../webvr_traits" }
|
||||
|
|
|
@ -12,6 +12,7 @@ extern crate log;
|
|||
extern crate msg;
|
||||
extern crate rust_webvr;
|
||||
extern crate script_traits;
|
||||
extern crate servo_channel;
|
||||
extern crate servo_config;
|
||||
extern crate webvr_traits;
|
||||
|
||||
|
|
|
@ -9,11 +9,10 @@ use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
|||
use msg::constellation_msg::PipelineId;
|
||||
use rust_webvr::VRServiceManager;
|
||||
use script_traits::ConstellationMsg;
|
||||
use servo_channel::{channel, Receiver, Sender};
|
||||
use servo_config::prefs::PREFS;
|
||||
use std::{thread, time};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::sync::mpsc;
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
use webvr_traits::{WebVRMsg, WebVRResult};
|
||||
use webvr_traits::webvr::*;
|
||||
|
||||
|
@ -72,7 +71,7 @@ impl WebVRThread {
|
|||
vr_compositor_chan: WebVRCompositorSender,
|
||||
) -> (IpcSender<WebVRMsg>, Sender<Sender<ConstellationMsg>>) {
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let (constellation_sender, constellation_receiver) = mpsc::channel();
|
||||
let (constellation_sender, constellation_receiver) = channel();
|
||||
let sender_clone = sender.clone();
|
||||
thread::Builder::new()
|
||||
.name("WebVRThread".into())
|
||||
|
@ -358,7 +357,7 @@ pub type WebVRCompositorSender = Sender<Option<WebVRCompositor>>;
|
|||
|
||||
impl WebVRCompositorHandler {
|
||||
pub fn new() -> (Box<WebVRCompositorHandler>, WebVRCompositorSender) {
|
||||
let (sender, receiver) = mpsc::channel();
|
||||
let (sender, receiver) = channel();
|
||||
let instance = Box::new(WebVRCompositorHandler {
|
||||
compositors: HashMap::new(),
|
||||
webvr_thread_receiver: receiver,
|
||||
|
|
|
@ -10,7 +10,7 @@ name = "webvr_traits"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
ipc-channel = "0.10"
|
||||
ipc-channel = "0.11"
|
||||
msg = {path = "../msg"}
|
||||
rust-webvr-api = {version = "0.9", features = ["serde-serialization"]}
|
||||
serde = "1.0"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue