Auto merge of #14557 - nox:trace, r=jdm

Improve safety or our tracing architecture

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14557)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-12-12 20:34:51 -08:00 committed by GitHub
commit 87f7b29d65
66 changed files with 297 additions and 321 deletions

View file

@ -29,19 +29,19 @@ impl EarlyLintPass for BanPass {
.and_then(|t| t.get(0)) .and_then(|t| t.get(0))
.and_then(|t| match_ty_unwrap(&**t, &["dom", "bindings", "js", "JS"])) .and_then(|t| match_ty_unwrap(&**t, &["dom", "bindings", "js", "JS"]))
.is_some() { .is_some() {
cx.span_lint(BANNED_TYPE, ty.span, "Banned type Cell<JS<T>> detected. Use MutHeap<JS<T>> instead") cx.span_lint(BANNED_TYPE, ty.span, "Banned type Cell<JS<T>> detected. Use MutJS<JS<T>> instead")
} }
if match_ty_unwrap(ty, &["std", "cell", "Cell"]) if match_ty_unwrap(ty, &["std", "cell", "Cell"])
.and_then(|t| t.get(0)) .and_then(|t| t.get(0))
.and_then(|t| match_ty_unwrap(&**t, &["js", "jsval", "JSVal"])) .and_then(|t| match_ty_unwrap(&**t, &["js", "jsval", "JSVal"]))
.is_some() { .is_some() {
cx.span_lint(BANNED_TYPE, ty.span, "Banned type Cell<JSVal> detected. Use MutHeap<JSVal> instead") cx.span_lint(BANNED_TYPE, ty.span, "Banned type Cell<JSVal> detected. Use MutJS<JSVal> instead")
} }
if match_ty_unwrap(ty, &["dom", "bindings", "cell", "DOMRefCell"]) if match_ty_unwrap(ty, &["dom", "bindings", "cell", "DOMRefCell"])
.and_then(|t| t.get(0)) .and_then(|t| t.get(0))
.and_then(|t| match_ty_unwrap(&**t, &["dom", "bindings", "js", "JS"])) .and_then(|t| match_ty_unwrap(&**t, &["dom", "bindings", "js", "JS"]))
.is_some() { .is_some() {
cx.span_lint(BANNED_TYPE, ty.span, "Banned type DOMRefCell<JS<T>> detected. Use MutHeap<JS<T>> instead") cx.span_lint(BANNED_TYPE, ty.span, "Banned type DOMRefCell<JS<T>> detected. Use MutJS<JS<T>> instead")
} }
} }
} }

View file

@ -6,8 +6,7 @@ use devtools_traits::AttrInfo;
use dom::bindings::cell::DOMRefCell; use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods}; use dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap}; use dom::bindings::js::{LayoutJS, MutNullableJS, Root, RootedReference};
use dom::bindings::js::{LayoutJS, Root, RootedReference};
use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::element::{AttributeMutation, Element}; use dom::element::{AttributeMutation, Element};
@ -28,7 +27,7 @@ pub struct Attr {
value: DOMRefCell<AttrValue>, value: DOMRefCell<AttrValue>,
/// the element that owns this attribute. /// the element that owns this attribute.
owner: MutNullableHeap<JS<Element>>, owner: MutNullableJS<Element>,
} }
impl Attr { impl Attr {
@ -48,7 +47,7 @@ impl Attr {
prefix: prefix, prefix: prefix,
}, },
value: DOMRefCell::new(value), value: DOMRefCell::new(value),
owner: MutNullableHeap::new(owner), owner: MutNullableJS::new(owner),
} }
} }

View file

