mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
script: Use ScriptEventLoopSender for Runtime event loop callbacks (#40590)
Instead of using a task source for SpiderMonkey runtime callbacks, use a `ScriptEventLoopSender`. Task sources are associated with a particular Pipeline, but the runtime callback is run indepenently of any particular Pipeline and could theoretically happen when no Pipeline exists at all. This reduces the dependency of the `ScriptThread` on the existence of the first Pipeline. Testing: This should not change observable behavior, so is covered by existing tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
@@ -154,7 +154,6 @@ use crate::script_runtime::{
|
||||
};
|
||||
use crate::script_window_proxies::ScriptWindowProxies;
|
||||
use crate::task_queue::TaskQueue;
|
||||
use crate::task_source::{SendableTaskSource, TaskSourceName};
|
||||
use crate::webdriver_handlers::jsval_to_webdriver;
|
||||
use crate::{devtools, webdriver_handlers};
|
||||
|
||||
@@ -844,14 +843,9 @@ impl ScriptThread {
|
||||
pipeline_id: PipelineId,
|
||||
) -> ScriptThread {
|
||||
let (self_sender, self_receiver) = unbounded();
|
||||
let mut runtime = Runtime::new(Some(SendableTaskSource {
|
||||
sender: ScriptEventLoopSender::MainThread(self_sender.clone()),
|
||||
// TODO: We shouldn't rely on this Pipeline as a ScriptThread can have multiple
|
||||
// Pipelines and any of them might disappear at any time.
|
||||
pipeline_id,
|
||||
name: TaskSourceName::Networking,
|
||||
canceller: Default::default(),
|
||||
}));
|
||||
let mut runtime =
|
||||
Runtime::new(Some(ScriptEventLoopSender::MainThread(self_sender.clone())));
|
||||
|
||||
let cx = runtime.cx();
|
||||
|
||||
unsafe {
|
||||
|
||||
Reference in New Issue
Block a user