[PR #10187] Allow ThrottledFunc to work on different types of dispatcher #27954

Closed
opened 2026-01-31 09:25:21 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/10187

State: closed
Merged: Yes


⚠️ targets #10051

Summary of the Pull Request

This updates our ThrottledFuncs to take a dispatcher parameter. This means that we can use the Windows::UI::Core::CoreDispatcher in the TermControl, where there's always a CoreDispatcher, and use a Windows::System::DispatcherQueue in ControlCore/ControlInteractivity. When running in-proc, these are always the same thing. However, out-of-proc, the core needs a dispatcher queue that's not tied to a UI thread (because the content proces doesn't have a UI thread!).

This lets us get rid of the output event, because we don't need to bubble that event out to the TermControl to let it throttle that update anymore.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

Fortunately, winrt::resume_foreground works the same on both a CoreDispatcher and a DispatcherQueue, so this wasn't too hard!

Validation Steps Performed

This was validated in dev/migrie/oop/the-whole-thing (or dev/migrie/oop/connection-factory, I forget which), and I made sure that it worked both in-proc and x-proc. Not only that, it wasn't any slower!This reverts commit 04b751faa7.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/10187 **State:** closed **Merged:** Yes --- #### ⚠️ targets #10051 ## Summary of the Pull Request This updates our `ThrottledFunc`s to take a dispatcher parameter. This means that we can use the `Windows::UI::Core::CoreDispatcher` in the `TermControl`, where there's always a `CoreDispatcher`, and use a `Windows::System::DispatcherQueue` in `ControlCore`/`ControlInteractivity`. When running in-proc, these are always the _same thing_. However, out-of-proc, the core needs a dispatcher queue that's not tied to a UI thread (because the content proces _doesn't have a UI thread!_). This lets us get rid of the output event, because we don't need to bubble that event out to the `TermControl` to let it throttle that update anymore. ## References * Tear-out: #1256 * Megathread: #5000 * Project: https://github.com/microsoft/terminal/projects/5 ## PR Checklist * [x] This is a part of #1256 * [x] I work here * [n/a] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments Fortunately, `winrt::resume_foreground` works the same on both a `CoreDispatcher` and a `DispatcherQueue`, so this wasn't too hard! ## Validation Steps Performed This was validated in `dev/migrie/oop/the-whole-thing` (or `dev/migrie/oop/connection-factory`, I forget which), and I made sure that it worked both in-proc and x-proc. Not only that, _it wasn't any slower_!This reverts commit 04b751faa70680bf0296063deacec4657c6ff9d6.
claunia added the pull-request label 2026-01-31 09:25:21 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27954