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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10187
Author: @zadjii-msft
Created: 5/25/2021
Status: ✅ Merged
Merged: 8/9/2021
Merged by: @undefined

Base: main ← Head: dev/migrie/oop/throttled-funcs


📝 Commits (10+)

  • e4478ee Only access ControlInteractivity through the projection
  • 400b35f Only 24 more errors to go
  • 42b970b Totally upend the control AutomationPeer workings
  • 4578c13 some comments that should have been in the previous commit. 16 errors remain.
  • d8cc047 GetHoveredCell/UpdateHoveredCell. 12 remain.
  • 21a97b6 Revert "Revert "Use DComp surface handle for Swap Chain management.""
  • 2e861d8 some minor cleanup
  • e20caae Merge branch 'dev/migrie/f/oop/use-dcomp-handle' into dev/migrie/interactivity-projection-000
  • d667f3b Use the HANDLE for the swapchainin the core projection
  • 62cbf30 it builds and runs so I guess it's done now

📊 Changes

9 files changed (+170 additions, -101 deletions)

View changed files

📝 src/cascadia/TerminalApp/AppLogic.cpp (+1 -1)
📝 src/cascadia/TerminalControl/ControlCore.cpp (+88 -18)
📝 src/cascadia/TerminalControl/ControlCore.h (+22 -1)
📝 src/cascadia/TerminalControl/TermControl.cpp (+25 -60)
📝 src/cascadia/TerminalControl/TermControl.h (+3 -6)
📝 src/cascadia/UnitTests_Control/ControlCoreTests.cpp (+15 -10)
📝 src/cascadia/UnitTests_Control/ControlInteractivityTests.cpp (+10 -1)
📝 src/cascadia/UnitTests_Control/pch.h (+2 -0)
📝 src/cascadia/WinRTUtils/inc/ThrottledFunc.h (+4 -4)

📄 Description

⚠️ 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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/10187 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 5/25/2021 **Status:** ✅ Merged **Merged:** 8/9/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/oop/throttled-funcs` --- ### 📝 Commits (10+) - [`e4478ee`](https://github.com/microsoft/terminal/commit/e4478eec6afa26b0f9d401e80195b527471a1005) Only access ControlInteractivity through the projection - [`400b35f`](https://github.com/microsoft/terminal/commit/400b35f8140732aa8483f6a90c09ad225a93581c) Only 24 more errors to go - [`42b970b`](https://github.com/microsoft/terminal/commit/42b970b7f22248bb17dd295011ce6a5ff5a064cf) Totally upend the control AutomationPeer workings - [`4578c13`](https://github.com/microsoft/terminal/commit/4578c136a054a1efc50e99264a555547a909fda1) some comments that should have been in the previous commit. 16 errors remain. - [`d8cc047`](https://github.com/microsoft/terminal/commit/d8cc047a7ef39d93430bc724e8071e3568cd4dc6) GetHoveredCell/UpdateHoveredCell. 12 remain. - [`21a97b6`](https://github.com/microsoft/terminal/commit/21a97b6c80dd95cf3be84d9eb2070adc5956fa75) Revert "Revert "Use DComp surface handle for Swap Chain management."" - [`2e861d8`](https://github.com/microsoft/terminal/commit/2e861d8a37886278e638c556b71e44943d6b64b7) some minor cleanup - [`e20caae`](https://github.com/microsoft/terminal/commit/e20caae758319433196b4baa4cf6a06354801e05) Merge branch 'dev/migrie/f/oop/use-dcomp-handle' into dev/migrie/interactivity-projection-000 - [`d667f3b`](https://github.com/microsoft/terminal/commit/d667f3b63340b6db35a30e141c75bdecb6931ad0) Use the HANDLE for the swapchainin the core projection - [`62cbf30`](https://github.com/microsoft/terminal/commit/62cbf30782fd8439d755226c43ed7d366748aa94) it builds and runs so I guess it's done now ### 📊 Changes **9 files changed** (+170 additions, -101 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/AppLogic.cpp` (+1 -1) 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+88 -18) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+22 -1) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+25 -60) 📝 `src/cascadia/TerminalControl/TermControl.h` (+3 -6) 📝 `src/cascadia/UnitTests_Control/ControlCoreTests.cpp` (+15 -10) 📝 `src/cascadia/UnitTests_Control/ControlInteractivityTests.cpp` (+10 -1) 📝 `src/cascadia/UnitTests_Control/pch.h` (+2 -0) 📝 `src/cascadia/WinRTUtils/inc/ThrottledFunc.h` (+4 -4) </details> ### 📄 Description #### ⚠️ 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:25:20 +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#27949