mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Replace NonNullJSObjectPtr with std::ptr::NonNull<JSObject>
This commit is contained in:
parent
897a5b39c5
commit
52eda6082f
22 changed files with 79 additions and 111 deletions
|
@ -9,7 +9,6 @@
|
|||
use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyAndValueResult;
|
||||
use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyOrValueResult;
|
||||
use dom::bindings::error::Fallible;
|
||||
use dom::bindings::nonnull::NonNullJSObjectPtr;
|
||||
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
||||
use dom::bindings::root::{Dom, DomRoot};
|
||||
use dom::bindings::trace::JSTraceable;
|
||||
|
@ -20,6 +19,7 @@ use js::jsapi::{HandleValue, Heap, JSContext, MutableHandleObject, JSObject};
|
|||
use js::jsval::UndefinedValue;
|
||||
use std::cell::Cell;
|
||||
use std::ptr;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
/// The values that an iterator will iterate over.
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
|
@ -73,7 +73,7 @@ impl<T: DomObject + JSTraceable + Iterable> IterableIterator<T> {
|
|||
|
||||
/// Return the next value from the iterable object.
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Next(&self, cx: *mut JSContext) -> Fallible<NonNullJSObjectPtr> {
|
||||
pub fn Next(&self, cx: *mut JSContext) -> Fallible<NonNull<JSObject>> {
|
||||
let index = self.index.get();
|
||||
rooted!(in(cx) let mut value = UndefinedValue());
|
||||
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
|
||||
|
@ -106,7 +106,7 @@ impl<T: DomObject + JSTraceable + Iterable> IterableIterator<T> {
|
|||
self.index.set(index + 1);
|
||||
result.map(|_| {
|
||||
assert!(!rval.is_null());
|
||||
unsafe { NonNullJSObjectPtr::new_unchecked(rval.get()) }
|
||||
unsafe { NonNull::new_unchecked(rval.get()) }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue