mirror of
https://github.com/microsoft/terminal.git
synced 2026-02-09 13:47:20 +00:00
Enable WINRT_LEAN_AND_MEAN (#15215)
`WINRT_LEAN_AND_MEAN` removes a bunch of less often used parts of the C++/WinRT headers: - `std::hash` specializations for every object - `operator <<(ostream)` overloads for any `IStringable` - Interface producers for interfaces that are marked "exclusive" There's only one place where we were using even one of these. Enabling this saves us (optimistically) 30 seconds of build time on the CI agents and shrinks our largest PCH (TerminalApp, x64, Debug) by about 150MiB. It's not huge, but it's not nothing.
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include "CommandPalette.g.h"
|
||||
#include "AppCommandlineArgs.h"
|
||||
|
||||
#include <til/hash.h>
|
||||
|
||||
// fwdecl unittest classes
|
||||
namespace TerminalAppLocalTests
|
||||
{
|
||||
@@ -60,6 +62,14 @@ namespace winrt::TerminalApp::implementation
|
||||
TYPED_EVENT(PreviewAction, Windows::Foundation::IInspectable, Microsoft::Terminal::Settings::Model::Command);
|
||||
|
||||
private:
|
||||
struct winrt_object_hash
|
||||
{
|
||||
size_t operator()(const auto& value) const noexcept
|
||||
{
|
||||
return til::hash(winrt::get_abi(value));
|
||||
}
|
||||
};
|
||||
|
||||
friend struct CommandPaletteT<CommandPalette>; // for Xaml to bind events
|
||||
|
||||
Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> _allCommands{ nullptr };
|
||||
@@ -141,7 +151,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void _choosingItemContainer(const Windows::UI::Xaml::Controls::ListViewBase& sender, const Windows::UI::Xaml::Controls::ChoosingItemContainerEventArgs& args);
|
||||
void _containerContentChanging(const Windows::UI::Xaml::Controls::ListViewBase& sender, const Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs& args);
|
||||
winrt::TerminalApp::PaletteItemTemplateSelector _itemTemplateSelector{ nullptr };
|
||||
std::unordered_map<Windows::UI::Xaml::DataTemplate, std::unordered_set<Windows::UI::Xaml::Controls::Primitives::SelectorItem>> _listViewItemsCache;
|
||||
std::unordered_map<Windows::UI::Xaml::DataTemplate, std::unordered_set<Windows::UI::Xaml::Controls::Primitives::SelectorItem, winrt_object_hash>, winrt_object_hash> _listViewItemsCache;
|
||||
Windows::UI::Xaml::DataTemplate _listItemTemplate;
|
||||
|
||||
friend class TerminalAppLocalTests::TabTests;
|
||||
|
||||
@@ -73,6 +73,8 @@
|
||||
<DisableSpecificWarnings>5104;28204;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
|
||||
<PreprocessorDefinitions>WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem Condition="'%(SubSystem)'==''">Console</SubSystem>
|
||||
|
||||
Reference in New Issue
Block a user