Bug 219314 - [LFC Display] Use a vector to maintain state during display tree building
Summary: [LFC Display] Use a vector to maintain state during display tree building
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-11-27 10:36 PST by Simon Fraser (smfr)
Modified: 2020-11-30 19:19 PST (History)
7 users (show)

See Also:


Attachments
Patch (9.72 KB, patch)
2020-11-27 10:37 PST, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2020-11-27 10:36:56 PST
[LFC Display] Use a vector to maintain state during display tree building
Comment 1 Simon Fraser (smfr) 2020-11-27 10:37:17 PST
Created attachment 414958 [details]
Patch
Comment 2 Sam Weinig 2020-11-28 11:30:30 PST
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.
Comment 3 Simon Fraser (smfr) 2020-11-28 21:01:44 PST
I tried that and makeUnique<Vector, 32> didn't compile.
Comment 4 EWS 2020-11-28 21:11:12 PST
Committed r270224: <https://trac.webkit.org/changeset/270224>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 414958 [details].
Comment 5 Radar WebKit Bug Importer 2020-11-28 21:12:17 PST
<rdar://problem/71779000>
Comment 6 Don Olmstead 2020-11-29 08:45:33 PST
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;
       ^
Comment 7 Simon Fraser (smfr) 2020-11-30 10:45:45 PST
Fixed in r270251.
Comment 8 Sam Weinig 2020-11-30 19:19:58 PST
(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>>.