mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
script: Make timers per-process (#34581)
Before all timers were managed by the Constellation process, meaning that they had to trigger IPC calls to be scheduled and fired. Currently, timers are only used in the `ScriptThread`, so it makes sense that they are per-process. This change restores the timer thread functionality that existed before avoided entirely. Completion is done using a callback that is sent to the timer thread similarly to how fetch is done. This allows reusing the existing task queue without making any new channels. Fixes #15219. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
ff7626bfc6
commit
226299380d
21 changed files with 366 additions and 324 deletions
|
@ -46,6 +46,8 @@
|
|||
//! Note: WebRender has a reduced fork of this crate, so that we can avoid
|
||||
//! publishing this crate on crates.io.
|
||||
|
||||
use std::cell::OnceCell;
|
||||
use std::collections::BinaryHeap;
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::ops::Range;
|
||||
|
||||
|
@ -351,6 +353,12 @@ impl<T: MallocSizeOf> MallocSizeOf for thin_vec::ThinVec<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: MallocSizeOf> MallocSizeOf for BinaryHeap<T> {
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
self.iter().map(|element| element.size_of(ops)).sum()
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! malloc_size_of_hash_set {
|
||||
($ty:ty) => {
|
||||
impl<T, S> MallocShallowSizeOf for $ty
|
||||
|
@ -468,6 +476,14 @@ impl<T> MallocSizeOf for std::marker::PhantomData<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: MallocSizeOf> MallocSizeOf for OnceCell<T> {
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
self.get()
|
||||
.map(|interior| interior.size_of(ops))
|
||||
.unwrap_or_default()
|
||||
}
|
||||
}
|
||||
|
||||
// See https://github.com/rust-lang/rust/issues/68318:
|
||||
// We don't want MallocSizeOf to be defined for Rc and Arc. If negative trait bounds are
|
||||
// ever allowed, this code should be uncommented. Instead, there is a compile-fail test for
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue