[LFC Display] Use a vector to maintain state during display tree building
Created attachment 414958 [details] Patch
Comment on attachment 414958 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=414958&action=review > Source/WebCore/display/DisplayTreeBuilder.cpp:107 > + m_stateStack->reserveInitialCapacity(32); An inline capacity on m_stateStack's vector probably makes sense if you are going to do this unconditionally.
I tried that and makeUnique<Vector, 32> didn't compile.
Committed r270224: <https://trac.webkit.org/changeset/270224> All reviewed patches have been landed. Closing bug and clearing flags on attachment 414958 [details].
<rdar://problem/71779000>
This breaks the non-unified build and the BuildingState struct is defined in DisplayTreeBuilder.cpp so there's no header that can be included to fix it. Not sure how you all would like to resolve this as the BuildingState has a PositioningContext which is also defined in that .cpp file. Here's the build log for reference. In file included from ..\..\Source\WebCore\display\DisplayView.cpp:27: In file included from ..\..\Source\WebCore\display/DisplayView.h:30: In file included from ..\..\Source\WebCore\display/DisplayLayerController.h:30: In file included from ..\..\Source\WebCore\platform\graphics\GraphicsLayer.h:29: In file included from ..\..\Source\WebCore\rendering\EventRegion.h:29: In file included from ..\..\Source\WebCore\platform\graphics\Region.h:29: In file included from ..\..\Source\WebCore\platform\graphics\IntRect.h:28: In file included from ..\..\Source\WebCore\platform\graphics\IntPoint.h:28: In file included from ..\..\Source\WebCore\platform\graphics\IntSize.h:29: In file included from WTF\Headers\wtf/JSONValues.h:36: In file included from WTF\Headers\wtf/text/StringHash.h:25: In file included from WTF\Headers\wtf/text/AtomString.h:25: In file included from WTF\Headers\wtf/text/AtomStringImpl.h:23: In file included from WTF\Headers\wtf/text/UniquedStringImpl.h:28: In file included from WTF\Headers\wtf/text/StringImpl.h:34: WTF\Headers\wtf/Vector.h(731,37): error: arithmetic on a pointer to an incomplete type 'WebCore::Display::BuildingState' iterator end() { return begin() + m_size; } ~~~~~~~ ^ WTF\Headers\wtf/Vector.h(676,47): note: in instantiation of member function 'WTF::Vector<WebCore::Display::BuildingState, 0, WTF::CrashOnOverflow, 16, WTF::FastMalloc>::end' requested here TypeOperations::destruct(begin(), end()); ^ C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\memory(2537,9): note: in instantiation of member function 'WTF::Vector<WebCore::Display::BuildingState, 0, WTF::CrashOnOverflow, 16, WTF::FastMalloc>::~Vector' requested here delete _Ptr; ^ C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\memory(2647,13): note: in instantiation of member function 'std::default_delete<WTF::Vector<WebCore::Display::BuildingState, 0, WTF::CrashOnOverflow, 16, WTF::FastMalloc>>::operator()' requested here _Mypair._Get_first()(_Mypair._Myval2); ^ ..\..\Source\WebCore\display/DisplayTreeBuilder.h(56,7): note: in instantiation of member function 'std::unique_ptr<WTF::Vector<WebCore::Display::BuildingState, 0, WTF::CrashOnOverflow, 16, WTF::FastMalloc>, std::default_delete<WTF::Vector<WebCore::Display::BuildingState, 0, WTF::CrashOnOverflow, 16, WTF::FastMalloc>>>::~unique_ptr' requested here class TreeBuilder { ^ ..\..\Source\WebCore\display/DisplayTreeBuilder.h(54,8): note: forward declaration of 'WebCore::Display::BuildingState' struct BuildingState; ^
Fixed in r270251.
(In reply to Simon Fraser (smfr) from comment #3) > I tried that and makeUnique<Vector, 32> didn't compile. You would do, makeUnique<Vector<BuildingState, 32>>.