No tracing of nop traceable fields (#29926)

* Add `no_trace` option to JSTraceable derive

* NoTrace wrapper

* Port some types to no_trace schematics

* Fixing my unsafe mistakes (not tracing traceables)

* Add docs & safety guards for no_trace

Safety guards (trait shenanigans) guarantees safety usage of `no_trace`

* Port canvas_traits to no_trace

* Port servo_media to no_trace

* Port net_traits to no_trace

* Port style to no_trace

* Port webgpu to no_trace

* Port script_traits to no_trace

* Port canvas_traits, devtools_traits, embedder_traits, profile_traits to no_trace

* unrooted_must_root lint in seperate file

* Add trace_in_no_trace_lint as script_plugin

* Composable types in must_not_have_traceable

* Introduced HashMapTracedValues wrapper

* `HashMap<NoTrace<K>,V>`->`HashMapTracedValues<K,V>`

* Port rest of servo's types to no_trace

* Port html5ever, euclid, mime and http to no_trace

* Port remaining externals to no_trace

* Port webxr and Arc<Mutex<_>>

* Fix spelling in notrace doc
This commit is contained in:
Samson 2023-08-04 12:17:43 +02:00 committed by GitHub
parent 66e0d543cf
commit 9514f670d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
167 changed files with 1903 additions and 1020 deletions

View file

@ -16,7 +16,7 @@ use std::fmt;
use std::result::Result;
#[derive(JSTraceable)]
pub struct DOMManipulationTaskSource(pub Box<dyn ScriptChan + Send>, pub PipelineId);
pub struct DOMManipulationTaskSource(pub Box<dyn ScriptChan + Send>, #[no_trace] pub PipelineId);
impl Clone for DOMManipulationTaskSource {
fn clone(&self) -> DOMManipulationTaskSource {

View file

@ -10,7 +10,10 @@ use crate::task_source::{TaskSource, TaskSourceName};
use msg::constellation_msg::PipelineId;
#[derive(JSTraceable)]
pub struct FileReadingTaskSource(pub Box<dyn ScriptChan + Send + 'static>, pub PipelineId);
pub struct FileReadingTaskSource(
pub Box<dyn ScriptChan + Send + 'static>,
#[no_trace] pub PipelineId,
);
impl Clone for FileReadingTaskSource {
fn clone(&self) -> FileReadingTaskSource {

View file

@ -10,7 +10,10 @@ use crossbeam_channel::Sender;
use msg::constellation_msg::PipelineId;
#[derive(Clone, JSTraceable)]
pub struct HistoryTraversalTaskSource(pub Sender<MainThreadScriptMsg>, pub PipelineId);
pub struct HistoryTraversalTaskSource(
#[no_trace] pub Sender<MainThreadScriptMsg>,
#[no_trace] pub PipelineId,
);
impl TaskSource for HistoryTraversalTaskSource {
const NAME: TaskSourceName = TaskSourceName::HistoryTraversal;

View file

@ -18,7 +18,10 @@ use std::fmt;
use std::result::Result;
#[derive(Clone, JSTraceable)]
pub struct MediaElementTaskSource(pub Sender<MainThreadScriptMsg>, pub PipelineId);
pub struct MediaElementTaskSource(
#[no_trace] pub Sender<MainThreadScriptMsg>,
#[no_trace] pub PipelineId,
);
impl fmt::Debug for MediaElementTaskSource {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View file

@ -8,7 +8,10 @@ use crate::task_source::{TaskSource, TaskSourceName};
use msg::constellation_msg::PipelineId;
#[derive(JSTraceable)]
pub struct NetworkingTaskSource(pub Box<dyn ScriptChan + Send + 'static>, pub PipelineId);
pub struct NetworkingTaskSource(
pub Box<dyn ScriptChan + Send + 'static>,
#[no_trace] pub PipelineId,
);
impl Clone for NetworkingTaskSource {
fn clone(&self) -> NetworkingTaskSource {

View file

@ -16,7 +16,10 @@ use std::fmt;
use std::result::Result;
#[derive(JSTraceable)]
pub struct PerformanceTimelineTaskSource(pub Box<dyn ScriptChan + Send + 'static>, pub PipelineId);
pub struct PerformanceTimelineTaskSource(
pub Box<dyn ScriptChan + Send + 'static>,
#[no_trace] pub PipelineId,
);
impl Clone for PerformanceTimelineTaskSource {
fn clone(&self) -> PerformanceTimelineTaskSource {

View file

@ -9,7 +9,10 @@ use msg::constellation_msg::PipelineId;
use std::fmt;
#[derive(JSTraceable)]
pub struct PortMessageQueue(pub Box<dyn ScriptChan + Send + 'static>, pub PipelineId);
pub struct PortMessageQueue(
pub Box<dyn ScriptChan + Send + 'static>,
#[no_trace] pub PipelineId,
);
impl Clone for PortMessageQueue {
fn clone(&self) -> PortMessageQueue {

View file

@ -8,7 +8,10 @@ use crate::task_source::{TaskSource, TaskSourceName};
use msg::constellation_msg::PipelineId;
#[derive(JSTraceable)]
pub struct RemoteEventTaskSource(pub Box<dyn ScriptChan + Send + 'static>, pub PipelineId);
pub struct RemoteEventTaskSource(
pub Box<dyn ScriptChan + Send + 'static>,
#[no_trace] pub PipelineId,
);
impl Clone for RemoteEventTaskSource {
fn clone(&self) -> RemoteEventTaskSource {

View file

@ -10,7 +10,10 @@ use std::fmt;
#[derive(JSTraceable)]
/// https://html.spec.whatwg.org/multipage/#timer-task-source
pub struct TimerTaskSource(pub Box<dyn ScriptChan + Send + 'static>, pub PipelineId);
pub struct TimerTaskSource(
pub Box<dyn ScriptChan + Send + 'static>,
#[no_trace] pub PipelineId,
);
impl Clone for TimerTaskSource {
fn clone(&self) -> TimerTaskSource {

View file

@ -18,7 +18,10 @@ use std::fmt;
use std::result::Result;
#[derive(Clone, JSTraceable)]
pub struct UserInteractionTaskSource(pub Sender<MainThreadScriptMsg>, pub PipelineId);
pub struct UserInteractionTaskSource(
#[no_trace] pub Sender<MainThreadScriptMsg>,
#[no_trace] pub PipelineId,
);
impl fmt::Debug for UserInteractionTaskSource {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View file

@ -8,7 +8,10 @@ use crate::task_source::{TaskSource, TaskSourceName};
use msg::constellation_msg::PipelineId;
#[derive(JSTraceable)]
pub struct WebsocketTaskSource(pub Box<dyn ScriptChan + Send + 'static>, pub PipelineId);
pub struct WebsocketTaskSource(
pub Box<dyn ScriptChan + Send + 'static>,
#[no_trace] pub PipelineId,
);
impl Clone for WebsocketTaskSource {
fn clone(&self) -> WebsocketTaskSource {