diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index f845bd3bd30..417d4b9de52 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -400,11 +400,11 @@ impl HeapSizeOf for MutNullableDom { /// This should only be used as a field in other DOM objects; see warning /// on `Dom`. #[must_root] -pub struct OnceCellJS { +pub struct DomOnceCell { ptr: OnceCell>, } -impl OnceCellJS { +impl DomOnceCell { /// Retrieve a copy of the current inner value. If it is `None`, it is /// initialized with the result of `cb` first. #[allow(unrooted_must_root)] @@ -416,17 +416,17 @@ impl OnceCellJS { } } -impl Default for OnceCellJS { +impl Default for DomOnceCell { #[allow(unrooted_must_root)] - fn default() -> OnceCellJS { + fn default() -> DomOnceCell { debug_assert!(thread_state::get().is_script()); - OnceCellJS { + DomOnceCell { ptr: OnceCell::new(), } } } -impl HeapSizeOf for OnceCellJS { +impl HeapSizeOf for DomOnceCell { fn heap_size_of_children(&self) -> usize { // See comment on HeapSizeOf for Dom. 0 @@ -434,7 +434,7 @@ impl HeapSizeOf for OnceCellJS { } #[allow(unrooted_must_root)] -unsafe impl JSTraceable for OnceCellJS { +unsafe impl JSTraceable for DomOnceCell { unsafe fn trace(&self, trc: *mut JSTracer) { if let Some(ptr) = self.ptr.as_ref() { ptr.trace(trc); diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 5f553d1d433..a062ca3f055 100755 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaEl use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, OnceCellJS, Root, RootedReference}; +use dom::bindings::root::{Dom, DomOnceCell, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::blob::Blob; use dom::document::Document; @@ -64,7 +64,7 @@ pub struct GenerationId(u32); pub struct HTMLFormElement { htmlelement: HTMLElement, marked_for_reset: Cell, - elements: OnceCellJS, + elements: DomOnceCell, generation_id: Cell, controls: DOMRefCell>>, }