mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
auto merge of #3773 : rclanan/servo/rename-untraceable, r=jdm
This commit is contained in:
commit
041ab13fce
6 changed files with 26 additions and 26 deletions
|
@ -17,7 +17,7 @@ The outline is:
|
||||||
This is typically derived via a #[jstraceable] annotation.
|
This is typically derived via a #[jstraceable] annotation.
|
||||||
3. For all fields, `Foo::trace()`
|
3. For all fields, `Foo::trace()`
|
||||||
calls `trace()` on the field. For example, for fields of type `JS<T>`, `JS<T>::trace()` calls
|
calls `trace()` on the field. For example, for fields of type `JS<T>`, `JS<T>::trace()` calls
|
||||||
`trace_reflector()`. Non-JS-managed types have an empty inline `trace()` method, achieved via `untraceable!` or similar.
|
`trace_reflector()`. Non-JS-managed types have an empty inline `trace()` method, achieved via `no_jsmanaged_fields!` or similar.
|
||||||
4. `trace_reflector()` fetches the reflector that is reachable from a Rust object and notifies it to the GC using JSTracer.
|
4. `trace_reflector()` fetches the reflector that is reachable from a Rust object and notifies it to the GC using JSTracer.
|
||||||
5. This operation continues for the rest of the graph.
|
5. This operation continues for the rest of the graph.
|
||||||
6. Finally, the GC checks whether the Rust object lives or not from `JSObject`s which are held by Rust object.
|
6. Finally, the GC checks whether the Rust object lives or not from `JSObject`s which are held by Rust object.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
//! 5. `trace_object()` calls `JS_CallTracer()` to notify the GC, which will
|
//! 5. `trace_object()` calls `JS_CallTracer()` to notify the GC, which will
|
||||||
//! add the object to the graph, and will trace that object as well.
|
//! add the object to the graph, and will trace that object as well.
|
||||||
//!
|
//!
|
||||||
//! The untraceable!() macro adds an empty implementation of JSTraceable to
|
//! The no_jsmanaged_fields!() macro adds an empty implementation of JSTraceable to
|
||||||
//! a datatype.
|
//! a datatype.
|
||||||
|
|
||||||
use dom::bindings::js::JS;
|
use dom::bindings::js::JS;
|
||||||
|
@ -64,7 +64,7 @@ impl<T: Reflectable> JSTraceable for JS<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
untraceable!(Reflector)
|
no_jsmanaged_fields!(Reflector)
|
||||||
|
|
||||||
/// A trait to allow tracing (only) DOM objects.
|
/// A trait to allow tracing (only) DOM objects.
|
||||||
pub trait JSTraceable {
|
pub trait JSTraceable {
|
||||||
|
@ -142,7 +142,7 @@ impl JSTraceable for JSVal {
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXXManishearth Check if the following three are optimized to no-ops
|
// XXXManishearth Check if the following three are optimized to no-ops
|
||||||
// if e.trace() is a no-op (e.g it is an untraceable type)
|
// if e.trace() is a no-op (e.g it is an no_jsmanaged_fields type)
|
||||||
impl<T: JSTraceable> JSTraceable for Vec<T> {
|
impl<T: JSTraceable> JSTraceable for Vec<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn trace(&self, trc: *mut JSTracer) {
|
fn trace(&self, trc: *mut JSTracer) {
|
||||||
|
@ -153,7 +153,7 @@ impl<T: JSTraceable> JSTraceable for Vec<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXXManishearth Check if the following three are optimized to no-ops
|
// XXXManishearth Check if the following three are optimized to no-ops
|
||||||
// if e.trace() is a no-op (e.g it is an untraceable type)
|
// if e.trace() is a no-op (e.g it is an no_jsmanaged_fields type)
|
||||||
impl<T: JSTraceable + 'static> JSTraceable for SmallVec1<T> {
|
impl<T: JSTraceable + 'static> JSTraceable for SmallVec1<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn trace(&self, trc: *mut JSTracer) {
|
fn trace(&self, trc: *mut JSTracer) {
|
||||||
|
@ -190,25 +190,25 @@ impl<A: JSTraceable, B: JSTraceable> JSTraceable for (A, B) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
untraceable!(bool, f32, f64, String, Url)
|
no_jsmanaged_fields!(bool, f32, f64, String, Url)
|
||||||
untraceable!(uint, u8, u16, u32, u64)
|
no_jsmanaged_fields!(uint, u8, u16, u32, u64)
|
||||||
untraceable!(int, i8, i16, i32, i64)
|
no_jsmanaged_fields!(int, i8, i16, i32, i64)
|
||||||
untraceable!(Sender<T>)
|
no_jsmanaged_fields!(Sender<T>)
|
||||||
untraceable!(Receiver<T>)
|
no_jsmanaged_fields!(Receiver<T>)
|
||||||
untraceable!(ImageCacheTask, ScriptControlChan)
|
no_jsmanaged_fields!(ImageCacheTask, ScriptControlChan)
|
||||||
untraceable!(Atom, Namespace, Timer)
|
no_jsmanaged_fields!(Atom, Namespace, Timer)
|
||||||
untraceable!(PropertyDeclarationBlock)
|
no_jsmanaged_fields!(PropertyDeclarationBlock)
|
||||||
// These three are interdependent, if you plan to put jsmanaged data
|
// These three are interdependent, if you plan to put jsmanaged data
|
||||||
// in one of these make sure it is propagated properly to containing structs
|
// in one of these make sure it is propagated properly to containing structs
|
||||||
untraceable!(SubpageId, WindowSizeData, PipelineId)
|
no_jsmanaged_fields!(SubpageId, WindowSizeData, PipelineId)
|
||||||
untraceable!(QuirksMode)
|
no_jsmanaged_fields!(QuirksMode)
|
||||||
untraceable!(Cx)
|
no_jsmanaged_fields!(Cx)
|
||||||
untraceable!(ResponseHeaderCollection, RequestHeaderCollection, Method)
|
no_jsmanaged_fields!(ResponseHeaderCollection, RequestHeaderCollection, Method)
|
||||||
untraceable!(ConstellationChan)
|
no_jsmanaged_fields!(ConstellationChan)
|
||||||
untraceable!(LayoutChan)
|
no_jsmanaged_fields!(LayoutChan)
|
||||||
untraceable!(WindowProxyHandler)
|
no_jsmanaged_fields!(WindowProxyHandler)
|
||||||
untraceable!(UntrustedNodeAddress)
|
no_jsmanaged_fields!(UntrustedNodeAddress)
|
||||||
untraceable!(LengthOrPercentageOrAuto)
|
no_jsmanaged_fields!(LengthOrPercentageOrAuto)
|
||||||
|
|
||||||
impl<'a> JSTraceable for &'a str {
|
impl<'a> JSTraceable for &'a str {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -164,7 +164,7 @@ macro_rules! make_uint_setter(
|
||||||
|
|
||||||
/// For use on non-jsmanaged types
|
/// For use on non-jsmanaged types
|
||||||
/// Use #[jstraceable] on JS managed types
|
/// Use #[jstraceable] on JS managed types
|
||||||
macro_rules! untraceable(
|
macro_rules! no_jsmanaged_fields(
|
||||||
($($ty:ident),+) => (
|
($($ty:ident),+) => (
|
||||||
$(
|
$(
|
||||||
impl JSTraceable for $ty {
|
impl JSTraceable for $ty {
|
||||||
|
|
|
@ -201,7 +201,7 @@ pub struct LayoutDataRef {
|
||||||
pub data_cell: RefCell<Option<LayoutData>>,
|
pub data_cell: RefCell<Option<LayoutData>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
untraceable!(LayoutDataRef)
|
no_jsmanaged_fields!(LayoutDataRef)
|
||||||
|
|
||||||
impl LayoutDataRef {
|
impl LayoutDataRef {
|
||||||
pub fn new() -> LayoutDataRef {
|
pub fn new() -> LayoutDataRef {
|
||||||
|
|
|
@ -29,7 +29,7 @@ use std::cell::Cell;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
pub struct TrustedWorkerAddress(pub *const c_void);
|
pub struct TrustedWorkerAddress(pub *const c_void);
|
||||||
untraceable!(TrustedWorkerAddress)
|
no_jsmanaged_fields!(TrustedWorkerAddress)
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct Worker {
|
pub struct Worker {
|
||||||
|
|
|
@ -113,7 +113,7 @@ pub enum ScriptMsg {
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct ScriptChan(pub Sender<ScriptMsg>);
|
pub struct ScriptChan(pub Sender<ScriptMsg>);
|
||||||
|
|
||||||
untraceable!(ScriptChan)
|
no_jsmanaged_fields!(ScriptChan)
|
||||||
|
|
||||||
impl ScriptChan {
|
impl ScriptChan {
|
||||||
/// Creates a new script chan.
|
/// Creates a new script chan.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue