mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Rename OnceCellJS<T> to DomOnceCell<T>
Like DOMRefCell<T>.
This commit is contained in:
parent
e2dac78d36
commit
9a7ba89c84
2 changed files with 9 additions and 9 deletions
|
@ -400,11 +400,11 @@ impl<T: DomObject> HeapSizeOf for MutNullableDom<T> {
|
||||||
/// This should only be used as a field in other DOM objects; see warning
|
/// This should only be used as a field in other DOM objects; see warning
|
||||||
/// on `Dom<T>`.
|
/// on `Dom<T>`.
|
||||||
#[must_root]
|
#[must_root]
|
||||||
pub struct OnceCellJS<T: DomObject> {
|
pub struct DomOnceCell<T: DomObject> {
|
||||||
ptr: OnceCell<Dom<T>>,
|
ptr: OnceCell<Dom<T>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: DomObject> OnceCellJS<T> {
|
impl<T: DomObject> DomOnceCell<T> {
|
||||||
/// Retrieve a copy of the current inner value. If it is `None`, it is
|
/// Retrieve a copy of the current inner value. If it is `None`, it is
|
||||||
/// initialized with the result of `cb` first.
|
/// initialized with the result of `cb` first.
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
|
@ -416,17 +416,17 @@ impl<T: DomObject> OnceCellJS<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: DomObject> Default for OnceCellJS<T> {
|
impl<T: DomObject> Default for DomOnceCell<T> {
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
fn default() -> OnceCellJS<T> {
|
fn default() -> DomOnceCell<T> {
|
||||||
debug_assert!(thread_state::get().is_script());
|
debug_assert!(thread_state::get().is_script());
|
||||||
OnceCellJS {
|
DomOnceCell {
|
||||||
ptr: OnceCell::new(),
|
ptr: OnceCell::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: DomObject> HeapSizeOf for OnceCellJS<T> {
|
impl<T: DomObject> HeapSizeOf for DomOnceCell<T> {
|
||||||
fn heap_size_of_children(&self) -> usize {
|
fn heap_size_of_children(&self) -> usize {
|
||||||
// See comment on HeapSizeOf for Dom<T>.
|
// See comment on HeapSizeOf for Dom<T>.
|
||||||
0
|
0
|
||||||
|
@ -434,7 +434,7 @@ impl<T: DomObject> HeapSizeOf for OnceCellJS<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
unsafe impl<T: DomObject> JSTraceable for OnceCellJS<T> {
|
unsafe impl<T: DomObject> JSTraceable for DomOnceCell<T> {
|
||||||
unsafe fn trace(&self, trc: *mut JSTracer) {
|
unsafe fn trace(&self, trc: *mut JSTracer) {
|
||||||
if let Some(ptr) = self.ptr.as_ref() {
|
if let Some(ptr) = self.ptr.as_ref() {
|
||||||
ptr.trace(trc);
|
ptr.trace(trc);
|
||||||
|
|
|
@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaEl
|
||||||
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
||||||
use dom::bindings::refcounted::Trusted;
|
use dom::bindings::refcounted::Trusted;
|
||||||
use dom::bindings::reflector::DomObject;
|
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::bindings::str::DOMString;
|
||||||
use dom::blob::Blob;
|
use dom::blob::Blob;
|
||||||
use dom::document::Document;
|
use dom::document::Document;
|
||||||
|
@ -64,7 +64,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: OnceCellJS<HTMLFormControlsCollection>,
|
elements: DomOnceCell<HTMLFormControlsCollection>,
|
||||||
generation_id: Cell<GenerationId>,
|
generation_id: Cell<GenerationId>,
|
||||||
controls: DOMRefCell<Vec<Dom<Element>>>,
|
controls: DOMRefCell<Vec<Dom<Element>>>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue