mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
script: Move TaskManager
to GlobalScope
(#34827)
This is a simplification of the internal `TaskQueue` API that moves the `TaskManager` to the `GlobalScope` itself. In addition, the handling of cancellers is moved to the `TaskManager` as well. This means that no arguments other than the `task` are necessary for queueing tasks, which makes the API a lot easier to use and cleaner. `TaskSource` now also keeps a copy of the canceller with it, so that they always know the proper way to cancel any tasks queued on them. There is one complication here. The event loop `sender` for dedicated workers is constantly changing as it is set to `None` when not handling messages. This is because this sender keeps a handle to the main thread's `Worker` object, preventing garbage collection while any messages are still in flight or being handled. This change allows setting the `sender` on the `TaskManager` to `None` to allow proper garbabge collection. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
75a22cfe2e
commit
b2eda71952
54 changed files with 1060 additions and 1516 deletions
|
@ -399,8 +399,7 @@ unsafe extern "C" fn promise_rejection_tracker(
|
|||
);
|
||||
|
||||
event.upcast::<Event>().fire(&target, CanGc::note());
|
||||
}),
|
||||
global.upcast(),
|
||||
})
|
||||
).unwrap();
|
||||
},
|
||||
};
|
||||
|
@ -455,7 +454,7 @@ unsafe extern "C" fn content_security_policy_allows(
|
|||
global
|
||||
.task_manager()
|
||||
.dom_manipulation_task_source()
|
||||
.queue(task, &global)
|
||||
.queue(task)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
@ -529,8 +528,7 @@ pub fn notify_about_rejected_promises(global: &GlobalScope) {
|
|||
target.global().add_consumed_rejection(promise.reflector().get_jsobject().into_handle());
|
||||
}
|
||||
}
|
||||
}),
|
||||
global.upcast(),
|
||||
})
|
||||
).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue