Prevent moving CanGc values between threads/tasks (#33902)

* Make CanGc non-sendable, and add documentation.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Update CanGc usage to fix usages that were moved between threads/tasks.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2024-10-18 13:26:54 -04:00 committed by GitHub
parent a58da5aa83
commit b85093ad74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 69 additions and 89 deletions

View file

@ -333,7 +333,6 @@ impl DedicatedWorkerGlobalScope {
gpu_id_hub: Arc<IdentityHub>,
control_receiver: Receiver<DedicatedWorkerControlMsg>,
context_sender: Sender<ThreadSafeJSContext>,
can_gc: CanGc,
) -> JoinHandle<()> {
let serialized_worker_url = worker_url.to_string();
let top_level_browsing_context_id = TopLevelBrowsingContextId::installed();
@ -479,7 +478,7 @@ impl DedicatedWorkerGlobalScope {
// until the event loop is destroyed,
// which happens after the closing flag is set to true.
while !scope.is_closing() {
run_worker_event_loop(&*global, Some(&worker), can_gc);
run_worker_event_loop(&*global, Some(&worker), CanGc::note());
}
},
reporter_name,