aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2016-12-06 12:30:09 -1000
committerAnthony Ramine <n.oxyde@gmail.com>2016-12-06 13:15:16 -1000
commitf20361179ddf2bd008e6ba29196a07663434018c (patch)
tree2566504e8f7628cc4dffd8bfdfc0898ee70ab504 /components
parent291a131dd8c73e4cc00044ce1f4cc93eb9b0a501 (diff)
downloadservo-f20361179ddf2bd008e6ba29196a07663434018c.tar.gz
servo-f20361179ddf2bd008e6ba29196a07663434018c.zip
Remove generics from unsafe_no_jsmanaged_fields
Diffstat (limited to 'components')
-rw-r--r--components/script/dom/bindings/trace.rs166
-rw-r--r--components/script/dom/bindings/weakref.rs6
-rw-r--r--components/script/dom/macros.rs18
3 files changed, 160 insertions, 30 deletions
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<T: JSTraceable> JSTraceable for Rc<T> {
}
}
+unsafe impl<T: JSTraceable> JSTraceable for Arc<T> {
+ unsafe fn trace(&self, trc: *mut JSTracer) {
+ (**self).trace(trc)
+ }
+}
+
unsafe impl<T: JSTraceable + ?Sized> JSTraceable for Box<T> {
unsafe fn trace(&self, trc: *mut JSTracer) {
(**self).trace(trc)
@@ -311,17 +323,10 @@ unsafe impl<A: JSTraceable, B: JSTraceable, C: JSTraceable> 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<T>);
-unsafe_no_jsmanaged_fields!(Receiver<T>);
-unsafe_no_jsmanaged_fields!(Point2D<T>);
-unsafe_no_jsmanaged_fields!(Rect<T>);
-unsafe_no_jsmanaged_fields!(Size2D<T>);
-unsafe_no_jsmanaged_fields!(Arc<T>);
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<T: Reflectable>);
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<Unit, T>);
-unsafe_no_jsmanaged_fields!(Matrix2D<T>);
-unsafe_no_jsmanaged_fields!(Matrix4D<T>);
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<T> JSTraceable for IpcReceiver<T> where T: Deserialize + Serialize {
}
}
+unsafe impl<T: Reflectable> JSTraceable for Trusted<T> {
+ #[inline]
+ unsafe fn trace(&self, _: *mut JSTracer) {
+ // Do nothing
+ }
+}
+
+unsafe impl<T: Send> JSTraceable for Receiver<T> {
+ #[inline]
+ unsafe fn trace(&self, _: *mut JSTracer) {
+ // Do nothing
+ }
+}
+
+unsafe impl<T: Send> JSTraceable for Sender<T> {
+ #[inline]
+ unsafe fn trace(&self, _: *mut JSTracer) {
+ // Do nothing
+ }
+}
+
+unsafe impl JSTraceable for Matrix2D<f32> {
+ #[inline]
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing
+ }
+}
+
+unsafe impl JSTraceable for Matrix4D<f64> {
+ #[inline]
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing
+ }
+}
+
+unsafe impl JSTraceable for Point2D<f32> {
+ #[inline]
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing
+ }
+}
+
+unsafe impl<T> JSTraceable for EuclidLength<u64, T> {
+ #[inline]
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing
+ }
+}
+
+unsafe impl JSTraceable for Rect<Au> {
+ #[inline]
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing
+ }
+}
+
+unsafe impl JSTraceable for Rect<f32> {
+ #[inline]
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing
+ }
+}
+
+unsafe impl JSTraceable for Size2D<i32> {
+ #[inline]
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing
+ }
+}
+
+unsafe impl JSTraceable for Mutex<Option<SharedRt>> {
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing.
+ }
+}
+
+unsafe impl JSTraceable for RwLock<FontFaceRule> {
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing.
+ }
+}
+
+unsafe impl JSTraceable for RwLock<CssRules> {
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing.
+ }
+}
+
+unsafe impl JSTraceable for RwLock<Keyframe> {
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing.
+ }
+}
+
+unsafe impl JSTraceable for RwLock<KeyframesRule> {
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing.
+ }
+}
+
+unsafe impl JSTraceable for RwLock<MediaRule> {
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing.
+ }
+}
+
+unsafe impl JSTraceable for RwLock<NamespaceRule> {
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing.
+ }
+}
+
+unsafe impl JSTraceable for RwLock<StyleRule> {
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing.
+ }
+}
+
+unsafe impl JSTraceable for RwLock<ViewportRule> {
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing.
+ }
+}
+
+unsafe impl JSTraceable for RwLock<PropertyDeclarationBlock> {
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing.
+ }
+}
+
+unsafe impl JSTraceable for RwLock<SharedRt> {
+ unsafe fn trace(&self, _trc: *mut JSTracer) {
+ // Do nothing.
+ }
+}
+
+unsafe impl JSTraceable for RwLock<MediaList> {
+ 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<T: WeakReferenceable> PartialEq<T> for WeakRef<T> {
}
}
-unsafe_no_jsmanaged_fields!(WeakRef<T: WeakReferenceable>);
+unsafe impl<T: WeakReferenceable> JSTraceable for WeakRef<T> {
+ unsafe fn trace(&self, _: *mut JSTracer) {
+ // Do nothing.
+ }
+}
impl<T: WeakReferenceable> Drop for WeakRef<T> {
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.