mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update crossbeam-channel to 0.3
This commit is contained in:
parent
76195e0779
commit
9a7eeb349a
74 changed files with 303 additions and 521 deletions
|
@ -68,6 +68,7 @@ use crate::task_manager::TaskManager;
|
|||
use crate::task_source::TaskSourceName;
|
||||
use crate::timers::{IsInterval, TimerCallback};
|
||||
use crate::webdriver_handlers::jsval_to_webdriver;
|
||||
use crossbeam_channel::{unbounded, Sender, TryRecvError};
|
||||
use cssparser::{Parser, ParserInput};
|
||||
use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType};
|
||||
use dom_struct::dom_struct;
|
||||
|
@ -104,7 +105,6 @@ use script_traits::{ConstellationControlMsg, DocumentState, LoadData};
|
|||
use script_traits::{ScriptMsg, ScriptToConstellationChan, ScrollState, TimerEvent, TimerEventId};
|
||||
use script_traits::{TimerSchedulerMsg, UntrustedNodeAddress, WindowSizeData, WindowSizeType};
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use servo_channel::{channel, Sender};
|
||||
use servo_config::opts;
|
||||
use servo_geometry::{f32_rect_to_au_rect, MaxRect};
|
||||
use servo_url::{Host, ImmutableOrigin, MutableOrigin, ServoUrl};
|
||||
|
@ -348,7 +348,7 @@ impl Window {
|
|||
}
|
||||
|
||||
pub fn new_script_pair(&self) -> (Box<dyn ScriptChan + Send>, Box<dyn ScriptPort + Send>) {
|
||||
let (tx, rx) = channel();
|
||||
let (tx, rx) = unbounded();
|
||||
(Box::new(SendableMainThreadScriptChan(tx)), Box::new(rx))
|
||||
}
|
||||
|
||||
|
@ -1394,7 +1394,7 @@ impl Window {
|
|||
};
|
||||
|
||||
// Layout will let us know when it's done.
|
||||
let (join_chan, join_port) = channel();
|
||||
let (join_chan, join_port) = unbounded();
|
||||
|
||||
// On debug mode, print the reflow event information.
|
||||
if opts::get().relayout_event {
|
||||
|
@ -1427,16 +1427,15 @@ impl Window {
|
|||
|
||||
debug!("script: layout forked");
|
||||
|
||||
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 => {
|
||||
let complete = match join_port.try_recv() {
|
||||
Err(TryRecvError::Empty) => {
|
||||
info!("script: waiting on layout");
|
||||
join_port.recv().unwrap()
|
||||
}
|
||||
},
|
||||
Ok(reflow_complete) => reflow_complete,
|
||||
Err(TryRecvError::Disconnected) => {
|
||||
panic!("Layout thread failed while script was waiting for a result.");
|
||||
},
|
||||
};
|
||||
|
||||
debug!("script: layout joined");
|
||||
|
@ -2033,7 +2032,7 @@ impl Window {
|
|||
webrender_api_sender: RenderApiSender,
|
||||
) -> DomRoot<Self> {
|
||||
let layout_rpc: Box<dyn LayoutRPC + Send> = {
|
||||
let (rpc_send, rpc_recv) = channel();
|
||||
let (rpc_send, rpc_recv) = unbounded();
|
||||
layout_chan.send(Msg::GetRPC(rpc_send)).unwrap();
|
||||
rpc_recv.recv().unwrap()
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue