diff options
author | Martin Robinson <mrobinson@igalia.com> | 2025-01-04 09:41:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-04 08:41:50 +0000 |
commit | b2eda71952f32c0e486c72ed881f472e59ad37c0 (patch) | |
tree | 281ac2c157d39859ebf9122d178d9c349f492a87 /components/script/dom/textcontrol.rs | |
parent | 75a22cfe2eb6c4822d5cda98e84cc88c1e4ce941 (diff) | |
download | servo-b2eda71952f32c0e486c72ed881f472e59ad37c0.tar.gz servo-b2eda71952f32c0e486c72ed881f472e59ad37c0.zip |
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>
Diffstat (limited to 'components/script/dom/textcontrol.rs')
-rw-r--r-- | components/script/dom/textcontrol.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/components/script/dom/textcontrol.rs b/components/script/dom/textcontrol.rs index 7e94e404d40..6fab849a17c 100644 --- a/components/script/dom/textcontrol.rs +++ b/components/script/dom/textcontrol.rs @@ -300,8 +300,8 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> { // Step 6 if textinput.selection_state() != original_selection_state { - let window = self.element.owner_window(); - window + self.element + .owner_window() .task_manager() .user_interaction_task_source() .queue_event( @@ -309,7 +309,6 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> { atom!("select"), EventBubbles::Bubbles, EventCancelable::NotCancelable, - &window, ); } |