mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
add servo_channel crate
This commit is contained in:
parent
704f7a06b1
commit
b977b4994c
12 changed files with 252 additions and 11 deletions
|
@ -49,6 +49,8 @@ use profile_traits::ipc;
|
|||
use script_traits::{DrawAPaintImageResult, PaintWorkletError};
|
||||
use script_traits::Painter;
|
||||
use servo_atoms::Atom;
|
||||
use servo_channel::{channel, Sender};
|
||||
use servo_channel::base_channel;
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_url::ServoUrl;
|
||||
use std::cell::Cell;
|
||||
|
@ -364,9 +366,12 @@ impl PaintWorkletGlobalScope {
|
|||
.as_u64()
|
||||
.unwrap_or(10u64);
|
||||
|
||||
let timeout_duration = Duration::from_millis(timeout);
|
||||
receiver.recv_timeout(timeout_duration)
|
||||
.map_err(|e| PaintWorkletError::from(e))
|
||||
select! {
|
||||
recv(base_channel::after(Duration::from_millis(timeout))) => {
|
||||
Err(PaintWorkletError::Timeout)
|
||||
}
|
||||
recv(receiver.select(), msg) => msg.ok_or(PaintWorkletError::Timeout)
|
||||
}
|
||||
}
|
||||
}
|
||||
Box::new(WorkletPainter {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue