RootCollection: Start using RootedVec instead of SmallVec32.

dom/bindings/js.rs: Alphabetize `use`.

dom/bindings/js.rs: moved `unsafe` block to a let binding.

dom/bindings/trace.rs: rename alternate constructor of RootedVec.

dom/bindings/trace.rs: `new()` is now using `new_with_destination_address()` internally.

dom/bindings/js.rs: alphabetize imports.
This commit is contained in:
Jag Talon 2015-04-06 13:28:28 -04:00
parent f22d920b4d
commit 6e013d3c9c
2 changed files with 20 additions and 7 deletions

View file

@ -389,12 +389,21 @@ impl<T: VecRootableType> RootedVec<T> {
/// Create a vector of items of type T that is rooted for
/// the lifetime of this struct
pub fn new() -> RootedVec<T> {
let addr = unsafe {
return_address() as *const libc::c_void
};
RootedVec::new_with_destination_address(addr)
}
/// Create a vector of items of type T. This constructor is specific
/// for RootCollection.
pub fn new_with_destination_address(addr: *const libc::c_void) -> RootedVec<T> {
unsafe {
RootedCollectionSet::add::<T>(&*(return_address() as *const _));
RootedCollectionSet::add::<T>(&*(addr as *const _));
}
RootedVec::<T> { v: vec!() }
}
}
#[unsafe_destructor]