diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 766556efd16..6da8e9a1c5f 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -29,6 +29,7 @@ //! The `unsafe_no_jsmanaged_fields!()` macro adds an empty implementation of //! `JSTraceable` to a datatype. +use app_units::Au; use canvas_traits::{CanvasGradientStop, LinearGradientStyle, RadialGradientStyle}; use canvas_traits::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle}; use cssparser::RGBA; @@ -69,6 +70,7 @@ use net_traits::response::{Response, ResponseBody}; use net_traits::response::HttpsState; use net_traits::storage_thread::StorageType; use offscreen_gl_context::GLLimits; +use parking_lot::RwLock; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; use script_layout_interface::OpaqueStyleAndLayoutData; @@ -86,16 +88,20 @@ use std::hash::{BuildHasher, Hash}; use std::ops::{Deref, DerefMut}; use std::path::PathBuf; use std::rc::Rc; -use std::sync::Arc; +use std::sync::{Arc, Mutex}; use std::sync::atomic::{AtomicBool, AtomicUsize}; use std::sync::mpsc::{Receiver, Sender}; use std::time::{SystemTime, Instant}; use style::attr::{AttrIdentifier, AttrValue, LengthOrPercentageOrAuto}; use style::element_state::*; +use style::font_face::FontFaceRule; +use style::keyframes::Keyframe; use style::media_queries::MediaList; use style::properties::PropertyDeclarationBlock; use style::selector_parser::{PseudoElement, Snapshot}; +use style::stylesheets::{CssRules, KeyframesRule, MediaRule, NamespaceRule, StyleRule}; use style::values::specified::Length; +use style::viewport::ViewportRule; use time::Duration; use url::Origin as UrlOrigin; use uuid::Uuid; @@ -157,6 +163,12 @@ unsafe impl JSTraceable for Rc { } } +unsafe impl JSTraceable for Arc { + unsafe fn trace(&self, trc: *mut JSTracer) { + (**self).trace(trc) + } +} + unsafe impl JSTraceable for Box { unsafe fn trace(&self, trc: *mut JSTracer) { (**self).trace(trc) @@ -311,17 +323,10 @@ unsafe impl JSTraceable for (A, unsafe_no_jsmanaged_fields!(bool, f32, f64, String, ServoUrl, AtomicBool, AtomicUsize, UrlOrigin, Uuid, char); unsafe_no_jsmanaged_fields!(usize, u8, u16, u32, u64); unsafe_no_jsmanaged_fields!(isize, i8, i16, i32, i64); -unsafe_no_jsmanaged_fields!(Sender); -unsafe_no_jsmanaged_fields!(Receiver); -unsafe_no_jsmanaged_fields!(Point2D); -unsafe_no_jsmanaged_fields!(Rect); -unsafe_no_jsmanaged_fields!(Size2D); -unsafe_no_jsmanaged_fields!(Arc); unsafe_no_jsmanaged_fields!(Image, ImageMetadata, ImageCacheChan, ImageCacheThread); unsafe_no_jsmanaged_fields!(Metadata); unsafe_no_jsmanaged_fields!(NetworkError); unsafe_no_jsmanaged_fields!(Atom, Prefix, LocalName, Namespace, QualName); -unsafe_no_jsmanaged_fields!(Trusted); unsafe_no_jsmanaged_fields!(TrustedPromise); unsafe_no_jsmanaged_fields!(PropertyDeclarationBlock); // These three are interdependent, if you plan to put jsmanaged data @@ -337,9 +342,6 @@ unsafe_no_jsmanaged_fields!(WindowProxyHandler); unsafe_no_jsmanaged_fields!(UntrustedNodeAddress); unsafe_no_jsmanaged_fields!(LengthOrPercentageOrAuto); unsafe_no_jsmanaged_fields!(RGBA); -unsafe_no_jsmanaged_fields!(EuclidLength); -unsafe_no_jsmanaged_fields!(Matrix2D); -unsafe_no_jsmanaged_fields!(Matrix4D); unsafe_no_jsmanaged_fields!(StorageType); unsafe_no_jsmanaged_fields!(CanvasGradientStop, LinearGradientStyle, RadialGradientStyle); unsafe_no_jsmanaged_fields!(LineCapStyle, LineJoinStyle, CompositionOrBlending); @@ -424,6 +426,148 @@ unsafe impl JSTraceable for IpcReceiver where T: Deserialize + Serialize { } } +unsafe impl JSTraceable for Trusted { + #[inline] + unsafe fn trace(&self, _: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl JSTraceable for Receiver { + #[inline] + unsafe fn trace(&self, _: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl JSTraceable for Sender { + #[inline] + unsafe fn trace(&self, _: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl JSTraceable for Matrix2D { + #[inline] + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl JSTraceable for Matrix4D { + #[inline] + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl JSTraceable for Point2D { + #[inline] + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl JSTraceable for EuclidLength { + #[inline] + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl JSTraceable for Rect { + #[inline] + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl JSTraceable for Rect { + #[inline] + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl JSTraceable for Size2D { + #[inline] + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl JSTraceable for Mutex> { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + +unsafe impl JSTraceable for RwLock { + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing. + } +} + /// Homemade trait object for JSTraceable things struct TraceableInfo { pub ptr: *const libc::c_void, diff --git a/components/script/dom/bindings/weakref.rs b/components/script/dom/bindings/weakref.rs index 2018c0f9a72..68feff79180 100644 --- a/components/script/dom/bindings/weakref.rs +++ b/components/script/dom/bindings/weakref.rs @@ -133,7 +133,11 @@ impl PartialEq for WeakRef { } } -unsafe_no_jsmanaged_fields!(WeakRef); +unsafe impl JSTraceable for WeakRef { + unsafe fn trace(&self, _: *mut JSTracer) { + // Do nothing. + } +} impl Drop for WeakRef { fn drop(&mut self) { diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index bb5a55bcc54..2eab30d3fd0 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -323,24 +323,6 @@ macro_rules! unsafe_no_jsmanaged_fields( } )+ ); - ($ty:ident<$($gen:ident),+>) => ( - #[allow(unsafe_code)] - unsafe impl<$($gen),+> $crate::dom::bindings::trace::JSTraceable for $ty<$($gen),+> { - #[inline] - unsafe fn trace(&self, _: *mut ::js::jsapi::JSTracer) { - // Do nothing - } - } - ); - ($ty:ident<$($gen:ident: $bound:ident),+>) => ( - #[allow(unsafe_code)] - unsafe impl<$($gen: $bound),+> $crate::dom::bindings::trace::JSTraceable for $ty<$($gen),+> { - #[inline] - unsafe fn trace(&self, _: *mut ::js::jsapi::JSTracer) { - // Do nothing - } - } - ); ); /// These are used to generate a event handler which has no special case.