mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Use boxed slice instead of vec for FuntionTimerCallback
This commit is contained in:
parent
eec51cdd57
commit
fa678992ff
2 changed files with 10 additions and 2 deletions
|
@ -177,6 +177,14 @@ unsafe impl<T: JSTraceable + ?Sized> JSTraceable for Box<T> {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl<T: JSTraceable> JSTraceable for [T] {
|
||||
unsafe fn trace(&self, trc: *mut JSTracer) {
|
||||
for e in self.iter() {
|
||||
e.trace(trc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<T: JSTraceable + Copy> JSTraceable for Cell<T> {
|
||||
unsafe fn trace(&self, trc: *mut JSTracer) {
|
||||
self.get().trace(trc)
|
||||
|
|
|
@ -350,7 +350,7 @@ pub enum TimerCallback {
|
|||
#[derive(JSTraceable, Clone)]
|
||||
enum InternalTimerCallback {
|
||||
StringTimerCallback(DOMString),
|
||||
FunctionTimerCallback(Rc<Function>, Rc<Vec<Heap<JSVal>>>),
|
||||
FunctionTimerCallback(Rc<Function>, Rc<Box<[Heap<JSVal>]>>),
|
||||
}
|
||||
|
||||
impl HeapSizeOf for InternalTimerCallback {
|
||||
|
@ -392,7 +392,7 @@ impl JsTimers {
|
|||
for (i, item) in arguments.iter().enumerate() {
|
||||
args.get_mut(i).unwrap().set(item.get());
|
||||
}
|
||||
InternalTimerCallback::FunctionTimerCallback(function, Rc::new(args))
|
||||
InternalTimerCallback::FunctionTimerCallback(function, Rc::new(args.into_boxed_slice()))
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue