/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![deny(unsafe_code)]
usecrate::properties::PropertyDeclarationBlock; usecrate::shared_lock::{Locked, SharedRwLockReadGuard}; use servo_arc::Arc; use std::io::Write; use std::ptr;
/// A style source for the rule node. It is a declaration block that may come from either a style /// rule or a standalone block like animations / transitions / smil / preshints / style attr... /// /// Keeping the style rule around would provide more debugability, but also causes more /// pointer-chasing in the common code-path, which is undesired. If needed, we could keep it around /// in debug builds or something along those lines. #[derive(Clone, Debug)] pubstruct StyleSource(Arc<Locked<PropertyDeclarationBlock>>);
/// Read the style source guard, and obtain thus read access to the /// underlying property declaration block. #[inline] pubfn read<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> &'span>a PropertyDeclarationBlock { self.0.read_with(guard)
}
/// Returns the declaration block if applicable, otherwise None. #[inline] pubfn get(&self) -> &Arc<Locked<PropertyDeclarationBlock>> {
&self.0
}
/// Marks this block as part of the rule tree. #[inline] pubfn mark_in_rule_tree(&self) { use std::sync::atomic::Ordering; ifself.0.is_static() { // For static pointers, it doesn't matter whether we might be in the rule tree or not, // because those are not mutable. return;
} // SAFETY: We're only accessing a relaxed atomic inside the locked object, which we know // is alive. In theory, we could/should track that boolean outside of the // Locked<PropertyDeclarationBlock>, but that is kind of a PITA. #[allow(unsafe_code)] unsafe { self.0
.read_unchecked()
.immutable
.store(true, Ordering::Relaxed);
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.