@ -229,20 +229,6 @@ impl LayoutJS<Node> {
} }
} }
/// A trait to be implemented for JS-managed types that can be stored in
/// mutable member fields.
///
/// Do not implement this trait yourself.
pub trait HeapGCValue: JSTraceable {
}
impl HeapGCValue for Heap<JSVal> {
}
impl<T: DomObject> HeapGCValue for JS<T> {
}
/// A holder that provides interior mutability for GC-managed JSVals. /// A holder that provides interior mutability for GC-managed JSVals.
/// ///
/// Must be used in place of traditional interior mutability to ensure proper /// Must be used in place of traditional interior mutability to ensure proper
@ -293,20 +279,20 @@ impl MutHeapJSVal {
/// on `JS<T>`. /// on `JS<T>`.
#[must_root] #[must_root]
#[derive(JSTraceable)] #[derive(JSTraceable)]
pub struct MutHeap<T: HeapGCValue> { pub struct MutJS<T: DomObject> {
val: UnsafeCell<T>, val: UnsafeCell<JS<T>>,
} }
impl<T: DomObject> MutHeap<JS<T>> { impl<T: DomObject> MutJS<T> {
/// Create a new `MutHeap`. /// Create a new `MutJS`.
pub fn new(initial: &T) -> MutHeap<JS<T>> { pub fn new(initial: &T) -> MutJS<T> {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
MutHeap { MutJS {
val: UnsafeCell::new(JS::from_ref(initial)), val: UnsafeCell::new(JS::from_ref(initial)),
} }
} }
/// Set this `MutHeap` to the given value. /// Set this `MutJS` to the given value.
pub fn set(&self, val: &T) { pub fn set(&self, val: &T) {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
unsafe { unsafe {
@ -314,7 +300,7 @@ impl<T: DomObject> MutHeap<JS<T>> {
} }
} }
/// Get the value in this `MutHeap`. /// Get the value in this `MutJS`.
pub fn get(&self) -> Root<T> { pub fn get(&self) -> Root<T> {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
unsafe { unsafe {
@ -323,14 +309,14 @@ impl<T: DomObject> MutHeap<JS<T>> {
} }
} }
impl<T: HeapGCValue> HeapSizeOf for MutHeap<T> { impl<T: DomObject> HeapSizeOf for MutJS<T> {
fn heap_size_of_children(&self) -> usize { fn heap_size_of_children(&self) -> usize {
// See comment on HeapSizeOf for JS<T>. // See comment on HeapSizeOf for JS<T>.
0 0
} }
} }
impl<T: DomObject> PartialEq for MutHeap<JS<T>> { impl<T: DomObject> PartialEq for MutJS<T> {
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
unsafe { unsafe {
*self.val.get() == *other.val.get() *self.val.get() == *other.val.get()
@ -338,7 +324,7 @@ impl<T: DomObject> PartialEq for MutHeap<JS<T>> {
} }
} }
impl<T: DomObject + PartialEq> PartialEq<T> for MutHeap<JS<T>> { impl<T: DomObject + PartialEq> PartialEq<T> for MutJS<T> {
fn eq(&self, other: &T) -> bool { fn eq(&self, other: &T) -> bool {
unsafe { unsafe {
**self.val.get() == *other **self.val.get() == *other
@ -354,15 +340,15 @@ impl<T: DomObject + PartialEq> PartialEq<T> for MutHeap<JS<T>> {
/// on `JS<T>`. /// on `JS<T>`.
#[must_root] #[must_root]
#[derive(JSTraceable)] #[derive(JSTraceable)]
pub struct MutNullableHeap<T: HeapGCValue> { pub struct MutNullableJS<T: DomObject> {
ptr: UnsafeCell<Option<T>>, ptr: UnsafeCell<Option<JS<T>>>,
} }
impl<T: DomObject> MutNullableHeap<JS<T>> { impl<T: DomObject> MutNullableJS<T> {
/// Create a new `MutNullableHeap`. /// Create a new `MutNullableJS`.
pub fn new(initial: Option<&T>) -> MutNullableHeap<JS<T>> { pub fn new(initial: Option<&T>) -> MutNullableJS<T> {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
MutNullableHeap { MutNullableJS {
ptr: UnsafeCell::new(initial.map(JS::from_ref)), ptr: UnsafeCell::new(initial.map(JS::from_ref)),
} }
} }
@ -400,7 +386,7 @@ impl<T: DomObject> MutNullableHeap<JS<T>> {
} }
} }
/// Set this `MutNullableHeap` to the given value. /// Set this `MutNullableJS` to the given value.
pub fn set(&self, val: Option<&T>) { pub fn set(&self, val: Option<&T>) {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
unsafe { unsafe {
@ -416,7 +402,7 @@ impl<T: DomObject> MutNullableHeap<JS<T>> {
} }
} }
impl<T: DomObject> PartialEq for MutNullableHeap<JS<T>> { impl<T: DomObject> PartialEq for MutNullableJS<T> {
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
unsafe { unsafe {
*self.ptr.get() == *other.ptr.get() *self.ptr.get() == *other.ptr.get()
@ -424,7 +410,7 @@ impl<T: DomObject> PartialEq for MutNullableHeap<JS<T>> {
} }
} }
impl<'a, T: DomObject> PartialEq<Option<&'a T>> for MutNullableHeap<JS<T>> { impl<'a, T: DomObject> PartialEq<Option<&'a T>> for MutNullableJS<T> {
fn eq(&self, other: &Option<&T>) -> bool { fn eq(&self, other: &Option<&T>) -> bool {
unsafe { unsafe {
*self.ptr.get() == other.map(JS::from_ref) *self.ptr.get() == other.map(JS::from_ref)
@ -432,17 +418,17 @@ impl<'a, T: DomObject> PartialEq<Option<&'a T>> for MutNullableHeap<JS<T>> {
} }
} }
impl<T: HeapGCValue> Default for MutNullableHeap<T> { impl<T: DomObject> Default for MutNullableJS<T> {
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
fn default() -> MutNullableHeap<T> { fn default() -> MutNullableJS<T> {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
MutNullableHeap { MutNullableJS {
ptr: UnsafeCell::new(None), ptr: UnsafeCell::new(None),
} }
} }
} }
impl<T: HeapGCValue> HeapSizeOf for MutNullableHeap<T> { impl<T: DomObject> HeapSizeOf for MutNullableJS<T> {
fn heap_size_of_children(&self) -> usize { fn heap_size_of_children(&self) -> usize {
// See comment on HeapSizeOf for JS<T>. // See comment on HeapSizeOf for JS<T>.
0 0

View file

@ -59,7 +59,6 @@ use js::glue::{CallObjectTracer, CallUnbarrieredObjectTracer, CallValueTracer};
use js::jsapi::{GCTraceKindToAscii, Heap, JSObject, JSTracer, TraceKind}; use js::jsapi::{GCTraceKindToAscii, Heap, JSObject, JSTracer, TraceKind};
use js::jsval::JSVal; use js::jsval::JSVal;
use js::rust::Runtime; use js::rust::Runtime;
use libc;
use msg::constellation_msg::{FrameId, FrameType, PipelineId}; use msg::constellation_msg::{FrameId, FrameType, PipelineId};
use net_traits::{Metadata, NetworkError, ReferrerPolicy, ResourceThreads}; use net_traits::{Metadata, NetworkError, ReferrerPolicy, ResourceThreads};
use net_traits::filemanager_thread::RelativePos; use net_traits::filemanager_thread::RelativePos;
@ -82,7 +81,7 @@ use serde::{Deserialize, Serialize};
use servo_atoms::Atom; use servo_atoms::Atom;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::cell::{Cell, UnsafeCell}; use std::cell::{Cell, RefCell, UnsafeCell};
use std::collections::{BTreeMap, HashMap, HashSet, VecDeque}; use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
use std::hash::{BuildHasher, Hash}; use std::hash::{BuildHasher, Hash};
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
@ -568,27 +567,16 @@ unsafe impl JSTraceable for RwLock<MediaList> {
} }
} }
/// Homemade trait object for JSTraceable things
struct TraceableInfo {
pub ptr: *const libc::c_void,
pub trace: unsafe fn(obj: *const libc::c_void, tracer: *mut JSTracer),
}
/// Holds a set of JSTraceables that need to be rooted /// Holds a set of JSTraceables that need to be rooted
pub struct RootedTraceableSet { pub struct RootedTraceableSet {
set: Vec<TraceableInfo>, set: Vec<*const JSTraceable>,
} }
#[allow(missing_docs)] // FIXME thread_local!(
mod dummy { // Attributes dont apply through the macro.
use std::cell::RefCell;
use std::rc::Rc;
use super::RootedTraceableSet;
/// TLV Holds a set of JSTraceables that need to be rooted /// TLV Holds a set of JSTraceables that need to be rooted
thread_local!(pub static ROOTED_TRACEABLES: Rc<RefCell<RootedTraceableSet>> = static ROOTED_TRACEABLES: Rc<RefCell<RootedTraceableSet>> =
Rc::new(RefCell::new(RootedTraceableSet::new()))); Rc::new(RefCell::new(RootedTraceableSet::new()));
} );
pub use self::dummy::ROOTED_TRACEABLES;
impl RootedTraceableSet { impl RootedTraceableSet {
fn new() -> RootedTraceableSet { fn new() -> RootedTraceableSet {
@ -597,12 +585,12 @@ impl RootedTraceableSet {
} }
} }
unsafe fn remove<T: JSTraceable>(traceable: &T) { unsafe fn remove(traceable: *const JSTraceable) {
ROOTED_TRACEABLES.with(|ref traceables| { ROOTED_TRACEABLES.with(|ref traceables| {
let mut traceables = traceables.borrow_mut(); let mut traceables = traceables.borrow_mut();
let idx = let idx =
match traceables.set.iter() match traceables.set.iter()
.rposition(|x| x.ptr == traceable as *const T as *const _) { .rposition(|x| *x == traceable) {
Some(idx) => idx, Some(idx) => idx,
None => unreachable!(), None => unreachable!(),
}; };
@ -610,25 +598,15 @@ impl RootedTraceableSet {
}); });
} }
unsafe fn add<T: JSTraceable>(traceable: &T) { unsafe fn add(traceable: *const JSTraceable) {
ROOTED_TRACEABLES.with(|ref traceables| { ROOTED_TRACEABLES.with(|ref traceables| {
unsafe fn trace<T: JSTraceable>(obj: *const libc::c_void, tracer: *mut JSTracer) { traceables.borrow_mut().set.push(traceable);
let obj: &T = &*(obj as *const T);
obj.trace(tracer);
}
let mut traceables = traceables.borrow_mut();
let info = TraceableInfo {
ptr: traceable as *const T as *const libc::c_void,
trace: trace::<T>,
};
traceables.set.push(info);
}) })
} }
unsafe fn trace(&self, tracer: *mut JSTracer) { unsafe fn trace(&self, tracer: *mut JSTracer) {
for info in &self.set { for traceable in &self.set {
(info.trace)(info.ptr, tracer); (**traceable).trace(tracer);
} }
} }
} }
@ -640,11 +618,11 @@ impl RootedTraceableSet {
/// If you have an arbitrary number of DomObjects to root, use rooted_vec!. /// If you have an arbitrary number of DomObjects to root, use rooted_vec!.
/// If you know what you're doing, use this. /// If you know what you're doing, use this.
#[derive(JSTraceable)] #[derive(JSTraceable)]
pub struct RootedTraceable<'a, T: 'a + JSTraceable> { pub struct RootedTraceable<'a, T: 'static + JSTraceable> {
ptr: &'a T, ptr: &'a T,
} }
impl<'a, T: JSTraceable> RootedTraceable<'a, T> { impl<'a, T: JSTraceable + 'static> RootedTraceable<'a, T> {
/// Root a JSTraceable thing for the life of this RootedTraceable /// Root a JSTraceable thing for the life of this RootedTraceable
pub fn new(traceable: &'a T) -> RootedTraceable<'a, T> { pub fn new(traceable: &'a T) -> RootedTraceable<'a, T> {
unsafe { unsafe {
@ -656,7 +634,7 @@ impl<'a, T: JSTraceable> RootedTraceable<'a, T> {
} }
} }
impl<'a, T: JSTraceable> Drop for RootedTraceable<'a, T> { impl<'a, T: JSTraceable + 'static> Drop for RootedTraceable<'a, T> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
RootedTraceableSet::remove(self.ptr); RootedTraceableSet::remove(self.ptr);
@ -686,15 +664,29 @@ impl<T: JSTraceable> RootableVec<T> {
/// A vector of items that are rooted for the lifetime 'a. /// A vector of items that are rooted for the lifetime 'a.
#[allow_unrooted_interior] #[allow_unrooted_interior]
pub struct RootedVec<'a, T: 'a + JSTraceable> { pub struct RootedVec<'a, T: 'static + JSTraceable> {
root: &'a mut RootableVec<T>, root: &'a mut RootableVec<T>,
} }
impl<'a, T: 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 /// Create a vector of items of type T that is rooted for
/// the lifetime of this struct /// the lifetime of this struct
pub fn new<I: Iterator<Item = Root<T>>>(root: &'a mut RootableVec<JS<T>>, iter: I) pub fn new(root: &'a mut RootableVec<T>) -> Self {
-> RootedVec<'a, JS<T>> { 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 { unsafe {
RootedTraceableSet::add(root); RootedTraceableSet::add(root);
} }
@ -705,7 +697,7 @@ impl<'a, T: JSTraceable + DomObject> RootedVec<'a, JS<T>> {
} }
} }
impl<'a, T: JSTraceable> Drop for RootedVec<'a, T> { impl<'a, T: JSTraceable + 'static> Drop for RootedVec<'a, T> {
fn drop(&mut self) { fn drop(&mut self) {
self.clear(); self.clear();
unsafe { unsafe {

View file

@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong; use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
use dom::bindings::error::Error::{self, NotFound, Security, Type}; use dom::bindings::error::Error::{self, NotFound, Security, Type};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{MutJS, Root};
use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::refcounted::{Trusted, TrustedPromise};
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
@ -86,7 +86,7 @@ impl<Listener: AsyncBluetoothListener + DomObject> BluetoothResponseListener for
#[dom_struct] #[dom_struct]
pub struct Bluetooth { pub struct Bluetooth {
eventtarget: EventTarget, eventtarget: EventTarget,
device_instance_map: DOMRefCell<HashMap<String, MutHeap<JS<BluetoothDevice>>>>, device_instance_map: DOMRefCell<HashMap<String, MutJS<BluetoothDevice>>>,
} }
impl Bluetooth { impl Bluetooth {
@ -409,7 +409,7 @@ impl AsyncBluetoothListener for Bluetooth {
device.name.map(DOMString::from), device.name.map(DOMString::from),
&ad_data, &ad_data,
&self); &self);
device_instance_map.insert(device.id, MutHeap::new(&bt_device)); device_instance_map.insert(device.id, MutJS::new(&bt_device));
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice
// Step 5. // Step 5.
promise.resolve_native(promise_cx, &bt_device); promise.resolve_native(promise_cx, &bt_device);

View file

@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::BluetoothDeviceBinding;
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods; use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::js::{JS, Root, MutHeap, MutNullableHeap}; use dom::bindings::js::{MutJS, MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bluetooth::Bluetooth; use dom::bluetooth::Bluetooth;
@ -29,12 +29,12 @@ pub struct BluetoothDevice {
eventtarget: EventTarget, eventtarget: EventTarget,
id: DOMString, id: DOMString,
name: Option<DOMString>, name: Option<DOMString>,
ad_data: MutHeap<JS<BluetoothAdvertisingData>>, ad_data: MutJS<BluetoothAdvertisingData>,
gatt: MutNullableHeap<JS<BluetoothRemoteGATTServer>>, gatt: MutNullableJS<BluetoothRemoteGATTServer>,
context: MutHeap<JS<Bluetooth>>, context: MutJS<Bluetooth>,
attribute_instance_map: (DOMRefCell<HashMap<String, MutHeap<JS<BluetoothRemoteGATTService>>>>, attribute_instance_map: (DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTService>>>,
DOMRefCell<HashMap<String, MutHeap<JS<BluetoothRemoteGATTCharacteristic>>>>, DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTCharacteristic>>>,
DOMRefCell<HashMap<String, MutHeap<JS<BluetoothRemoteGATTDescriptor>>>>), DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTDescriptor>>>),
} }
impl BluetoothDevice { impl BluetoothDevice {
@ -47,9 +47,9 @@ impl BluetoothDevice {
eventtarget: EventTarget::new_inherited(), eventtarget: EventTarget::new_inherited(),
id: id, id: id,
name: name, name: name,
ad_data: MutHeap::new(ad_data), ad_data: MutJS::new(ad_data),
gatt: Default::default(), gatt: Default::default(),
context: MutHeap::new(context), context: MutJS::new(context),
attribute_instance_map: (DOMRefCell::new(HashMap::new()), attribute_instance_map: (DOMRefCell::new(HashMap::new()),
DOMRefCell::new(HashMap::new()), DOMRefCell::new(HashMap::new()),
DOMRefCell::new(HashMap::new())), DOMRefCell::new(HashMap::new())),
@ -84,7 +84,7 @@ impl BluetoothDevice {
DOMString::from(service.uuid.clone()), DOMString::from(service.uuid.clone()),
service.is_primary, service.is_primary,
service.instance_id.clone()); service.instance_id.clone());
service_map.insert(service.instance_id.clone(), MutHeap::new(&bt_service)); service_map.insert(service.instance_id.clone(), MutJS::new(&bt_service));
return bt_service; return bt_service;
} }
@ -113,7 +113,7 @@ impl BluetoothDevice {
DOMString::from(characteristic.uuid.clone()), DOMString::from(characteristic.uuid.clone()),
&properties, &properties,
characteristic.instance_id.clone()); characteristic.instance_id.clone());
characteristic_map.insert(characteristic.instance_id.clone(), MutHeap::new(&bt_characteristic)); characteristic_map.insert(characteristic.instance_id.clone(), MutJS::new(&bt_characteristic));
return bt_characteristic; return bt_characteristic;
} }
@ -130,7 +130,7 @@ impl BluetoothDevice {
characteristic, characteristic,
DOMString::from(descriptor.uuid.clone()), DOMString::from(descriptor.uuid.clone()),
descriptor.instance_id.clone()); descriptor.instance_id.clone());
descriptor_map.insert(descriptor.instance_id.clone(), MutHeap::new(&bt_descriptor)); descriptor_map.insert(descriptor.instance_id.clone(), MutJS::new(&bt_descriptor));
return bt_descriptor; return bt_descriptor;
} }
} }

View file

@ -16,7 +16,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::Bluetoo
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security}; use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{MutJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString}; use dom::bindings::str::{ByteString, DOMString};
use dom::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetooth::{AsyncBluetoothListener, response_async};
@ -38,9 +38,9 @@ pub const MAXIMUM_ATTRIBUTE_LENGTH: usize = 512;
#[dom_struct] #[dom_struct]
pub struct BluetoothRemoteGATTCharacteristic { pub struct BluetoothRemoteGATTCharacteristic {
eventtarget: EventTarget, eventtarget: EventTarget,
service: MutHeap<JS<BluetoothRemoteGATTService>>, service: MutJS<BluetoothRemoteGATTService>,
uuid: DOMString, uuid: DOMString,
properties: MutHeap<JS<BluetoothCharacteristicProperties>>, properties: MutJS<BluetoothCharacteristicProperties>,
value: DOMRefCell<Option<ByteString>>, value: DOMRefCell<Option<ByteString>>,
instance_id: String, instance_id: String,
} }
@ -53,9 +53,9 @@ impl BluetoothRemoteGATTCharacteristic {
-> BluetoothRemoteGATTCharacteristic { -> BluetoothRemoteGATTCharacteristic {
BluetoothRemoteGATTCharacteristic { BluetoothRemoteGATTCharacteristic {
eventtarget: EventTarget::new_inherited(), eventtarget: EventTarget::new_inherited(),
service: MutHeap::new(service), service: MutJS::new(service),
uuid: uuid, uuid: uuid,
properties: MutHeap::new(properties), properties: MutJS::new(properties),
value: DOMRefCell::new(None), value: DOMRefCell::new(None),
instance_id: instance_id, instance_id: instance_id,
} }

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding::Blue
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
use dom::bindings::error::Error::{self, InvalidModification, Network, Security}; use dom::bindings::error::Error::{self, InvalidModification, Network, Security};
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{MutJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString}; use dom::bindings::str::{ByteString, DOMString};
use dom::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetooth::{AsyncBluetoothListener, response_async};
@ -28,7 +28,7 @@ use std::rc::Rc;
#[dom_struct] #[dom_struct]
pub struct BluetoothRemoteGATTDescriptor { pub struct BluetoothRemoteGATTDescriptor {
reflector_: Reflector, reflector_: Reflector,
characteristic: MutHeap<JS<BluetoothRemoteGATTCharacteristic>>, characteristic: MutJS<BluetoothRemoteGATTCharacteristic>,
uuid: DOMString, uuid: DOMString,
value: DOMRefCell<Option<ByteString>>, value: DOMRefCell<Option<ByteString>>,
instance_id: String, instance_id: String,
@ -41,7 +41,7 @@ impl BluetoothRemoteGATTDescriptor {
-> BluetoothRemoteGATTDescriptor { -> BluetoothRemoteGATTDescriptor {
BluetoothRemoteGATTDescriptor { BluetoothRemoteGATTDescriptor {
reflector_: Reflector::new(), reflector_: Reflector::new(),
characteristic: MutHeap::new(characteristic), characteristic: MutJS::new(characteristic),
uuid: uuid, uuid: uuid,
value: DOMRefCell::new(None), value: DOMRefCell::new(None),
instance_id: instance_id, instance_id: instance_id,

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::error::Error::{self, Network, Security}; use dom::bindings::error::Error::{self, Network, Security};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{MutJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetooth::{AsyncBluetoothListener, response_async};
use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothdevice::BluetoothDevice;
@ -25,7 +25,7 @@ use std::rc::Rc;
#[dom_struct] #[dom_struct]
pub struct BluetoothRemoteGATTServer { pub struct BluetoothRemoteGATTServer {
reflector_: Reflector, reflector_: Reflector,
device: MutHeap<JS<BluetoothDevice>>, device: MutJS<BluetoothDevice>,
connected: Cell<bool>, connected: Cell<bool>,
} }
@ -33,7 +33,7 @@ impl BluetoothRemoteGATTServer {
pub fn new_inherited(device: &BluetoothDevice) -> BluetoothRemoteGATTServer { pub fn new_inherited(device: &BluetoothDevice) -> BluetoothRemoteGATTServer {
BluetoothRemoteGATTServer { BluetoothRemoteGATTServer {
reflector_: Reflector::new(), reflector_: Reflector::new(),
device: MutHeap::new(device), device: MutJS::new(device),
connected: Cell::new(false), connected: Cell::new(false),
} }
} }

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::error::Error::{self, Network, Security}; use dom::bindings::error::Error::{self, Network, Security};
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{MutJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetooth::{AsyncBluetoothListener, response_async};
@ -27,7 +27,7 @@ use std::rc::Rc;
#[dom_struct] #[dom_struct]
pub struct BluetoothRemoteGATTService { pub struct BluetoothRemoteGATTService {
eventtarget: EventTarget, eventtarget: EventTarget,
device: MutHeap<JS<BluetoothDevice>>, device: MutJS<BluetoothDevice>,
uuid: DOMString, uuid: DOMString,
is_primary: bool, is_primary: bool,
instance_id: String, instance_id: String,
@ -41,7 +41,7 @@ impl BluetoothRemoteGATTService {
-> BluetoothRemoteGATTService { -> BluetoothRemoteGATTService {
BluetoothRemoteGATTService { BluetoothRemoteGATTService {
eventtarget: EventTarget::new_inherited(), eventtarget: EventTarget::new_inherited(),
device: MutHeap::new(device), device: MutJS::new(device),
uuid: uuid, uuid: uuid,
is_primary: is_primary, is_primary: is_primary,
instance_id: instance_id, instance_id: instance_id,

View file

@ -4,7 +4,7 @@
use dom::bindings::conversions::{ToJSValConvertible, root_from_handleobject}; use dom::bindings::conversions::{ToJSValConvertible, root_from_handleobject};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{JS, MutNullableJS, Root, RootedReference};
use dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor}; use dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor};
use dom::bindings::reflector::{DomObject, MutDomObject, Reflector}; use dom::bindings::reflector::{DomObject, MutDomObject, Reflector};
use dom::bindings::trace::JSTraceable; use dom::bindings::trace::JSTraceable;
@ -43,7 +43,7 @@ pub struct BrowsingContext {
/// The current active document. /// The current active document.
/// Note that the session history is stored in the constellation, /// Note that the session history is stored in the constellation,
/// in the script thread we just track the current active document. /// in the script thread we just track the current active document.
active_document: MutNullableHeap<JS<Document>>, active_document: MutNullableJS<Document>,
/// The containing iframe element, if this is a same-origin iframe /// The containing iframe element, if this is a same-origin iframe
frame_element: Option<JS<Element>>, frame_element: Option<JS<Element>>,

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::ClientBinding::{ClientMethods, Wrap}; use dom::bindings::codegen::Bindings::ClientBinding::{ClientMethods, Wrap};
use dom::bindings::codegen::Bindings::ClientBinding::FrameType; use dom::bindings::codegen::Bindings::ClientBinding::FrameType;
use dom::bindings::js::{JS, Root, MutNullableHeap}; use dom::bindings::js::{Root, MutNullableJS};
use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::{DOMString, USVString}; use dom::bindings::str::{DOMString, USVString};
use dom::serviceworker::ServiceWorker; use dom::serviceworker::ServiceWorker;
@ -16,7 +16,7 @@ use uuid::Uuid;
#[dom_struct] #[dom_struct]
pub struct Client { pub struct Client {
reflector_: Reflector, reflector_: Reflector,
active_worker: MutNullableHeap<JS<ServiceWorker>>, active_worker: MutNullableJS<ServiceWorker>,
url: ServoUrl, url: ServoUrl,
frame_type: FrameType, frame_type: FrameType,
#[ignore_heap_size_of = "Defined in uuid"] #[ignore_heap_size_of = "Defined in uuid"]

View file

@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding;
use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMethods; use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMethods;
use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::{ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::cssrule::CSSRule; use dom::cssrule::CSSRule;
@ -22,7 +22,7 @@ pub struct CSSGroupingRule {
cssrule: CSSRule, cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"] #[ignore_heap_size_of = "Arc"]
rules: Arc<RwLock<StyleCssRules>>, rules: Arc<RwLock<StyleCssRules>>,
rulelist: MutNullableHeap<JS<CSSRuleList>>, rulelist: MutNullableJS<CSSRuleList>,
} }
impl CSSGroupingRule { impl CSSGroupingRule {
@ -31,7 +31,7 @@ impl CSSGroupingRule {
CSSGroupingRule { CSSGroupingRule {
cssrule: CSSRule::new_inherited(parent_stylesheet), cssrule: CSSRule::new_inherited(parent_stylesheet),
rules: rules, rules: rules,
rulelist: MutNullableHeap::new(None), rulelist: MutNullableJS::new(None),
} }
} }

View file

@ -6,7 +6,7 @@ use cssparser::Parser;
use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding; use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding;
use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleMethods; use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::csskeyframerule::CSSKeyframeRule; use dom::csskeyframerule::CSSKeyframeRule;
@ -26,7 +26,7 @@ pub struct CSSKeyframesRule {
cssrule: CSSRule, cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"] #[ignore_heap_size_of = "Arc"]
keyframesrule: Arc<RwLock<KeyframesRule>>, keyframesrule: Arc<RwLock<KeyframesRule>>,
rulelist: MutNullableHeap<JS<CSSRuleList>>, rulelist: MutNullableJS<CSSRuleList>,
} }
impl CSSKeyframesRule { impl CSSKeyframesRule {
@ -35,7 +35,7 @@ impl CSSKeyframesRule {
CSSKeyframesRule { CSSKeyframesRule {
cssrule: CSSRule::new_inherited(parent_stylesheet), cssrule: CSSRule::new_inherited(parent_stylesheet),
keyframesrule: keyframesrule, keyframesrule: keyframesrule,
rulelist: MutNullableHeap::new(None), rulelist: MutNullableJS::new(None),
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding;
use dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::cssgroupingrule::CSSGroupingRule; use dom::cssgroupingrule::CSSGroupingRule;
@ -22,7 +22,7 @@ pub struct CSSMediaRule {
cssrule: CSSGroupingRule, cssrule: CSSGroupingRule,
#[ignore_heap_size_of = "Arc"] #[ignore_heap_size_of = "Arc"]
mediarule: Arc<RwLock<MediaRule>>, mediarule: Arc<RwLock<MediaRule>>,
medialist: MutNullableHeap<JS<MediaList>>, medialist: MutNullableJS<MediaList>,
} }
impl CSSMediaRule { impl CSSMediaRule {
@ -32,7 +32,7 @@ impl CSSMediaRule {
CSSMediaRule { CSSMediaRule {
cssrule: CSSGroupingRule::new_inherited(parent_stylesheet, list), cssrule: CSSGroupingRule::new_inherited(parent_stylesheet, list),
mediarule: mediarule, mediarule: mediarule,
medialist: MutNullableHeap::new(None), medialist: MutNullableJS::new(None),
} }
} }

View file

@ -6,7 +6,7 @@ use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::CSSRuleListBinding; use dom::bindings::codegen::Bindings::CSSRuleListBinding;
use dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods; use dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::csskeyframerule::CSSKeyframeRule; use dom::csskeyframerule::CSSKeyframeRule;
use dom::cssrule::CSSRule; use dom::cssrule::CSSRule;
@ -38,7 +38,7 @@ pub struct CSSRuleList {
parent_stylesheet: JS<CSSStyleSheet>, parent_stylesheet: JS<CSSStyleSheet>,
#[ignore_heap_size_of = "Arc"] #[ignore_heap_size_of = "Arc"]
rules: RulesSource, rules: RulesSource,
dom_rules: DOMRefCell<Vec<MutNullableHeap<JS<CSSRule>>>> dom_rules: DOMRefCell<Vec<MutNullableJS<CSSRule>>>
} }
pub enum RulesSource { pub enum RulesSource {
@ -51,10 +51,10 @@ impl CSSRuleList {
pub fn new_inherited(parent_stylesheet: &CSSStyleSheet, rules: RulesSource) -> CSSRuleList { pub fn new_inherited(parent_stylesheet: &CSSStyleSheet, rules: RulesSource) -> CSSRuleList {
let dom_rules = match rules { let dom_rules = match rules {
RulesSource::Rules(ref rules) => { RulesSource::Rules(ref rules) => {
rules.read().0.iter().map(|_| MutNullableHeap::new(None)).collect() rules.read().0.iter().map(|_| MutNullableJS::new(None)).collect()
} }
RulesSource::Keyframes(ref rules) => { RulesSource::Keyframes(ref rules) => {
rules.read().keyframes.iter().map(|_| MutNullableHeap::new(None)).collect() rules.read().keyframes.iter().map(|_| MutNullableJS::new(None)).collect()
} }
}; };
@ -92,7 +92,7 @@ impl CSSRuleList {
let parent_stylesheet = &*self.parent_stylesheet; let parent_stylesheet = &*self.parent_stylesheet;
let dom_rule = CSSRule::new_specific(&window, parent_stylesheet, new_rule); let dom_rule = CSSRule::new_specific(&window, parent_stylesheet, new_rule);
self.dom_rules.borrow_mut().insert(index, MutNullableHeap::new(Some(&*dom_rule))); self.dom_rules.borrow_mut().insert(index, MutNullableJS::new(Some(&*dom_rule)));
Ok((idx)) Ok((idx))
} }
@ -158,7 +158,7 @@ impl CSSRuleList {
if let RulesSource::Rules(..) = self.rules { if let RulesSource::Rules(..) = self.rules {
panic!("Can only call append_lazy_rule with keyframes-backed CSSRules"); panic!("Can only call append_lazy_rule with keyframes-backed CSSRules");
} }
self.dom_rules.borrow_mut().push(MutNullableHeap::new(None)); self.dom_rules.borrow_mut().push(MutNullableJS::new(None));
} }
} }

View file

@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::CSSStyleSheetBinding;
use dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods; use dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::{ErrorResult, Fallible};
use dom::bindings::js::{JS, Root, MutNullableHeap}; use dom::bindings::js::{JS, MutNullableJS, Root};
use dom::bindings::reflector::{reflect_dom_object, DomObject}; use dom::bindings::reflector::{reflect_dom_object, DomObject};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::cssrulelist::{CSSRuleList, RulesSource}; use dom::cssrulelist::{CSSRuleList, RulesSource};
@ -20,7 +20,7 @@ use style::stylesheets::Stylesheet as StyleStyleSheet;
pub struct CSSStyleSheet { pub struct CSSStyleSheet {
stylesheet: StyleSheet, stylesheet: StyleSheet,
owner: JS<Element>, owner: JS<Element>,
rulelist: MutNullableHeap<JS<CSSRuleList>>, rulelist: MutNullableJS<CSSRuleList>,
#[ignore_heap_size_of = "Arc"] #[ignore_heap_size_of = "Arc"]
style_stylesheet: Arc<StyleStyleSheet>, style_stylesheet: Arc<StyleStyleSheet>,
} }
@ -34,7 +34,7 @@ impl CSSStyleSheet {
CSSStyleSheet { CSSStyleSheet {
stylesheet: StyleSheet::new_inherited(type_, href, title), stylesheet: StyleSheet::new_inherited(type_, href, title),
owner: JS::from_ref(owner), owner: JS::from_ref(owner),
rulelist: MutNullableHeap::new(None), rulelist: MutNullableJS::new(None),
style_stylesheet: stylesheet, style_stylesheet: stylesheet,
} }
} }

View file

@ -24,7 +24,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::{FrameRequestCallback, Scro
use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::codegen::UnionTypes::NodeOrString;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root}; use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root};
use dom::bindings::js::RootedReference; use dom::bindings::js::RootedReference;
use dom::bindings::num::Finite; use dom::bindings::num::Finite;
use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::refcounted::{Trusted, TrustedPromise};
@ -184,8 +184,8 @@ pub struct Document {
window: JS<Window>, window: JS<Window>,
/// https://html.spec.whatwg.org/multipage/#concept-document-bc /// https://html.spec.whatwg.org/multipage/#concept-document-bc
browsing_context: Option<JS<BrowsingContext>>, browsing_context: Option<JS<BrowsingContext>>,
implementation: MutNullableHeap<JS<DOMImplementation>>, implementation: MutNullableJS<DOMImplementation>,
location: MutNullableHeap<JS<Location>>, location: MutNullableJS<Location>,
content_type: DOMString, content_type: DOMString,
last_modified: Option<String>, last_modified: Option<String>,
encoding: Cell<EncodingRef>, encoding: Cell<EncodingRef>,
@ -197,29 +197,29 @@ pub struct Document {
tag_map: DOMRefCell<HashMap<LocalName, JS<HTMLCollection>>>, tag_map: DOMRefCell<HashMap<LocalName, JS<HTMLCollection>>>,
tagns_map: DOMRefCell<HashMap<QualName, JS<HTMLCollection>>>, tagns_map: DOMRefCell<HashMap<QualName, JS<HTMLCollection>>>,
classes_map: DOMRefCell<HashMap<Vec<Atom>, JS<HTMLCollection>>>, classes_map: DOMRefCell<HashMap<Vec<Atom>, JS<HTMLCollection>>>,
images: MutNullableHeap<JS<HTMLCollection>>, images: MutNullableJS<HTMLCollection>,
embeds: MutNullableHeap<JS<HTMLCollection>>, embeds: MutNullableJS<HTMLCollection>,
links: MutNullableHeap<JS<HTMLCollection>>, links: MutNullableJS<HTMLCollection>,
forms: MutNullableHeap<JS<HTMLCollection>>, forms: MutNullableJS<HTMLCollection>,
scripts: MutNullableHeap<JS<HTMLCollection>>, scripts: MutNullableJS<HTMLCollection>,
anchors: MutNullableHeap<JS<HTMLCollection>>, anchors: MutNullableJS<HTMLCollection>,
applets: MutNullableHeap<JS<HTMLCollection>>, applets: MutNullableJS<HTMLCollection>,
/// List of stylesheets associated with nodes in this document. |None| if the list needs to be refreshed. /// List of stylesheets associated with nodes in this document. |None| if the list needs to be refreshed.
stylesheets: DOMRefCell<Option<Vec<StylesheetInDocument>>>, stylesheets: DOMRefCell<Option<Vec<StylesheetInDocument>>>,
/// Whether the list of stylesheets has changed since the last reflow was triggered. /// Whether the list of stylesheets has changed since the last reflow was triggered.
stylesheets_changed_since_reflow: Cell<bool>, stylesheets_changed_since_reflow: Cell<bool>,
stylesheet_list: MutNullableHeap<JS<StyleSheetList>>, stylesheet_list: MutNullableJS<StyleSheetList>,
ready_state: Cell<DocumentReadyState>, ready_state: Cell<DocumentReadyState>,
/// Whether the DOMContentLoaded event has already been dispatched. /// Whether the DOMContentLoaded event has already been dispatched.
domcontentloaded_dispatched: Cell<bool>, domcontentloaded_dispatched: Cell<bool>,
/// The element that has most recently requested focus for itself. /// The element that has most recently requested focus for itself.
possibly_focused: MutNullableHeap<JS<Element>>, possibly_focused: MutNullableJS<Element>,
/// The element that currently has the document focus context. /// The element that currently has the document focus context.
focused: MutNullableHeap<JS<Element>>, focused: MutNullableJS<Element>,
/// The script element that is currently executing. /// The script element that is currently executing.
current_script: MutNullableHeap<JS<HTMLScriptElement>>, current_script: MutNullableJS<HTMLScriptElement>,
/// https://html.spec.whatwg.org/multipage/#pending-parsing-blocking-script /// https://html.spec.whatwg.org/multipage/#pending-parsing-blocking-script
pending_parsing_blocking_script: MutNullableHeap<JS<HTMLScriptElement>>, pending_parsing_blocking_script: MutNullableJS<HTMLScriptElement>,
/// Number of stylesheets that block executing the next parser-inserted script /// Number of stylesheets that block executing the next parser-inserted script
script_blocking_stylesheets_count: Cell<u32>, script_blocking_stylesheets_count: Cell<u32>,
/// https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing /// https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing
@ -245,14 +245,14 @@ pub struct Document {
/// Tracks all outstanding loads related to this document. /// Tracks all outstanding loads related to this document.
loader: DOMRefCell<DocumentLoader>, loader: DOMRefCell<DocumentLoader>,
/// The current active HTML parser, to allow resuming after interruptions. /// The current active HTML parser, to allow resuming after interruptions.
current_parser: MutNullableHeap<JS<ServoParser>>, current_parser: MutNullableJS<ServoParser>,
/// When we should kick off a reflow. This happens during parsing. /// When we should kick off a reflow. This happens during parsing.
reflow_timeout: Cell<Option<u64>>, reflow_timeout: Cell<Option<u64>>,
/// The cached first `base` element with an `href` attribute. /// The cached first `base` element with an `href` attribute.
base_element: MutNullableHeap<JS<HTMLBaseElement>>, base_element: MutNullableJS<HTMLBaseElement>,
/// This field is set to the document itself for inert documents. /// This field is set to the document itself for inert documents.
/// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document /// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document
appropriate_template_contents_owner_document: MutNullableHeap<JS<Document>>, appropriate_template_contents_owner_document: MutNullableJS<Document>,
/// Information on elements needing restyle to ship over to the layout thread when the /// Information on elements needing restyle to ship over to the layout thread when the
/// time comes. /// time comes.
pending_restyles: DOMRefCell<HashMap<JS<Element>, PendingRestyle>>, pending_restyles: DOMRefCell<HashMap<JS<Element>, PendingRestyle>>,
@ -280,7 +280,7 @@ pub struct Document {
/// https://html.spec.whatwg.org/multipage/#dom-document-referrer /// https://html.spec.whatwg.org/multipage/#dom-document-referrer
referrer: Option<String>, referrer: Option<String>,
/// https://html.spec.whatwg.org/multipage/#target-element /// https://html.spec.whatwg.org/multipage/#target-element
target_element: MutNullableHeap<JS<Element>>, target_element: MutNullableJS<Element>,
/// https://w3c.github.io/uievents/#event-type-dblclick /// https://w3c.github.io/uievents/#event-type-dblclick
#[ignore_heap_size_of = "Defined in std"] #[ignore_heap_size_of = "Defined in std"]
last_click_info: DOMRefCell<Option<(Instant, Point2D<f32>)>>, last_click_info: DOMRefCell<Option<(Instant, Point2D<f32>)>>,
@ -293,7 +293,7 @@ pub struct Document {
/// See also: https://github.com/servo/servo/issues/10110 /// See also: https://github.com/servo/servo/issues/10110
dom_count: Cell<u32>, dom_count: Cell<u32>,
/// Entry node for fullscreen. /// Entry node for fullscreen.
fullscreen_element: MutNullableHeap<JS<Element>>, fullscreen_element: MutNullableJS<Element>,
} }
#[derive(JSTraceable, HeapSizeOf)] #[derive(JSTraceable, HeapSizeOf)]
@ -1036,7 +1036,7 @@ impl Document {
pub fn handle_mouse_move_event(&self, pub fn handle_mouse_move_event(&self,
js_runtime: *mut JSRuntime, js_runtime: *mut JSRuntime,
client_point: Option<Point2D<f32>>, client_point: Option<Point2D<f32>>,
prev_mouse_over_target: &MutNullableHeap<JS<Element>>) { prev_mouse_over_target: &MutNullableJS<Element>) {
let client_point = match client_point { let client_point = match client_point {
None => { None => {
// If there's no point, there's no target under the mouse // If there's no point, there's no target under the mouse
@ -1521,8 +1521,11 @@ impl Document {
/// https://html.spec.whatwg.org/multipage/#run-the-animation-frame-callbacks /// https://html.spec.whatwg.org/multipage/#run-the-animation-frame-callbacks
pub fn run_the_animation_frame_callbacks(&self) { pub fn run_the_animation_frame_callbacks(&self) {
let mut animation_frame_list = rooted_vec!(let mut animation_frame_list);
mem::replace(&mut *self.animation_frame_list.borrow_mut(), vec![]); mem::swap(
&mut *animation_frame_list,
&mut *self.animation_frame_list.borrow_mut());
self.running_animation_callbacks.set(true); self.running_animation_callbacks.set(true);
let timing = self.window.Performance().Now(); let timing = self.window.Performance().Now();
@ -1538,7 +1541,7 @@ impl Document {
// message quickly followed by an AnimationCallbacksPresent message. // message quickly followed by an AnimationCallbacksPresent message.
if self.animation_frame_list.borrow().is_empty() { if self.animation_frame_list.borrow().is_empty() {
mem::swap(&mut *self.animation_frame_list.borrow_mut(), mem::swap(&mut *self.animation_frame_list.borrow_mut(),
&mut animation_frame_list); &mut *animation_frame_list);
let global_scope = self.window.upcast::<GlobalScope>(); let global_scope = self.window.upcast::<GlobalScope>();
let event = ConstellationMsg::ChangeRunningAnimationsState(global_scope.pipeline_id(), let event = ConstellationMsg::ChangeRunningAnimationsState(global_scope.pipeline_id(),
AnimationState::NoAnimationCallbacksPresent); AnimationState::NoAnimationCallbacksPresent);
@ -1872,7 +1875,7 @@ impl Document {
applets: Default::default(), applets: Default::default(),
stylesheets: DOMRefCell::new(None), stylesheets: DOMRefCell::new(None),
stylesheets_changed_since_reflow: Cell::new(false), stylesheets_changed_since_reflow: Cell::new(false),
stylesheet_list: MutNullableHeap::new(None), stylesheet_list: MutNullableJS::new(None),
ready_state: Cell::new(ready_state), ready_state: Cell::new(ready_state),
domcontentloaded_dispatched: Cell::new(domcontentloaded_dispatched), domcontentloaded_dispatched: Cell::new(domcontentloaded_dispatched),
possibly_focused: Default::default(), possibly_focused: Default::default(),
@ -1907,11 +1910,11 @@ impl Document {
origin: origin, origin: origin,
referrer: referrer, referrer: referrer,
referrer_policy: Cell::new(referrer_policy), referrer_policy: Cell::new(referrer_policy),
target_element: MutNullableHeap::new(None), target_element: MutNullableJS::new(None),
last_click_info: DOMRefCell::new(None), last_click_info: DOMRefCell::new(None),
ignore_destructive_writes_counter: Default::default(), ignore_destructive_writes_counter: Default::default(),
dom_count: Cell::new(1), dom_count: Cell::new(1),
fullscreen_element: MutNullableHeap::new(None), fullscreen_element: MutNullableJS::new(None),
} }
} }

View file

@ -22,7 +22,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::codegen::UnionTypes::NodeOrString;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap}; use dom::bindings::js::{JS, LayoutJS, MutNullableJS};
use dom::bindings::js::{Root, RootedReference}; use dom::bindings::js::{Root, RootedReference};
use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::refcounted::{Trusted, TrustedPromise};
use dom::bindings::reflector::DomObject; use dom::bindings::reflector::DomObject;
@ -125,8 +125,8 @@ pub struct Element {
id_attribute: DOMRefCell<Option<Atom>>, id_attribute: DOMRefCell<Option<Atom>>,
#[ignore_heap_size_of = "Arc"] #[ignore_heap_size_of = "Arc"]
style_attribute: DOMRefCell<Option<Arc<RwLock<PropertyDeclarationBlock>>>>, style_attribute: DOMRefCell<Option<Arc<RwLock<PropertyDeclarationBlock>>>>,
attr_list: MutNullableHeap<JS<NamedNodeMap>>, attr_list: MutNullableJS<NamedNodeMap>,
class_list: MutNullableHeap<JS<DOMTokenList>>, class_list: MutNullableJS<DOMTokenList>,
state: Cell<ElementState>, state: Cell<ElementState>,
atomic_flags: AtomicElementFlags, atomic_flags: AtomicElementFlags,
} }

View file

@ -6,7 +6,7 @@ use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::EventBinding; use dom::bindings::codegen::Bindings::EventBinding;
use dom::bindings::codegen::Bindings::EventBinding::{EventConstants, EventMethods}; use dom::bindings::codegen::Bindings::EventBinding::{EventConstants, EventMethods};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
@ -80,8 +80,8 @@ impl From<bool> for EventCancelable {
#[dom_struct] #[dom_struct]
pub struct Event { pub struct Event {
reflector_: Reflector, reflector_: Reflector,
current_target: MutNullableHeap<JS<EventTarget>>, current_target: MutNullableJS<EventTarget>,
target: MutNullableHeap<JS<EventTarget>>, target: MutNullableJS<EventTarget>,
type_: DOMRefCell<Atom>, type_: DOMRefCell<Atom>,
phase: Cell<EventPhase>, phase: Cell<EventPhase>,
canceled: Cell<bool>, canceled: Cell<bool>,

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::FileReaderBinding::{self, FileReaderConsta
use dom::bindings::codegen::UnionTypes::StringOrObject; use dom::bindings::codegen::UnionTypes::StringOrObject;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
@ -86,7 +86,7 @@ pub enum FileReaderResult {
pub struct FileReader { pub struct FileReader {
eventtarget: EventTarget, eventtarget: EventTarget,
ready_state: Cell<FileReaderReadyState>, ready_state: Cell<FileReaderReadyState>,
error: MutNullableHeap<JS<DOMException>>, error: MutNullableJS<DOMException>,
result: DOMRefCell<Option<FileReaderResult>>, result: DOMRefCell<Option<FileReaderResult>>,
generation_id: Cell<GenerationId>, generation_id: Cell<GenerationId>,
} }
@ -96,7 +96,7 @@ impl FileReader {
FileReader { FileReader {
eventtarget: EventTarget::new_inherited(), eventtarget: EventTarget::new_inherited(),
ready_state: Cell::new(FileReaderReadyState::Empty), ready_state: Cell::new(FileReaderReadyState::Empty),
error: MutNullableHeap::new(None), error: MutNullableJS::new(None),
result: DOMRefCell::new(None), result: DOMRefCell::new(None),
generation_id: Cell::new(GenerationId(0)), generation_id: Cell::new(GenerationId(0)),
} }

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::FocusEventBinding::FocusEventMethods;
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::reflector::reflect_dom_object; use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::event::{EventBubbles, EventCancelable}; use dom::event::{EventBubbles, EventCancelable};
@ -20,7 +20,7 @@ use std::default::Default;
#[dom_struct] #[dom_struct]
pub struct FocusEvent { pub struct FocusEvent {
uievent: UIEvent, uievent: UIEvent,
related_target: MutNullableHeap<JS<EventTarget>>, related_target: MutNullableJS<EventTarget>,
} }
impl FocusEvent { impl FocusEvent {

View file

@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::conversions::root_from_object; use dom::bindings::conversions::root_from_object;
use dom::bindings::error::{ErrorInfo, report_pending_exception}; use dom::bindings::error::{ErrorInfo, report_pending_exception};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::DomObject; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::crypto::Crypto; use dom::crypto::Crypto;
@ -50,7 +50,7 @@ use timers::{OneshotTimers, TimerCallback};
#[dom_struct] #[dom_struct]
pub struct GlobalScope { pub struct GlobalScope {
eventtarget: EventTarget, eventtarget: EventTarget,
crypto: MutNullableHeap<JS<Crypto>>, crypto: MutNullableJS<Crypto>,
next_worker_id: Cell<WorkerId>, next_worker_id: Cell<WorkerId>,
/// Pipeline id associated with this global. /// Pipeline id associated with this global.

View file

@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::HTMLAnchorElementBinding::HTMLAnchorElemen
use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::str::{DOMString, USVString}; use dom::bindings::str::{DOMString, USVString};
use dom::document::Document; use dom::document::Document;
use dom::domtokenlist::DOMTokenList; use dom::domtokenlist::DOMTokenList;
@ -36,7 +36,7 @@ use util::prefs::PREFS;
#[dom_struct] #[dom_struct]
pub struct HTMLAnchorElement { pub struct HTMLAnchorElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
rel_list: MutNullableHeap<JS<DOMTokenList>>, rel_list: MutNullableJS<DOMTokenList>,
url: DOMRefCell<Option<ServoUrl>>, url: DOMRefCell<Option<ServoUrl>>,
} }

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::HTMLAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLAreaElementBinding;
use dom::bindings::codegen::Bindings::HTMLAreaElementBinding::HTMLAreaElementMethods; use dom::bindings::codegen::Bindings::HTMLAreaElementBinding::HTMLAreaElementMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::document::Document; use dom::document::Document;
use dom::domtokenlist::DOMTokenList; use dom::domtokenlist::DOMTokenList;
@ -19,7 +19,7 @@ use style::attr::AttrValue;
#[dom_struct] #[dom_struct]
pub struct HTMLAreaElement { pub struct HTMLAreaElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
rel_list: MutNullableHeap<JS<DOMTokenList>>, rel_list: MutNullableJS<DOMTokenList>,
} }
impl HTMLAreaElement { impl HTMLAreaElement {

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::UnionTypes::CanvasRenderingContext2DOrWebGLRendering
use dom::bindings::conversions::ConversionResult; use dom::bindings::conversions::ConversionResult;
use dom::bindings::error::{Error, Fallible}; use dom::bindings::error::{Error, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{HeapGCValue, JS, LayoutJS, Root}; use dom::bindings::js::{JS, LayoutJS, Root};
use dom::bindings::num::Finite; use dom::bindings::num::Finite;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::canvasrenderingcontext2d::{CanvasRenderingContext2D, LayoutCanvasRenderingContext2DHelpers}; use dom::canvasrenderingcontext2d::{CanvasRenderingContext2D, LayoutCanvasRenderingContext2DHelpers};
@ -47,8 +47,6 @@ pub enum CanvasContext {
WebGL(JS<WebGLRenderingContext>), WebGL(JS<WebGLRenderingContext>),
} }
impl HeapGCValue for CanvasContext {}
#[dom_struct] #[dom_struct]
pub struct HTMLCanvasElement { pub struct HTMLCanvasElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::HTMLCollectionBinding; use dom::bindings::codegen::Bindings::HTMLCollectionBinding;
use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods; use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, Root, MutNullableHeap}; use dom::bindings::js::{JS, Root, MutNullableJS};
use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bindings::trace::JSTraceable; use dom::bindings::trace::JSTraceable;
@ -59,7 +59,7 @@ pub struct HTMLCollection {
// the length of the collection, and a cursor into the collection. // the length of the collection, and a cursor into the collection.
// FIXME: make the cached cursor element a weak pointer // FIXME: make the cached cursor element a weak pointer
cached_version: Cell<u64>, cached_version: Cell<u64>,
cached_cursor_element: MutNullableHeap<JS<Element>>, cached_cursor_element: MutNullableJS<Element>,
cached_cursor_index: Cell<OptionU32>, cached_cursor_index: Cell<OptionU32>,
cached_length: Cell<OptionU32>, cached_length: Cell<OptionU32>,
} }
@ -73,7 +73,7 @@ impl HTMLCollection {
filter: filter, filter: filter,
// Default values for the cache // Default values for the cache
cached_version: Cell::new(root.inclusive_descendants_version()), cached_version: Cell::new(root.inclusive_descendants_version()),
cached_cursor_element: MutNullableHeap::new(None), cached_cursor_element: MutNullableJS::new(None),
cached_cursor_index: Cell::new(OptionU32::none()), cached_cursor_index: Cell::new(OptionU32::none()),
cached_length: Cell::new(OptionU32::none()), cached_length: Cell::new(OptionU32::none()),
} }

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::error::{Error, ErrorResult};
use dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration}; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration};
use dom::document::{Document, FocusType}; use dom::document::{Document, FocusType};
@ -40,8 +40,8 @@ use style::element_state::*;
#[dom_struct] #[dom_struct]
pub struct HTMLElement { pub struct HTMLElement {
element: Element, element: Element,
style_decl: MutNullableHeap<JS<CSSStyleDeclaration>>, style_decl: MutNullableJS<CSSStyleDeclaration>,
dataset: MutNullableHeap<JS<DOMStringMap>>, dataset: MutNullableJS<DOMStringMap>,
} }
impl HTMLElement { impl HTMLElement {

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementM
use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods;
use dom::bindings::conversions::DerivedFrom; use dom::bindings::conversions::DerivedFrom;
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
@ -61,7 +61,7 @@ pub struct GenerationId(u32);
pub struct HTMLFormElement { pub struct HTMLFormElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
marked_for_reset: Cell<bool>, marked_for_reset: Cell<bool>,
elements: MutNullableHeap<JS<HTMLFormControlsCollection>>, elements: MutNullableJS<HTMLFormControlsCollection>,
generation_id: Cell<GenerationId> generation_id: Cell<GenerationId>
} }

View file

@ -19,7 +19,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethod
use dom::bindings::conversions::ToJSValConvertible; use dom::bindings::conversions::ToJSValConvertible;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root}; use dom::bindings::js::{LayoutJS, MutNullableJS, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
@ -80,7 +80,7 @@ pub struct HTMLIFrameElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
frame_id: FrameId, frame_id: FrameId,
pipeline_id: Cell<Option<PipelineId>>, pipeline_id: Cell<Option<PipelineId>>,
sandbox: MutNullableHeap<JS<DOMTokenList>>, sandbox: MutNullableJS<DOMTokenList>,
sandbox_allowance: Cell<Option<SandboxAllowance>>, sandbox_allowance: Cell<Option<SandboxAllowance>>,
load_blocker: DOMRefCell<Option<LoadBlocker>>, load_blocker: DOMRefCell<Option<LoadBlocker>>,
visibility: Cell<bool>, visibility: Cell<bool>,

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementM
use dom::bindings::codegen::Bindings::KeyboardEventBinding::KeyboardEventMethods; use dom::bindings::codegen::Bindings::KeyboardEventBinding::KeyboardEventMethods;
use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::error::{Error, ErrorResult};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root, RootedReference};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, Element, LayoutElementHelpers, RawLayoutElementHelpers}; use dom::element::{AttributeMutation, Element, LayoutElementHelpers, RawLayoutElementHelpers};
@ -94,7 +94,7 @@ pub struct HTMLInputElement {
// https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag // https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag
value_dirty: Cell<bool>, value_dirty: Cell<bool>,
filelist: MutNullableHeap<JS<FileList>>, filelist: MutNullableJS<FileList>,
} }
#[derive(JSTraceable)] #[derive(JSTraceable)]
@ -150,7 +150,7 @@ impl HTMLInputElement {
SelectionDirection::None)), SelectionDirection::None)),
activation_state: DOMRefCell::new(InputActivationState::new()), activation_state: DOMRefCell::new(InputActivationState::new()),
value_dirty: Cell::new(false), value_dirty: Cell::new(false),
filelist: MutNullableHeap::new(None), filelist: MutNullableJS::new(None),
} }
} }

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods;
use dom::bindings::codegen::Bindings::HTMLLinkElementBinding; use dom::bindings::codegen::Bindings::HTMLLinkElementBinding;
use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods; use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
@ -55,10 +55,10 @@ unsafe_no_jsmanaged_fields!(Stylesheet);
#[dom_struct] #[dom_struct]
pub struct HTMLLinkElement { pub struct HTMLLinkElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
rel_list: MutNullableHeap<JS<DOMTokenList>>, rel_list: MutNullableJS<DOMTokenList>,
#[ignore_heap_size_of = "Arc"] #[ignore_heap_size_of = "Arc"]
stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>, stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>,
cssom_stylesheet: MutNullableHeap<JS<CSSStyleSheet>>, cssom_stylesheet: MutNullableJS<CSSStyleSheet>,
/// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts /// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts
parser_inserted: Cell<bool>, parser_inserted: Cell<bool>,
@ -72,7 +72,7 @@ impl HTMLLinkElement {
rel_list: Default::default(), rel_list: Default::default(),
parser_inserted: Cell::new(creator == ElementCreator::ParserCreated), parser_inserted: Cell::new(creator == ElementCreator::ParserCreated),
stylesheet: DOMRefCell::new(None), stylesheet: DOMRefCell::new(None),
cssom_stylesheet: MutNullableHeap::new(None), cssom_stylesheet: MutNullableJS::new(None),
} }
} }

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementM
use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorConstants::*; use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorConstants::*;
use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorMethods; use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{Root, MutNullableHeap, JS}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
@ -218,7 +218,7 @@ pub struct HTMLMediaElement {
current_src: DOMRefCell<String>, current_src: DOMRefCell<String>,
generation_id: Cell<u32>, generation_id: Cell<u32>,
first_data_load: Cell<bool>, first_data_load: Cell<bool>,
error: MutNullableHeap<JS<MediaError>>, error: MutNullableJS<MediaError>,
paused: Cell<bool>, paused: Cell<bool>,
autoplaying: Cell<bool>, autoplaying: Cell<bool>,
video: DOMRefCell<Option<VideoMedia>>, video: DOMRefCell<Option<VideoMedia>>,

View file

@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HTMLMetaElementBinding;
use dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods; use dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::document::Document; use dom::document::Document;
@ -32,7 +32,7 @@ pub struct HTMLMetaElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
#[ignore_heap_size_of = "Arc"] #[ignore_heap_size_of = "Arc"]
stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>, stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>,
cssom_stylesheet: MutNullableHeap<JS<CSSStyleSheet>>, cssom_stylesheet: MutNullableJS<CSSStyleSheet>,
} }
impl HTMLMetaElement { impl HTMLMetaElement {
@ -42,7 +42,7 @@ impl HTMLMetaElement {
HTMLMetaElement { HTMLMetaElement {
htmlelement: HTMLElement::new_inherited(local_name, prefix, document), htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
stylesheet: DOMRefCell::new(None), stylesheet: DOMRefCell::new(None),
cssom_stylesheet: MutNullableHeap::new(None), cssom_stylesheet: MutNullableJS::new(None),
} }
} }

View file

@ -14,7 +14,7 @@ use dom::bindings::codegen::UnionTypes::HTMLElementOrLong;
use dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement; use dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement;
//use dom::bindings::error::ErrorResult; //use dom::bindings::error::ErrorResult;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, Element}; use dom::element::{AttributeMutation, Element};
@ -58,7 +58,7 @@ impl CollectionFilter for OptionsFilter {
#[dom_struct] #[dom_struct]
pub struct HTMLSelectElement { pub struct HTMLSelectElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
options: MutNullableHeap<JS<HTMLOptionsCollection>>, options: MutNullableJS<HTMLOptionsCollection>,
} }
static DEFAULT_SELECT_SIZE: u32 = 0; static DEFAULT_SELECT_SIZE: u32 = 0;

View file

@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HTMLStyleElementBinding;
use dom::bindings::codegen::Bindings::HTMLStyleElementBinding::HTMLStyleElementMethods; use dom::bindings::codegen::Bindings::HTMLStyleElementBinding::HTMLStyleElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::document::Document; use dom::document::Document;
@ -29,7 +29,7 @@ pub struct HTMLStyleElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
#[ignore_heap_size_of = "Arc"] #[ignore_heap_size_of = "Arc"]
stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>, stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>,
cssom_stylesheet: MutNullableHeap<JS<CSSStyleSheet>>, cssom_stylesheet: MutNullableJS<CSSStyleSheet>,
} }
impl HTMLStyleElement { impl HTMLStyleElement {
@ -39,7 +39,7 @@ impl HTMLStyleElement {
HTMLStyleElement { HTMLStyleElement {
htmlelement: HTMLElement::new_inherited(local_name, prefix, document), htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
stylesheet: DOMRefCell::new(None), stylesheet: DOMRefCell::new(None),
cssom_stylesheet: MutNullableHeap::new(None), cssom_stylesheet: MutNullableJS::new(None),
} }
} }

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementM
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root, RootedReference};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
@ -31,7 +31,7 @@ pub struct HTMLTableElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
border: Cell<Option<u32>>, border: Cell<Option<u32>>,
cellspacing: Cell<Option<u32>>, cellspacing: Cell<Option<u32>>,
tbodies: MutNullableHeap<JS<HTMLCollection>>, tbodies: MutNullableJS<HTMLCollection>,
} }
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableS
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::{ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{LayoutJS, MutNullableJS, Root, RootedReference};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::document::Document; use dom::document::Document;
use dom::element::{Element, RawLayoutElementHelpers}; use dom::element::{Element, RawLayoutElementHelpers};
@ -36,7 +36,7 @@ impl CollectionFilter for CellsFilter {
#[dom_struct] #[dom_struct]
pub struct HTMLTableRowElement { pub struct HTMLTableRowElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
cells: MutNullableHeap<JS<HTMLCollection>>, cells: MutNullableJS<HTMLCollection>,
} }
impl HTMLTableRowElement { impl HTMLTableRowElement {

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding;
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::document::Document; use dom::document::Document;
use dom::documentfragment::DocumentFragment; use dom::documentfragment::DocumentFragment;
@ -21,7 +21,7 @@ pub struct HTMLTemplateElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
/// https://html.spec.whatwg.org/multipage/#template-contents /// https://html.spec.whatwg.org/multipage/#template-contents
contents: MutNullableHeap<JS<DocumentFragment>>, contents: MutNullableJS<DocumentFragment>,
} }
impl HTMLTemplateElement { impl HTMLTemplateElement {
@ -31,7 +31,7 @@ impl HTMLTemplateElement {
HTMLTemplateElement { HTMLTemplateElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(local_name, prefix, document), HTMLElement::new_inherited(local_name, prefix, document),
contents: MutNullableHeap::new(None), contents: MutNullableJS::new(None),
} }
} }

View file

@ -537,14 +537,15 @@ macro_rules! document_and_element_event_handlers(
#[macro_export] #[macro_export]
macro_rules! rooted_vec { macro_rules! rooted_vec {
(let mut $name:ident) => { (let mut $name:ident) => {
rooted_vec!(let mut $name <- ::std::iter::empty()) let mut root = $crate::dom::bindings::trace::RootableVec::new_unrooted();
let mut $name = $crate::dom::bindings::trace::RootedVec::new(&mut root);
}; };
(let $name:ident <- $iter:expr) => { (let $name:ident <- $iter:expr) => {
let mut __root = $crate::dom::bindings::trace::RootableVec::new_unrooted(); let mut root = $crate::dom::bindings::trace::RootableVec::new_unrooted();
let $name = $crate::dom::bindings::trace::RootedVec::new(&mut __root, $iter); let $name = $crate::dom::bindings::trace::RootedVec::from_iter(&mut root, $iter);
}; };
(let mut $name:ident <- $iter:expr) => { (let mut $name:ident <- $iter:expr) => {
let mut __root = $crate::dom::bindings::trace::RootableVec::new_unrooted(); let mut root = $crate::dom::bindings::trace::RootableVec::new_unrooted();
let mut $name = $crate::dom::bindings::trace::RootedVec::new(&mut __root, $iter); let mut $name = $crate::dom::bindings::trace::RootedVec::from_iter(&mut root, $iter);
} }
} }

View file

@ -32,8 +32,8 @@
//! * rooting pointers on the stack: //! * rooting pointers on the stack:
//! the [`Root`](bindings/js/struct.Root.html) smart pointer; //! the [`Root`](bindings/js/struct.Root.html) smart pointer;
//! * tracing pointers in member fields: the [`JS`](bindings/js/struct.JS.html), //! * tracing pointers in member fields: the [`JS`](bindings/js/struct.JS.html),
//! [`MutNullableHeap`](bindings/js/struct.MutNullableHeap.html) and //! [`MutNullableJS`](bindings/js/struct.MutNullableJS.html) and
//! [`MutHeap`](bindings/js/struct.MutHeap.html) smart pointers and //! [`MutJS`](bindings/js/struct.MutJS.html) smart pointers and
//! [the tracing implementation](bindings/trace/index.html); //! [the tracing implementation](bindings/trace/index.html);
//! * rooting pointers from across thread boundaries or in channels: the //! * rooting pointers from across thread boundaries or in channels: the
//! [`Trusted`](bindings/refcounted/struct.Trusted.html) smart pointer; //! [`Trusted`](bindings/refcounted/struct.Trusted.html) smart pointer;

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods;
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::reflector::reflect_dom_object; use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable}; use dom::event::{Event, EventBubbles, EventCancelable};
@ -30,7 +30,7 @@ pub struct MouseEvent {
alt_key: Cell<bool>, alt_key: Cell<bool>,
meta_key: Cell<bool>, meta_key: Cell<bool>,
button: Cell<i16>, button: Cell<i16>,
related_target: MutNullableHeap<JS<EventTarget>>, related_target: MutNullableJS<EventTarget>,
} }
impl MouseEvent { impl MouseEvent {

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::NavigatorBinding; use dom::bindings::codegen::Bindings::NavigatorBinding;
use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods; use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{Reflector, DomObject, reflect_dom_object}; use dom::bindings::reflector::{Reflector, DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bluetooth::Bluetooth; use dom::bluetooth::Bluetooth;
@ -17,10 +17,10 @@ use dom::window::Window;
#[dom_struct] #[dom_struct]
pub struct Navigator { pub struct Navigator {
reflector_: Reflector, reflector_: Reflector,
bluetooth: MutNullableHeap<JS<Bluetooth>>, bluetooth: MutNullableJS<Bluetooth>,
plugins: MutNullableHeap<JS<PluginArray>>, plugins: MutNullableJS<PluginArray>,
mime_types: MutNullableHeap<JS<MimeTypeArray>>, mime_types: MutNullableJS<MimeTypeArray>,
service_worker: MutNullableHeap<JS<ServiceWorkerContainer>>, service_worker: MutNullableJS<ServiceWorkerContainer>,
} }
impl Navigator { impl Navigator {

View file

@ -21,7 +21,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::{Castable, CharacterDataTypeId, ElementTypeId}; use dom::bindings::inheritance::{Castable, CharacterDataTypeId, ElementTypeId};
use dom::bindings::inheritance::{EventTargetTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::{EventTargetTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::inheritance::{SVGElementTypeId, SVGGraphicsElementTypeId}; use dom::bindings::inheritance::{SVGElementTypeId, SVGGraphicsElementTypeId};
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap}; use dom::bindings::js::{JS, LayoutJS, MutNullableJS};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::js::RootedReference; use dom::bindings::js::RootedReference;
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
@ -95,25 +95,25 @@ pub struct Node {
eventtarget: EventTarget, eventtarget: EventTarget,
/// The parent of this node. /// The parent of this node.
parent_node: MutNullableHeap<JS<Node>>, parent_node: MutNullableJS<Node>,
/// The first child of this node. /// The first child of this node.
first_child: MutNullableHeap<JS<Node>>, first_child: MutNullableJS<Node>,
/// The last child of this node. /// The last child of this node.
last_child: MutNullableHeap<JS<Node>>, last_child: MutNullableJS<Node>,
/// The next sibling of this node. /// The next sibling of this node.
next_sibling: MutNullableHeap<JS<Node>>, next_sibling: MutNullableJS<Node>,
/// The previous sibling of this node. /// The previous sibling of this node.
prev_sibling: MutNullableHeap<JS<Node>>, prev_sibling: MutNullableJS<Node>,
/// The document that this node belongs to. /// The document that this node belongs to.
owner_doc: MutNullableHeap<JS<Document>>, owner_doc: MutNullableJS<Document>,
/// The live list of children return by .childNodes. /// The live list of children return by .childNodes.
child_list: MutNullableHeap<JS<NodeList>>, child_list: MutNullableJS<NodeList>,
/// The live count of children of this node. /// The live count of children of this node.
children_count: Cell<u32>, children_count: Cell<u32>,
@ -1370,7 +1370,7 @@ impl Node {
last_child: Default::default(), last_child: Default::default(),
next_sibling: Default::default(), next_sibling: Default::default(),
prev_sibling: Default::default(), prev_sibling: Default::default(),
owner_doc: MutNullableHeap::new(doc), owner_doc: MutNullableJS::new(doc),
child_list: Default::default(), child_list: Default::default(),
children_count: Cell::new(0u32), children_count: Cell::new(0u32),
flags: Cell::new(flags), flags: Cell::new(flags),

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilterConstants;
use dom::bindings::codegen::Bindings::NodeIteratorBinding; use dom::bindings::codegen::Bindings::NodeIteratorBinding;
use dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods; use dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{JS, MutJS, Root};
use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::document::Document; use dom::document::Document;
use dom::node::Node; use dom::node::Node;
@ -21,7 +21,7 @@ pub struct NodeIterator {
reflector_: Reflector, reflector_: Reflector,
root_node: JS<Node>, root_node: JS<Node>,
#[ignore_heap_size_of = "Defined in rust-mozjs"] #[ignore_heap_size_of = "Defined in rust-mozjs"]
reference_node: MutHeap<JS<Node>>, reference_node: MutJS<Node>,
pointer_before_reference_node: Cell<bool>, pointer_before_reference_node: Cell<bool>,
what_to_show: u32, what_to_show: u32,
#[ignore_heap_size_of = "Can't measure due to #6870"] #[ignore_heap_size_of = "Can't measure due to #6870"]
@ -35,7 +35,7 @@ impl NodeIterator {
NodeIterator { NodeIterator {
reflector_: Reflector::new(), reflector_: Reflector::new(),
root_node: JS::from_ref(root_node), root_node: JS::from_ref(root_node),
reference_node: MutHeap::new(root_node), reference_node: MutJS::new(root_node),
pointer_before_reference_node: Cell::new(true), pointer_before_reference_node: Cell::new(true),
what_to_show: what_to_show, what_to_show: what_to_show,
filter: filter filter: filter

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::Bindings::NodeListBinding; use dom::bindings::codegen::Bindings::NodeListBinding;
use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{JS, MutNullableJS, Root, RootedReference};
use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::node::{ChildrenMutation, Node}; use dom::node::{ChildrenMutation, Node};
use dom::window::Window; use dom::window::Window;
@ -111,7 +111,7 @@ impl NodeList {
pub struct ChildrenList { pub struct ChildrenList {
node: JS<Node>, node: JS<Node>,
#[ignore_heap_size_of = "Defined in rust-mozjs"] #[ignore_heap_size_of = "Defined in rust-mozjs"]
last_visited: MutNullableHeap<JS<Node>>, last_visited: MutNullableJS<Node>,
last_index: Cell<u32>, last_index: Cell<u32>,
} }
@ -120,7 +120,7 @@ impl ChildrenList {
let last_visited = node.GetFirstChild(); let last_visited = node.GetFirstChild();
ChildrenList { ChildrenList {
node: JS::from_ref(node), node: JS::from_ref(node),
last_visited: MutNullableHeap::new(last_visited.r()), last_visited: MutNullableJS::new(last_visited.r()),
last_index: Cell::new(0u32), last_index: Cell::new(0u32),
} }
} }

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId}; use dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutHeap, Root, RootedReference}; use dom::bindings::js::{JS, MutJS, Root, RootedReference};
use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bindings::trace::JSTraceable; use dom::bindings::trace::JSTraceable;
@ -934,7 +934,7 @@ impl RangeMethods for Range {
#[privatize] #[privatize]
#[derive(HeapSizeOf)] #[derive(HeapSizeOf)]
pub struct BoundaryPoint { pub struct BoundaryPoint {
node: MutHeap<JS<Node>>, node: MutJS<Node>,
offset: Cell<u32>, offset: Cell<u32>,
} }
@ -943,7 +943,7 @@ impl BoundaryPoint {
debug_assert!(!node.is_doctype()); debug_assert!(!node.is_doctype());
debug_assert!(offset <= node.len()); debug_assert!(offset <= node.len());
BoundaryPoint { BoundaryPoint {
node: MutHeap::new(node), node: MutJS::new(node),
offset: Cell::new(offset), offset: Cell::new(offset),
} }
} }

View file

@ -17,7 +17,7 @@ use dom::bindings::codegen::Bindings::RequestBinding::RequestMode;
use dom::bindings::codegen::Bindings::RequestBinding::RequestRedirect; use dom::bindings::codegen::Bindings::RequestBinding::RequestRedirect;
use dom::bindings::codegen::Bindings::RequestBinding::RequestType; use dom::bindings::codegen::Bindings::RequestBinding::RequestType;
use dom::bindings::error::{Error, Fallible}; use dom::bindings::error::{Error, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString, USVString}; use dom::bindings::str::{ByteString, DOMString, USVString};
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
@ -45,7 +45,7 @@ pub struct Request {
reflector_: Reflector, reflector_: Reflector,
request: DOMRefCell<NetTraitsRequest>, request: DOMRefCell<NetTraitsRequest>,
body_used: Cell<bool>, body_used: Cell<bool>,
headers: MutNullableHeap<JS<Headers>>, headers: MutNullableJS<Headers>,
mime_type: DOMRefCell<Vec<u8>>, mime_type: DOMRefCell<Vec<u8>>,
#[ignore_heap_size_of = "Rc"] #[ignore_heap_size_of = "Rc"]
body_promise: DOMRefCell<Option<(Rc<Promise>, BodyType)>>, body_promise: DOMRefCell<Option<(Rc<Promise>, BodyType)>>,

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::ResponseBinding;
use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, ResponseType as DOMResponseType}; use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, ResponseType as DOMResponseType};
use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit; use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit;
use dom::bindings::error::{Error, Fallible}; use dom::bindings::error::{Error, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, USVString}; use dom::bindings::str::{ByteString, USVString};
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
@ -32,7 +32,7 @@ use url::Position;
#[dom_struct] #[dom_struct]
pub struct Response { pub struct Response {
reflector_: Reflector, reflector_: Reflector,
headers_reflector: MutNullableHeap<JS<Headers>>, headers_reflector: MutNullableJS<Headers>,
mime_type: DOMRefCell<Vec<u8>>, mime_type: DOMRefCell<Vec<u8>>,
body_used: Cell<bool>, body_used: Cell<bool>,
/// `None` can be considered a StatusCode of `0`. /// `None` can be considered a StatusCode of `0`.

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ServiceWorkerContainerMethods, Wrap}; use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ServiceWorkerContainerMethods, Wrap};
use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions; use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions;
use dom::bindings::error::Error; use dom::bindings::error::Error;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::USVString; use dom::bindings::str::USVString;
use dom::client::Client; use dom::client::Client;
@ -22,7 +22,7 @@ use std::rc::Rc;
#[dom_struct] #[dom_struct]
pub struct ServiceWorkerContainer { pub struct ServiceWorkerContainer {
eventtarget: EventTarget, eventtarget: EventTarget,
controller: MutNullableHeap<JS<ServiceWorker>>, controller: MutNullableJS<ServiceWorker>,
client: JS<Client> client: JS<Client>
} }

View file

@ -6,7 +6,7 @@
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableJS, Root};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bindings::trace::JSTraceable; use dom::bindings::trace::JSTraceable;
use dom::comment::Comment; use dom::comment::Comment;
@ -97,7 +97,7 @@ unsafe impl JSTraceable for XmlTokenizer<XmlTreeBuilder<JS<Node>, Sink>> {
struct Sink { struct Sink {
base_url: ServoUrl, base_url: ServoUrl,
document: JS<Document>, document: JS<Document>,
script: MutNullableHeap<JS<HTMLScriptElement>>, script: MutNullableJS<HTMLScriptElement>,
} }
impl<'a> TreeSink for Sink { impl<'a> TreeSink for Sink {

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::StorageEventBinding;
use dom::bindings::codegen::Bindings::StorageEventBinding::StorageEventMethods; use dom::bindings::codegen::Bindings::StorageEventBinding::StorageEventMethods;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::reflector::reflect_dom_object; use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable}; use dom::event::{Event, EventBubbles, EventCancelable};
@ -23,7 +23,7 @@ pub struct StorageEvent {
old_value: Option<DOMString>, old_value: Option<DOMString>,
new_value: Option<DOMString>, new_value: Option<DOMString>,
url: DOMString, url: DOMString,
storage_area: MutNullableHeap<JS<Storage>> storage_area: MutNullableJS<Storage>
} }
@ -39,7 +39,7 @@ impl StorageEvent {
old_value: old_value, old_value: old_value,
new_value: new_value, new_value: new_value,
url: url, url: url,
storage_area: MutNullableHeap::new(storage_area) storage_area: MutNullableJS::new(storage_area)
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::TouchBinding; use dom::bindings::codegen::Bindings::TouchBinding;
use dom::bindings::codegen::Bindings::TouchBinding::TouchMethods; use dom::bindings::codegen::Bindings::TouchBinding::TouchMethods;
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{MutJS, Root};
use dom::bindings::num::Finite; use dom::bindings::num::Finite;
use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::eventtarget::EventTarget; use dom::eventtarget::EventTarget;
@ -14,7 +14,7 @@ use dom::window::Window;
pub struct Touch { pub struct Touch {
reflector_: Reflector, reflector_: Reflector,
identifier: i32, identifier: i32,
target: MutHeap<JS<EventTarget>>, target: MutJS<EventTarget>,
screen_x: f64, screen_x: f64,
screen_y: f64, screen_y: f64,
client_x: f64, client_x: f64,
@ -31,7 +31,7 @@ impl Touch {
Touch { Touch {
reflector_: Reflector::new(), reflector_: Reflector::new(),
identifier: identifier, identifier: identifier,
target: MutHeap::new(target), target: MutJS::new(target),
screen_x: *screen_x, screen_x: *screen_x,
screen_y: *screen_y, screen_y: *screen_y,
client_x: *client_x, client_x: *client_x,

View file

@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::TouchEventBinding;
use dom::bindings::codegen::Bindings::TouchEventBinding::TouchEventMethods; use dom::bindings::codegen::Bindings::TouchEventBinding::TouchEventMethods;
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{MutJS, Root};
use dom::bindings::reflector::reflect_dom_object; use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::event::{EventBubbles, EventCancelable}; use dom::event::{EventBubbles, EventCancelable};
@ -18,9 +18,9 @@ use std::cell::Cell;
#[dom_struct] #[dom_struct]
pub struct TouchEvent { pub struct TouchEvent {
uievent: UIEvent, uievent: UIEvent,
touches: MutHeap<JS<TouchList>>, touches: MutJS<TouchList>,
target_touches: MutHeap<JS<TouchList>>, target_touches: MutJS<TouchList>,
changed_touches: MutHeap<JS<TouchList>>, changed_touches: MutJS<TouchList>,
alt_key: Cell<bool>, alt_key: Cell<bool>,
meta_key: Cell<bool>, meta_key: Cell<bool>,
ctrl_key: Cell<bool>, ctrl_key: Cell<bool>,
@ -33,9 +33,9 @@ impl TouchEvent {
target_touches: &TouchList) -> TouchEvent { target_touches: &TouchList) -> TouchEvent {
TouchEvent { TouchEvent {
uievent: UIEvent::new_inherited(), uievent: UIEvent::new_inherited(),
touches: MutHeap::new(touches), touches: MutJS::new(touches),
target_touches: MutHeap::new(target_touches), target_touches: MutJS::new(target_touches),
changed_touches: MutHeap::new(changed_touches), changed_touches: MutJS::new(changed_touches),
ctrl_key: Cell::new(false), ctrl_key: Cell::new(false),
shift_key: Cell::new(false), shift_key: Cell::new(false),
alt_key: Cell::new(false), alt_key: Cell::new(false),

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilterConstants;
use dom::bindings::codegen::Bindings::TreeWalkerBinding; use dom::bindings::codegen::Bindings::TreeWalkerBinding;
use dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods; use dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::js::{JS, MutHeap}; use dom::bindings::js::{JS, MutJS};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::document::Document; use dom::document::Document;
@ -21,7 +21,7 @@ use std::rc::Rc;
pub struct TreeWalker { pub struct TreeWalker {
reflector_: Reflector, reflector_: Reflector,
root_node: JS<Node>, root_node: JS<Node>,
current_node: MutHeap<JS<Node>>, current_node: MutJS<Node>,
what_to_show: u32, what_to_show: u32,
#[ignore_heap_size_of = "function pointers and Rc<T> are hard"] #[ignore_heap_size_of = "function pointers and Rc<T> are hard"]
filter: Filter filter: Filter
@ -34,7 +34,7 @@ impl TreeWalker {
TreeWalker { TreeWalker {
reflector_: Reflector::new(), reflector_: Reflector::new(),
root_node: JS::from_ref(root_node), root_node: JS::from_ref(root_node),
current_node: MutHeap::new(root_node), current_node: MutJS::new(root_node),
what_to_show: what_to_show, what_to_show: what_to_show,
filter: filter filter: filter
} }

View file

@ -7,8 +7,7 @@ use dom::bindings::codegen::Bindings::UIEventBinding;
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, RootedReference}; use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::js::Root;
use dom::bindings::reflector::reflect_dom_object; use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable}; use dom::event::{Event, EventBubbles, EventCancelable};
@ -21,7 +20,7 @@ use std::default::Default;
#[dom_struct] #[dom_struct]
pub struct UIEvent { pub struct UIEvent {
event: Event, event: Event,
view: MutNullableHeap<JS<Window>>, view: MutNullableJS<Window>,
detail: Cell<i32> detail: Cell<i32>
} }

View file

@ -6,7 +6,7 @@ use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
use dom::bindings::codegen::Bindings::URLBinding::{self, URLMethods}; use dom::bindings::codegen::Bindings::URLBinding::{self, URLMethods};
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{DOMString, USVString}; use dom::bindings::str::{DOMString, USVString};
use dom::blob::Blob; use dom::blob::Blob;
@ -30,7 +30,7 @@ pub struct URL {
url: DOMRefCell<ServoUrl>, url: DOMRefCell<ServoUrl>,
// https://url.spec.whatwg.org/#dom-url-searchparams // https://url.spec.whatwg.org/#dom-url-searchparams
search_params: MutNullableHeap<JS<URLSearchParams>>, search_params: MutNullableJS<URLSearchParams>,
} }
impl URL { impl URL {

View file

@ -7,7 +7,7 @@ use canvas_traits::CanvasMsg;
use dom::bindings::cell::DOMRefCell; use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::WebGLFramebufferBinding; use dom::bindings::codegen::Bindings::WebGLFramebufferBinding;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::js::{HeapGCValue, JS, Root}; use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::reflect_dom_object; use dom::bindings::reflector::reflect_dom_object;
use dom::webglobject::WebGLObject; use dom::webglobject::WebGLObject;
use dom::webglrenderbuffer::WebGLRenderbuffer; use dom::webglrenderbuffer::WebGLRenderbuffer;
@ -25,8 +25,6 @@ enum WebGLFramebufferAttachment {
Texture { texture: JS<WebGLTexture>, level: i32 }, Texture { texture: JS<WebGLTexture>, level: i32 },
} }
impl HeapGCValue for WebGLFramebufferAttachment {}
#[dom_struct] #[dom_struct]
pub struct WebGLFramebuffer { pub struct WebGLFramebuffer {
webgl_object: WebGLObject, webgl_object: WebGLObject,

View file

@ -6,7 +6,7 @@
use canvas_traits::CanvasMsg; use canvas_traits::CanvasMsg;
use dom::bindings::codegen::Bindings::WebGLProgramBinding; use dom::bindings::codegen::Bindings::WebGLProgramBinding;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::webglactiveinfo::WebGLActiveInfo; use dom::webglactiveinfo::WebGLActiveInfo;
@ -27,8 +27,8 @@ pub struct WebGLProgram {
is_deleted: Cell<bool>, is_deleted: Cell<bool>,
link_called: Cell<bool>, link_called: Cell<bool>,
linked: Cell<bool>, linked: Cell<bool>,
fragment_shader: MutNullableHeap<JS<WebGLShader>>, fragment_shader: MutNullableJS<WebGLShader>,
vertex_shader: MutNullableHeap<JS<WebGLShader>>, vertex_shader: MutNullableJS<WebGLShader>,
#[ignore_heap_size_of = "Defined in ipc-channel"] #[ignore_heap_size_of = "Defined in ipc-channel"]
renderer: IpcSender<CanvasMsg>, renderer: IpcSender<CanvasMsg>,
} }

View file

@ -13,7 +13,7 @@ use dom::bindings::conversions::{array_buffer_to_vec, array_buffer_view_data, ar
use dom::bindings::conversions::{array_buffer_view_to_vec, array_buffer_view_to_vec_checked}; use dom::bindings::conversions::{array_buffer_view_to_vec, array_buffer_view_to_vec_checked};
use dom::bindings::error::{Error, Fallible}; use dom::bindings::error::{Error, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root}; use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable}; use dom::event::{Event, EventBubbles, EventCancelable};
@ -124,13 +124,13 @@ pub struct WebGLRenderingContext {
#[ignore_heap_size_of = "Defined in webrender_traits"] #[ignore_heap_size_of = "Defined in webrender_traits"]
last_error: Cell<Option<WebGLError>>, last_error: Cell<Option<WebGLError>>,
texture_unpacking_settings: Cell<TextureUnpacking>, texture_unpacking_settings: Cell<TextureUnpacking>,
bound_framebuffer: MutNullableHeap<JS<WebGLFramebuffer>>, bound_framebuffer: MutNullableJS<WebGLFramebuffer>,
bound_renderbuffer: MutNullableHeap<JS<WebGLRenderbuffer>>, bound_renderbuffer: MutNullableJS<WebGLRenderbuffer>,
bound_texture_2d: MutNullableHeap<JS<WebGLTexture>>, bound_texture_2d: MutNullableJS<WebGLTexture>,
bound_texture_cube_map: MutNullableHeap<JS<WebGLTexture>>, bound_texture_cube_map: MutNullableJS<WebGLTexture>,
bound_buffer_array: MutNullableHeap<JS<WebGLBuffer>>, bound_buffer_array: MutNullableJS<WebGLBuffer>,
bound_buffer_element_array: MutNullableHeap<JS<WebGLBuffer>>, bound_buffer_element_array: MutNullableJS<WebGLBuffer>,
current_program: MutNullableHeap<JS<WebGLProgram>>, current_program: MutNullableJS<WebGLProgram>,
#[ignore_heap_size_of = "Because it's small"] #[ignore_heap_size_of = "Because it's small"]
current_vertex_attrib_0: Cell<(f32, f32, f32, f32)>, current_vertex_attrib_0: Cell<(f32, f32, f32, f32)>,
#[ignore_heap_size_of = "Because it's small"] #[ignore_heap_size_of = "Because it's small"]
@ -159,13 +159,13 @@ impl WebGLRenderingContext {
canvas: JS::from_ref(canvas), canvas: JS::from_ref(canvas),
last_error: Cell::new(None), last_error: Cell::new(None),
texture_unpacking_settings: Cell::new(CONVERT_COLORSPACE), texture_unpacking_settings: Cell::new(CONVERT_COLORSPACE),
bound_framebuffer: MutNullableHeap::new(None), bound_framebuffer: MutNullableJS::new(None),
bound_texture_2d: MutNullableHeap::new(None), bound_texture_2d: MutNullableJS::new(None),
bound_texture_cube_map: MutNullableHeap::new(None), bound_texture_cube_map: MutNullableJS::new(None),
bound_buffer_array: MutNullableHeap::new(None), bound_buffer_array: MutNullableJS::new(None),
bound_buffer_element_array: MutNullableHeap::new(None), bound_buffer_element_array: MutNullableJS::new(None),
bound_renderbuffer: MutNullableHeap::new(None), bound_renderbuffer: MutNullableJS::new(None),
current_program: MutNullableHeap::new(None), current_program: MutNullableJS::new(None),
current_vertex_attrib_0: Cell::new((0f32, 0f32, 0f32, 1f32)), current_vertex_attrib_0: Cell::new((0f32, 0f32, 0f32, 1f32)),
current_scissor: Cell::new((0, 0, size.width, size.height)), current_scissor: Cell::new((0, 0, size.width, size.height)),
current_clear_color: Cell::new((0.0, 0.0, 0.0, 0.0)) current_clear_color: Cell::new((0.0, 0.0, 0.0, 0.0))

View file

@ -19,7 +19,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOp
use dom::bindings::codegen::UnionTypes::RequestOrUSVString; use dom::bindings::codegen::UnionTypes::RequestOrUSVString;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::num::Finite; use dom::bindings::num::Finite;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject; use dom::bindings::reflector::DomObject;
@ -159,19 +159,19 @@ pub struct Window {
history_traversal_task_source: HistoryTraversalTaskSource, history_traversal_task_source: HistoryTraversalTaskSource,
#[ignore_heap_size_of = "task sources are hard"] #[ignore_heap_size_of = "task sources are hard"]
file_reading_task_source: FileReadingTaskSource, file_reading_task_source: FileReadingTaskSource,
navigator: MutNullableHeap<JS<Navigator>>, navigator: MutNullableJS<Navigator>,
#[ignore_heap_size_of = "channels are hard"] #[ignore_heap_size_of = "channels are hard"]
image_cache_thread: ImageCacheThread, image_cache_thread: ImageCacheThread,
#[ignore_heap_size_of = "channels are hard"] #[ignore_heap_size_of = "channels are hard"]
image_cache_chan: ImageCacheChan, image_cache_chan: ImageCacheChan,
browsing_context: MutNullableHeap<JS<BrowsingContext>>, browsing_context: MutNullableJS<BrowsingContext>,
history: MutNullableHeap<JS<History>>, history: MutNullableJS<History>,
performance: MutNullableHeap<JS<Performance>>, performance: MutNullableJS<Performance>,
navigation_start: u64, navigation_start: u64,
navigation_start_precise: f64, navigation_start_precise: f64,
screen: MutNullableHeap<JS<Screen>>, screen: MutNullableJS<Screen>,
session_storage: MutNullableHeap<JS<Storage>>, session_storage: MutNullableJS<Storage>,
local_storage: MutNullableHeap<JS<Storage>>, local_storage: MutNullableJS<Storage>,
status: DOMRefCell<DOMString>, status: DOMRefCell<DOMString>,
/// For sending timeline markers. Will be ignored if /// For sending timeline markers. Will be ignored if
@ -241,7 +241,7 @@ pub struct Window {
/// All the MediaQueryLists we need to update /// All the MediaQueryLists we need to update
media_query_lists: WeakMediaQueryListVec, media_query_lists: WeakMediaQueryListVec,
test_runner: MutNullableHeap<JS<TestRunner>>, test_runner: MutNullableJS<TestRunner>,
} }
impl Window { impl Window {

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScop
use dom::bindings::codegen::UnionTypes::RequestOrUSVString; use dom::bindings::codegen::UnionTypes::RequestOrUSVString;
use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception}; use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
@ -73,8 +73,8 @@ pub struct WorkerGlobalScope {
closing: Option<Arc<AtomicBool>>, closing: Option<Arc<AtomicBool>>,
#[ignore_heap_size_of = "Defined in js"] #[ignore_heap_size_of = "Defined in js"]
runtime: Runtime, runtime: Runtime,
location: MutNullableHeap<JS<WorkerLocation>>, location: MutNullableJS<WorkerLocation>,
navigator: MutNullableHeap<JS<WorkerNavigator>>, navigator: MutNullableJS<WorkerNavigator>,
#[ignore_heap_size_of = "Defined in ipc-channel"] #[ignore_heap_size_of = "Defined in ipc-channel"]
/// Optional `IpcSender` for sending the `DevtoolScriptControlMsg` /// Optional `IpcSender` for sending the `DevtoolScriptControlMsg`

View file

@ -14,7 +14,7 @@ use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::XMLHttpRequestRespo
use dom::bindings::conversions::ToJSValConvertible; use dom::bindings::conversions::ToJSValConvertible;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutHeapJSVal, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutHeapJSVal, MutNullableJS, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString, USVString, is_token}; use dom::bindings::str::{ByteString, DOMString, USVString, is_token};
@ -122,8 +122,8 @@ pub struct XMLHttpRequest {
status_text: DOMRefCell<ByteString>, status_text: DOMRefCell<ByteString>,
response: DOMRefCell<ByteString>, response: DOMRefCell<ByteString>,
response_type: Cell<XMLHttpRequestResponseType>, response_type: Cell<XMLHttpRequestResponseType>,
response_xml: MutNullableHeap<JS<Document>>, response_xml: MutNullableJS<Document>,
response_blob: MutNullableHeap<JS<Blob>>, response_blob: MutNullableJS<Blob>,
#[ignore_heap_size_of = "Defined in rust-mozjs"] #[ignore_heap_size_of = "Defined in rust-mozjs"]
response_json: MutHeapJSVal, response_json: MutHeapJSVal,
#[ignore_heap_size_of = "Defined in hyper"] #[ignore_heap_size_of = "Defined in hyper"]

View file

@ -32,7 +32,7 @@ use dom::bindings::codegen::Bindings::TransitionEventBinding::TransitionEventIni
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, StringificationBehavior}; use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, StringificationBehavior};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootCollection}; use dom::bindings::js::{JS, MutNullableJS, Root, RootCollection};
use dom::bindings::js::{RootCollectionPtr, RootedReference}; use dom::bindings::js::{RootCollectionPtr, RootedReference};
use dom::bindings::num::Finite; use dom::bindings::num::Finite;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
@ -461,7 +461,7 @@ pub struct ScriptThread {
js_runtime: Rc<Runtime>, js_runtime: Rc<Runtime>,
/// The topmost element over the mouse. /// The topmost element over the mouse.
topmost_mouse_over_target: MutNullableHeap<JS<Element>>, topmost_mouse_over_target: MutNullableJS<Element>,
/// List of pipelines that have been owned and closed by this script thread. /// List of pipelines that have been owned and closed by this script thread.
closed_pipelines: DOMRefCell<HashSet<PipelineId>>, closed_pipelines: DOMRefCell<HashSet<PipelineId>>,
@ -686,7 +686,7 @@ impl ScriptThread {
devtools_sender: ipc_devtools_sender, devtools_sender: ipc_devtools_sender,
js_runtime: Rc::new(runtime), js_runtime: Rc::new(runtime),
topmost_mouse_over_target: MutNullableHeap::new(Default::default()), topmost_mouse_over_target: MutNullableJS::new(Default::default()),
closed_pipelines: DOMRefCell::new(HashSet::new()), closed_pipelines: DOMRefCell::new(HashSet::new()),
scheduler_chan: state.scheduler_chan, scheduler_chan: state.scheduler_chan,

View file

@ -13,7 +13,7 @@ use script::dom::node::Node;
struct Foo { struct Foo {
bar: DOMRefCell<JS<Node>> bar: DOMRefCell<JS<Node>>
//~^ ERROR Banned type DOMRefCell<JS<T>> detected. Use MutHeap<JS<T>> instead, //~^ ERROR Banned type DOMRefCell<JS<T>> detected. Use MutJS<JS<T>> instead,
} }
fn main() {} fn main() {}

View file

@ -12,7 +12,7 @@ use std::cell::Cell;
struct Foo { struct Foo {
bar: Cell<JSVal> bar: Cell<JSVal>
//~^ ERROR Banned type Cell<JSVal> detected. Use MutHeap<JSVal> instead, //~^ ERROR Banned type Cell<JSVal> detected. Use MutJS<JSVal> instead,
} }
fn main() {} fn main() {}