mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Stop using DOMRefCell<Heap<..>>.
This commit is contained in:
parent
e5962fda4b
commit
d8e9e6c660
1 changed files with 15 additions and 17 deletions
|
@ -3,7 +3,6 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use core::nonzero::NonZero;
|
use core::nonzero::NonZero;
|
||||||
use dom::bindings::cell::DOMRefCell;
|
|
||||||
use dom::bindings::codegen::Bindings::VRPoseBinding;
|
use dom::bindings::codegen::Bindings::VRPoseBinding;
|
||||||
use dom::bindings::codegen::Bindings::VRPoseBinding::VRPoseMethods;
|
use dom::bindings::codegen::Bindings::VRPoseBinding::VRPoseMethods;
|
||||||
use dom::bindings::js::Root;
|
use dom::bindings::js::Root;
|
||||||
|
@ -17,19 +16,18 @@ use webvr_traits::webvr;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct VRPose {
|
pub struct VRPose {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
position: DOMRefCell<Heap<*mut JSObject>>,
|
position: Heap<*mut JSObject>,
|
||||||
orientation: DOMRefCell<Heap<*mut JSObject>>,
|
orientation: Heap<*mut JSObject>,
|
||||||
linear_vel: DOMRefCell<Heap<*mut JSObject>>,
|
linear_vel: Heap<*mut JSObject>,
|
||||||
angular_vel: DOMRefCell<Heap<*mut JSObject>>,
|
angular_vel: Heap<*mut JSObject>,
|
||||||
linear_acc: DOMRefCell<Heap<*mut JSObject>>,
|
linear_acc: Heap<*mut JSObject>,
|
||||||
angular_acc: DOMRefCell<Heap<*mut JSObject>>
|
angular_acc: Heap<*mut JSObject>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn update_or_create_typed_array(cx: *mut JSContext,
|
unsafe fn update_or_create_typed_array(cx: *mut JSContext,
|
||||||
src: Option<&[f32]>,
|
src: Option<&[f32]>,
|
||||||
dst: &DOMRefCell<Heap<*mut JSObject>>) {
|
dst: &Heap<*mut JSObject>) {
|
||||||
let dst = dst.borrow();
|
|
||||||
match src {
|
match src {
|
||||||
Some(ref data) => {
|
Some(ref data) => {
|
||||||
if dst.get().is_null() {
|
if dst.get().is_null() {
|
||||||
|
@ -51,8 +49,8 @@ unsafe fn update_or_create_typed_array(cx: *mut JSContext,
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn heap_to_option(heap: &DOMRefCell<Heap<*mut JSObject>>) -> Option<NonZero<*mut JSObject>> {
|
fn heap_to_option(heap: &Heap<*mut JSObject>) -> Option<NonZero<*mut JSObject>> {
|
||||||
let js_object = heap.borrow_mut().get();
|
let js_object = heap.get();
|
||||||
if js_object.is_null() {
|
if js_object.is_null() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
@ -66,12 +64,12 @@ impl VRPose {
|
||||||
fn new_inherited() -> VRPose {
|
fn new_inherited() -> VRPose {
|
||||||
VRPose {
|
VRPose {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
position: DOMRefCell::new(Heap::default()),
|
position: Heap::default(),
|
||||||
orientation: DOMRefCell::new(Heap::default()),
|
orientation: Heap::default(),
|
||||||
linear_vel: DOMRefCell::new(Heap::default()),
|
linear_vel: Heap::default(),
|
||||||
angular_vel: DOMRefCell::new(Heap::default()),
|
angular_vel: Heap::default(),
|
||||||
linear_acc: DOMRefCell::new(Heap::default()),
|
linear_acc: Heap::default(),
|
||||||
angular_acc: DOMRefCell::new(Heap::default())
|
angular_acc: Heap::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue