mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Properly root the running animation list in a RootedVec
This commit is contained in:
parent
1327ebd52f
commit
26ab0f82a8
3 changed files with 29 additions and 11 deletions
|
@ -668,11 +668,25 @@ pub struct RootedVec<'a, T: 'static + JSTraceable> {
|
|||
root: &'a mut RootableVec<T>,
|
||||
}
|
||||
|
||||
impl<'a, T: 'static + JSTraceable + DomObject> RootedVec<'a, JS<T>> {
|
||||
impl<'a, T: 'static + JSTraceable> RootedVec<'a, T> {
|
||||
/// Create a vector of items of type T that is rooted for
|
||||
/// the lifetime of this struct
|
||||
pub fn new<I: Iterator<Item = Root<T>>>(root: &'a mut RootableVec<JS<T>>, iter: I)
|
||||
-> RootedVec<'a, JS<T>> {
|
||||
pub fn new(root: &'a mut RootableVec<T>) -> Self {
|
||||
unsafe {
|
||||
RootedTraceableSet::add(root);
|
||||
}
|
||||
RootedVec {
|
||||
root: root,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: 'static + JSTraceable + DomObject> RootedVec<'a, JS<T>> {
|
||||
/// Create a vector of items of type JS<T> that is rooted for
|
||||
/// the lifetime of this struct
|
||||
pub fn from_iter<I>(root: &'a mut RootableVec<JS<T>>, iter: I) -> Self
|
||||
where I: Iterator<Item = Root<T>>
|
||||
{
|
||||
unsafe {
|
||||
RootedTraceableSet::add(root);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue