aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-09-26 00:16:22 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-09-26 09:49:00 +0200
commitd29335040d78a19f25830061484cf70dc03a9c21 (patch)
treebac565ff8784a124a385632a3b0680c326510d93
parent7be32fb2371a14ba61b008a37e79761f66c073c7 (diff)
downloadservo-d29335040d78a19f25830061484cf70dc03a9c21.tar.gz
servo-d29335040d78a19f25830061484cf70dc03a9c21.zip
Rename MutJS<T> to MutDom<T>
-rw-r--r--components/script/dom/bindings/root.rs20
-rw-r--r--components/script/dom/mod.rs2
-rw-r--r--components/script/dom/nodeiterator.rs6
-rw-r--r--components/script/dom/range.rs6
-rw-r--r--components/script/dom/touch.rs6
-rw-r--r--components/script/dom/touchevent.rs14
-rw-r--r--components/script/dom/treewalker.rs6
-rw-r--r--components/script/dom/vrdisplay.rs14
-rw-r--r--python/tidy/servo_tidy/tidy.py8
-rw-r--r--python/tidy/servo_tidy_tests/ban-domrefcell.rs2
-rw-r--r--python/tidy/servo_tidy_tests/ban.rs2
-rw-r--r--python/tidy/servo_tidy_tests/test_tidy.py4
12 files changed, 45 insertions, 45 deletions
diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs
index 32c3e5c7eaa..a7f4bb9e411 100644
--- a/components/script/dom/bindings/root.rs
+++ b/components/script/dom/bindings/root.rs
@@ -237,20 +237,20 @@ impl LayoutJS<Node> {
/// on `Dom<T>`.
#[must_root]
#[derive(JSTraceable)]
-pub struct MutJS<T: DomObject> {
+pub struct MutDom<T: DomObject> {
val: UnsafeCell<Dom<T>>,
}
-impl<T: DomObject> MutJS<T> {
- /// Create a new `MutJS`.
- pub fn new(initial: &T) -> MutJS<T> {
+impl<T: DomObject> MutDom<T> {
+ /// Create a new `MutDom`.
+ pub fn new(initial: &T) -> MutDom<T> {
debug_assert!(thread_state::get().is_script());
- MutJS {
+ MutDom {
val: UnsafeCell::new(Dom::from_ref(initial)),
}
}
- /// Set this `MutJS` to the given value.
+ /// Set this `MutDom` to the given value.
pub fn set(&self, val: &T) {
debug_assert!(thread_state::get().is_script());
unsafe {
@@ -258,7 +258,7 @@ impl<T: DomObject> MutJS<T> {
}
}
- /// Get the value in this `MutJS`.
+ /// Get the value in this `MutDom`.
pub fn get(&self) -> Root<T> {
debug_assert!(thread_state::get().is_script());
unsafe {
@@ -267,14 +267,14 @@ impl<T: DomObject> MutJS<T> {
}
}
-impl<T: DomObject> HeapSizeOf for MutJS<T> {
+impl<T: DomObject> HeapSizeOf for MutDom<T> {
fn heap_size_of_children(&self) -> usize {
// See comment on HeapSizeOf for Dom<T>.
0
}
}
-impl<T: DomObject> PartialEq for MutJS<T> {
+impl<T: DomObject> PartialEq for MutDom<T> {
fn eq(&self, other: &Self) -> bool {
unsafe {
*self.val.get() == *other.val.get()
@@ -282,7 +282,7 @@ impl<T: DomObject> PartialEq for MutJS<T> {
}
}
-impl<T: DomObject + PartialEq> PartialEq<T> for MutJS<T> {
+impl<T: DomObject + PartialEq> PartialEq<T> for MutDom<T> {
fn eq(&self, other: &T) -> bool {
unsafe {
**self.val.get() == *other
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs
index 8020d832ab9..7c683edf9eb 100644
--- a/components/script/dom/mod.rs
+++ b/components/script/dom/mod.rs
@@ -33,7 +33,7 @@
//! the [`Root`](bindings/root/struct.Root.html) smart pointer;
//! * tracing pointers in member fields: the [`Dom`](bindings/root/struct.Dom.html),
//! [`MutNullableJS`](bindings/root/struct.MutNullableJS.html) and
-//! [`MutJS`](bindings/root/struct.MutJS.html) smart pointers and
+//! [`MutDom`](bindings/root/struct.MutDom.html) smart pointers and
//! [the tracing implementation](bindings/trace/index.html);
//! * rooting pointers from across thread boundaries or in channels: the
//! [`Trusted`](bindings/refcounted/struct.Trusted.html) smart pointer;
diff --git a/components/script/dom/nodeiterator.rs b/components/script/dom/nodeiterator.rs
index 0ab8c54360b..ec18066a978 100644
--- a/components/script/dom/nodeiterator.rs
+++ b/components/script/dom/nodeiterator.rs
@@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::NodeIteratorBinding;
use dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods;
use dom::bindings::error::Fallible;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
-use dom::bindings::root::{Dom, MutJS, Root};
+use dom::bindings::root::{Dom, MutDom, Root};
use dom::document::Document;
use dom::node::Node;
use dom_struct::dom_struct;
@@ -22,7 +22,7 @@ pub struct NodeIterator {
reflector_: Reflector,
root_node: Dom<Node>,
#[ignore_heap_size_of = "Defined in rust-mozjs"]
- reference_node: MutJS<Node>,
+ reference_node: MutDom<Node>,
pointer_before_reference_node: Cell<bool>,
what_to_show: u32,
#[ignore_heap_size_of = "Can't measure due to #6870"]
@@ -36,7 +36,7 @@ impl NodeIterator {
NodeIterator {
reflector_: Reflector::new(),
root_node: Dom::from_ref(root_node),
- reference_node: MutJS::new(root_node),
+ reference_node: MutDom::new(root_node),
pointer_before_reference_node: Cell::new(true),
what_to_show: what_to_show,
filter: filter
diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs
index 1344f9c7a5c..79091beff55 100644
--- a/components/script/dom/range.rs
+++ b/components/script/dom/range.rs
@@ -14,7 +14,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId};
use dom::bindings::inheritance::Castable;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
-use dom::bindings::root::{Dom, MutJS, Root, RootedReference};
+use dom::bindings::root::{Dom, MutDom, Root, RootedReference};
use dom::bindings::str::DOMString;
use dom::bindings::trace::JSTraceable;
use dom::bindings::weakref::{WeakRef, WeakRefVec};
@@ -933,7 +933,7 @@ impl RangeMethods for Range {
#[derive(DenyPublicFields, HeapSizeOf, JSTraceable)]
#[must_root]
pub struct BoundaryPoint {
- node: MutJS<Node>,
+ node: MutDom<Node>,
offset: Cell<u32>,
}
@@ -942,7 +942,7 @@ impl BoundaryPoint {
debug_assert!(!node.is_doctype());
debug_assert!(offset <= node.len());
BoundaryPoint {
- node: MutJS::new(node),
+ node: MutDom::new(node),
offset: Cell::new(offset),
}
}
diff --git a/components/script/dom/touch.rs b/components/script/dom/touch.rs
index d7920a2dd19..d526e607d8d 100644
--- a/components/script/dom/touch.rs
+++ b/components/script/dom/touch.rs
@@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::TouchBinding;
use dom::bindings::codegen::Bindings::TouchBinding::TouchMethods;
use dom::bindings::num::Finite;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
-use dom::bindings::root::{MutJS, Root};
+use dom::bindings::root::{MutDom, Root};
use dom::eventtarget::EventTarget;
use dom::window::Window;
use dom_struct::dom_struct;
@@ -15,7 +15,7 @@ use dom_struct::dom_struct;
pub struct Touch {
reflector_: Reflector,
identifier: i32,
- target: MutJS<EventTarget>,
+ target: MutDom<EventTarget>,
screen_x: f64,
screen_y: f64,
client_x: f64,
@@ -32,7 +32,7 @@ impl Touch {
Touch {
reflector_: Reflector::new(),
identifier: identifier,
- target: MutJS::new(target),
+ target: MutDom::new(target),
screen_x: *screen_x,
screen_y: *screen_y,
client_x: *client_x,
diff --git a/components/script/dom/touchevent.rs b/components/script/dom/touchevent.rs
index 4c29bc48445..92ff9bf0424 100644
--- a/components/script/dom/touchevent.rs
+++ b/components/script/dom/touchevent.rs
@@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::TouchEventBinding::TouchEventMethods;
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::reflector::reflect_dom_object;
-use dom::bindings::root::{MutJS, Root};
+use dom::bindings::root::{MutDom, Root};
use dom::bindings::str::DOMString;
use dom::event::{EventBubbles, EventCancelable};
use dom::touchlist::TouchList;
@@ -19,9 +19,9 @@ use std::cell::Cell;
#[dom_struct]
pub struct TouchEvent {
uievent: UIEvent,
- touches: MutJS<TouchList>,
- target_touches: MutJS<TouchList>,
- changed_touches: MutJS<TouchList>,
+ touches: MutDom<TouchList>,
+ target_touches: MutDom<TouchList>,
+ changed_touches: MutDom<TouchList>,
alt_key: Cell<bool>,
meta_key: Cell<bool>,
ctrl_key: Cell<bool>,
@@ -34,9 +34,9 @@ impl TouchEvent {
target_touches: &TouchList) -> TouchEvent {
TouchEvent {
uievent: UIEvent::new_inherited(),
- touches: MutJS::new(touches),
- target_touches: MutJS::new(target_touches),
- changed_touches: MutJS::new(changed_touches),
+ touches: MutDom::new(touches),
+ target_touches: MutDom::new(target_touches),
+ changed_touches: MutDom::new(changed_touches),
ctrl_key: Cell::new(false),
shift_key: Cell::new(false),
alt_key: Cell::new(false),
diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs
index bbb27c61541..61a085aaa53 100644
--- a/components/script/dom/treewalker.rs
+++ b/components/script/dom/treewalker.rs
@@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::TreeWalkerBinding;
use dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods;
use dom::bindings::error::Fallible;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
-use dom::bindings::root::{Dom, MutJS, Root};
+use dom::bindings::root::{Dom, MutDom, Root};
use dom::document::Document;
use dom::node::Node;
use dom_struct::dom_struct;
@@ -21,7 +21,7 @@ use std::rc::Rc;
pub struct TreeWalker {
reflector_: Reflector,
root_node: Dom<Node>,
- current_node: MutJS<Node>,
+ current_node: MutDom<Node>,
what_to_show: u32,
#[ignore_heap_size_of = "function pointers and Rc<T> are hard"]
filter: Filter
@@ -34,7 +34,7 @@ impl TreeWalker {
TreeWalker {
reflector_: Reflector::new(),
root_node: Dom::from_ref(root_node),
- current_node: MutJS::new(root_node),
+ current_node: MutDom::new(root_node),
what_to_show: what_to_show,
filter: filter
}
diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs
index a17666e625e..d6e8d480c3d 100644
--- a/components/script/dom/vrdisplay.rs
+++ b/components/script/dom/vrdisplay.rs
@@ -18,7 +18,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::num::Finite;
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{DomObject, reflect_dom_object};
-use dom::bindings::root::{MutJS, MutNullableJS, Root};
+use dom::bindings::root::{MutDom, MutNullableJS, Root};
use dom::bindings::str::DOMString;
use dom::event::Event;
use dom::eventtarget::EventTarget;
@@ -51,9 +51,9 @@ pub struct VRDisplay {
depth_near: Cell<f64>,
depth_far: Cell<f64>,
presenting: Cell<bool>,
- left_eye_params: MutJS<VREyeParameters>,
- right_eye_params: MutJS<VREyeParameters>,
- capabilities: MutJS<VRDisplayCapabilities>,
+ left_eye_params: MutDom<VREyeParameters>,
+ right_eye_params: MutDom<VREyeParameters>,
+ capabilities: MutDom<VRDisplayCapabilities>,
stage_params: MutNullableJS<VRStageParameters>,
#[ignore_heap_size_of = "Defined in rust-webvr"]
frame_data: DOMRefCell<WebVRFrameData>,
@@ -100,9 +100,9 @@ impl VRDisplay {
depth_near: Cell::new(0.01),
depth_far: Cell::new(10000.0),
presenting: Cell::new(false),
- left_eye_params: MutJS::new(&*VREyeParameters::new(display.left_eye_parameters.clone(), &global)),
- right_eye_params: MutJS::new(&*VREyeParameters::new(display.right_eye_parameters.clone(), &global)),
- capabilities: MutJS::new(&*VRDisplayCapabilities::new(display.capabilities.clone(), &global)),
+ left_eye_params: MutDom::new(&*VREyeParameters::new(display.left_eye_parameters.clone(), &global)),
+ right_eye_params: MutDom::new(&*VREyeParameters::new(display.right_eye_parameters.clone(), &global)),
+ capabilities: MutDom::new(&*VRDisplayCapabilities::new(display.capabilities.clone(), &global)),
stage_params: MutNullableJS::new(stage.as_ref().map(|v| v.deref())),
frame_data: DOMRefCell::new(Default::default()),
layer: DOMRefCell::new(Default::default()),
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index cd4bf6feb97..d7c83ee8cee 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -575,10 +575,10 @@ def check_rust(file_name, lines):
(r": &String", "use &str instead of &String", no_filter),
# There should be any use of banned types:
# Cell<JSVal>, Cell<Dom<T>>, DOMRefCell<Dom<T>>, DOMRefCell<HEAP<T>>
- (r"(\s|:)+Cell<JSVal>", "Banned type Cell<JSVal> detected. Use MutJS<JSVal> instead", no_filter),
- (r"(\s|:)+Cell<Dom<.+>>", "Banned type Cell<Dom<T>> detected. Use MutJS<T> instead", no_filter),
- (r"DOMRefCell<Dom<.+>>", "Banned type DOMRefCell<Dom<T>> detected. Use MutJS<T> instead", no_filter),
- (r"DOMRefCell<Heap<.+>>", "Banned type DOMRefCell<Heap<T>> detected. Use MutJS<T> instead", no_filter),
+ (r"(\s|:)+Cell<JSVal>", "Banned type Cell<JSVal> detected. Use MutDom<JSVal> instead", no_filter),
+ (r"(\s|:)+Cell<Dom<.+>>", "Banned type Cell<Dom<T>> detected. Use MutDom<T> instead", no_filter),
+ (r"DOMRefCell<Dom<.+>>", "Banned type DOMRefCell<Dom<T>> detected. Use MutDom<T> instead", no_filter),
+ (r"DOMRefCell<Heap<.+>>", "Banned type DOMRefCell<Heap<T>> detected. Use MutDom<T> instead", no_filter),
# No benefit to using &Root<T>
(r": &Root<", "use &T instead of &Root<T>", no_filter),
(r"^&&", "operators should go at the end of the first line", no_filter),
diff --git a/python/tidy/servo_tidy_tests/ban-domrefcell.rs b/python/tidy/servo_tidy_tests/ban-domrefcell.rs
index f41358e7fa7..6d4e2b2fbc3 100644
--- a/python/tidy/servo_tidy_tests/ban-domrefcell.rs
+++ b/python/tidy/servo_tidy_tests/ban-domrefcell.rs
@@ -13,7 +13,7 @@ use script::test::Node;
struct Foo {
bar: DOMRefCell<Dom<Node>>
- //~^ ERROR Banned type DOMRefCell<Dom<T>> detected. Use MutJS<T> instead
+ //~^ ERROR Banned type DOMRefCell<Dom<T>> detected. Use MutDom<T> instead
}
fn main() {}
diff --git a/python/tidy/servo_tidy_tests/ban.rs b/python/tidy/servo_tidy_tests/ban.rs
index f828053d289..fc5c600041a 100644
--- a/python/tidy/servo_tidy_tests/ban.rs
+++ b/python/tidy/servo_tidy_tests/ban.rs
@@ -13,7 +13,7 @@ use std::cell::UnsafeCell;
struct Foo {
bar: Cell<JSVal>,
- //~^ ERROR Banned type Cell<JSVal> detected. Use MutJS<JSVal> instead
+ //~^ ERROR Banned type Cell<JSVal> detected. Use MutDom<JSVal> instead
foo: UnsafeCell<JSVal>
//~^ NOT AN ERROR
}
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py
index ce9906f5549..3761975c62b 100644
--- a/python/tidy/servo_tidy_tests/test_tidy.py
+++ b/python/tidy/servo_tidy_tests/test_tidy.py
@@ -147,11 +147,11 @@ class CheckTidiness(unittest.TestCase):
self.assertNoMoreErrors(feature_errors)
ban_errors = tidy.collect_errors_for_files(iterFile('ban.rs'), [], [tidy.check_rust], print_text=False)
- self.assertEqual('Banned type Cell<JSVal> detected. Use MutJS<JSVal> instead', ban_errors.next()[2])
+ self.assertEqual('Banned type Cell<JSVal> detected. Use MutDom<JSVal> instead', ban_errors.next()[2])
self.assertNoMoreErrors(ban_errors)
ban_errors = tidy.collect_errors_for_files(iterFile('ban-domrefcell.rs'), [], [tidy.check_rust], print_text=False)
- self.assertEqual('Banned type DOMRefCell<Dom<T>> detected. Use MutJS<T> instead', ban_errors.next()[2])
+ self.assertEqual('Banned type DOMRefCell<Dom<T>> detected. Use MutDom<T> instead', ban_errors.next()[2])
self.assertNoMoreErrors(ban_errors)
def test_spec_link(self):