diff options
author | Josh Matthews <josh@joshmatthews.net> | 2025-01-18 16:36:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-18 21:36:15 +0000 |
commit | 875e3870049d2523ec349724d692a11665562d40 (patch) | |
tree | 22f6c6bc078bdb1f44567d4bc99d9b0450986309 /components/script/dom/bindings/refcounted.rs | |
parent | 1bd34a578117fdefb8ec20e5cbe49b38dd466c5b (diff) | |
download | servo-875e3870049d2523ec349724d692a11665562d40.tar.gz servo-875e3870049d2523ec349724d692a11665562d40.zip |
script: Feature-gate all crown support. (#35055)
* script: Feature-gate all crown support.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Use cfg(crown) instead of a cargo feature.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/script/dom/bindings/refcounted.rs')
-rw-r--r-- | components/script/dom/bindings/refcounted.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index d3f55012534..f0da94443db 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -83,7 +83,7 @@ impl TrustedPromise { /// Create a new `TrustedPromise` instance from an existing DOM object. The object will /// be prevented from being GCed for the duration of the resulting `TrustedPromise` object's /// lifetime. - #[allow(crown::unrooted_must_root)] + #[cfg_attr(crown, allow(crown::unrooted_must_root))] pub(crate) fn new(promise: Rc<Promise>) -> TrustedPromise { LIVE_REFERENCES.with(|r| { let r = r.borrow(); @@ -133,7 +133,7 @@ impl TrustedPromise { } /// A task which will reject the promise. - #[allow(crown::unrooted_must_root)] + #[cfg_attr(crown, allow(crown::unrooted_must_root))] pub(crate) fn reject_task(self, error: Error) -> impl TaskOnce { let this = self; task!(reject_promise: move || { @@ -143,7 +143,7 @@ impl TrustedPromise { } /// A task which will resolve the promise. - #[allow(crown::unrooted_must_root)] + #[cfg_attr(crown, allow(crown::unrooted_must_root))] pub(crate) fn resolve_task<T>(self, value: T) -> impl TaskOnce where T: ToJSValConvertible + Send, @@ -160,7 +160,7 @@ impl TrustedPromise { /// shared among threads for use in asynchronous operations. The underlying /// DOM object is guaranteed to live at least as long as the last outstanding /// `Trusted<T>` instance. -#[crown::unrooted_must_root_lint::allow_unrooted_interior] +#[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_interior)] #[derive(MallocSizeOf)] pub(crate) struct Trusted<T: DomObject> { /// A pointer to the Rust DOM object of type T, but void to allow @@ -226,7 +226,7 @@ impl<T: DomObject> Clone for Trusted<T> { /// The set of live, pinned DOM objects that are currently prevented /// from being garbage collected due to outstanding references. -#[allow(crown::unrooted_must_root)] +#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub(crate) struct LiveDOMReferences { // keyed on pointer to Rust DOM object reflectable_table: RefCell<HashMap<*const libc::c_void, Weak<TrustedReference>>>, @@ -250,7 +250,7 @@ impl LiveDOMReferences { }); } - #[allow(crown::unrooted_must_root)] + #[cfg_attr(crown, allow(crown::unrooted_must_root))] fn addref_promise(&self, promise: Rc<Promise>) { let mut table = self.promise_table.borrow_mut(); table.entry(&*promise).or_default().push(promise) @@ -301,7 +301,7 @@ fn remove_nulls<K: Eq + Hash + Clone, V>(table: &mut HashMap<K, Weak<V>>) { } /// A JSTraceDataOp for tracing reflectors held in LIVE_REFERENCES -#[allow(crown::unrooted_must_root)] +#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub(crate) unsafe fn trace_refcounted_objects(tracer: *mut JSTracer) { trace!("tracing live refcounted references"); LIVE_REFERENCES.with(|r| { |