mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
merge from master
This commit is contained in:
commit
6e774ea6eb
1044 changed files with 46059 additions and 1506 deletions
|
@ -2000,6 +2000,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, config):
|
|||
'dom::bindings::conversions::StringificationBehavior',
|
||||
'dom::bindings::error::throw_not_in_union',
|
||||
'dom::bindings::js::Root',
|
||||
'dom::bindings::str::USVString',
|
||||
'dom::types::*',
|
||||
'js::jsapi::JSContext',
|
||||
'js::jsapi::{HandleValue, MutableHandleValue}',
|
||||
|
@ -3492,6 +3493,9 @@ def getUnionTypeTemplateVars(type, descriptorProvider):
|
|||
elif type.isDOMString():
|
||||
name = type.name
|
||||
typeName = "DOMString"
|
||||
elif type.isUSVString():
|
||||
name = type.name
|
||||
typeName = "USVString"
|
||||
elif type.isPrimitive():
|
||||
name = type.name
|
||||
typeName = builtinNames[type.tag()]
|
||||
|
|
|
@ -230,8 +230,8 @@ impl GlobalField {
|
|||
/// Create a stack-bounded root for this reference.
|
||||
pub fn root(&self) -> GlobalRoot {
|
||||
match *self {
|
||||
GlobalField::Window(ref window) => GlobalRoot::Window(window.root()),
|
||||
GlobalField::Worker(ref worker) => GlobalRoot::Worker(worker.root()),
|
||||
GlobalField::Window(ref window) => GlobalRoot::Window(Root::from_ref(window)),
|
||||
GlobalField::Worker(ref worker) => GlobalRoot::Worker(Root::from_ref(worker)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,10 +74,6 @@ impl<T> JS<T> {
|
|||
}
|
||||
|
||||
impl<T: Reflectable> JS<T> {
|
||||
/// Root this JS-owned value to prevent its collection as garbage.
|
||||
pub fn root(&self) -> Root<T> {
|
||||
Root::new(self.ptr)
|
||||
}
|
||||
/// Create a JS<T> from a Root<T>
|
||||
/// XXX Not a great API. Should be a call on Root<T> instead
|
||||
#[allow(unrooted_must_root)]
|
||||
|
@ -292,7 +288,7 @@ impl<T: Reflectable> MutHeap<JS<T>> {
|
|||
pub fn get(&self) -> Root<T> {
|
||||
debug_assert!(task_state::get().is_script());
|
||||
unsafe {
|
||||
ptr::read(self.val.get()).root()
|
||||
Root::from_ref(&*ptr::read(self.val.get()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -370,7 +366,7 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
|
|||
pub fn get(&self) -> Option<Root<T>> {
|
||||
debug_assert!(task_state::get().is_script());
|
||||
unsafe {
|
||||
ptr::read(self.ptr.get()).map(|o| o.root())
|
||||
ptr::read(self.ptr.get()).map(|o| Root::from_ref(&*o))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! The `Finite<T>` struct.
|
||||
|
||||
use core::nonzero::Zeroable;
|
||||
use num::Float;
|
||||
use std::ops::Deref;
|
||||
|
||||
|
@ -12,8 +11,6 @@ use std::ops::Deref;
|
|||
#[derive(JSTraceable, Clone, Copy, Eq, PartialEq)]
|
||||
pub struct Finite<T: Float>(T);
|
||||
|
||||
unsafe impl<T: Float> Zeroable for Finite<T> {}
|
||||
|
||||
impl<T: Float> Finite<T> {
|
||||
/// Create a new `Finite<T: Float>` safely.
|
||||
pub fn new(value: T) -> Option<Finite<T>> {
|
||||
|
|
|
@ -63,10 +63,11 @@ use profile_traits::time::ProfilerChan as TimeProfilerChan;
|
|||
use script_task::ScriptChan;
|
||||
use script_traits::{TimerEventChan, TimerEventId, TimerSource, UntrustedNodeAddress};
|
||||
use selectors::parser::PseudoElement;
|
||||
use selectors::states::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use smallvec::SmallVec;
|
||||
use std::boxed::FnBox;
|
||||
use std::cell::{Cell, RefCell, UnsafeCell};
|
||||
use std::cell::{Cell, UnsafeCell};
|
||||
use std::collections::hash_state::HashState;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::ffi::CString;
|
||||
|
@ -139,12 +140,6 @@ pub fn trace_object(tracer: *mut JSTracer, description: &str, obj: &Heap<*mut JS
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: JSTraceable> JSTraceable for RefCell<T> {
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
self.borrow().trace(trc)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: JSTraceable> JSTraceable for Rc<T> {
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
(**self).trace(trc)
|
||||
|
@ -157,26 +152,6 @@ impl<T: JSTraceable> JSTraceable for Box<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: JSTraceable> JSTraceable for *const T {
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
if !self.is_null() {
|
||||
unsafe {
|
||||
(**self).trace(trc)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: JSTraceable> JSTraceable for *mut T {
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
if !self.is_null() {
|
||||
unsafe {
|
||||
(**self).trace(trc)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: JSTraceable + Copy> JSTraceable for Cell<T> {
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
self.get().trace(trc)
|
||||
|
@ -309,6 +284,7 @@ no_jsmanaged_fields!(TimeProfilerChan);
|
|||
no_jsmanaged_fields!(MemProfilerChan);
|
||||
no_jsmanaged_fields!(PseudoElement);
|
||||
no_jsmanaged_fields!(Length);
|
||||
no_jsmanaged_fields!(ElementState);
|
||||
|
||||
impl JSTraceable for Box<ScriptChan + Send> {
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue