-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Remove WinRT composition (inheritance) from PaletteItem #19132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Right now, we construct **two objects** for every palette item: the derived type and the base type. It's unnnecessary. This also removes many of our palette items from our IDL. The only ones that are necessary to expose via our WinRT API surface are the ones that are used in XAML documents.
The tests are probably exploded rigth now. |
Yes, we should cache the name. |
(Specifically: it is called 2386 times for a small repertoire of only 110 or so commands...) |
{ | ||
return NestedItemTemplate(); | ||
} | ||
__fallthrough; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[[fallthrough]]
, I believe. But why not just do a break
instead?
const auto icon = Microsoft::Terminal::UI::IconPathConverter::IconWUX(static_cast<T*>(this)->Icon()); | ||
icon.Width(16); | ||
icon.Height(16); | ||
return icon; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this also called hundreds of times? It looks immutable at first glance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (auto tab = _tab.get()) | ||
{ | ||
if (auto terminalTab = tab.try_as<winrt::TerminalApp::TerminalTab>()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (auto tab = _tab.get()) | |
{ | |
if (auto terminalTab = tab.try_as<winrt::TerminalApp::TerminalTab>()) | |
if (const auto tab = _tab.get()) | |
{ | |
if (const auto terminalTab = tab.try_as<winrt::TerminalApp::TerminalTab>()) |
Right now, we construct two objects for every palette item: the
derived type and the base type. It's unnnecessary.
This pull request replaces WinRT composition with a good old-fashioned
enum ThingType
.This also removes many of our palette items from our IDL. The only ones
that are necessary to expose via our WinRT API surface are the ones that
are used in XAML documents.
I originally removed the caching for
Command.Name
, but it turns outthat something calls
Name
roughly 17 times per command and havingthe generator running that often is a serious waste of CPU.
Validation Steps