[PE] Use a vector of PrePaintTreeWalkContexts instead of alloc'ed members
This patch replaces the heap allocated members of the PrePaintTreeWalk context with value members, and instead of creating these contexts on the stack, instead uses a vector storage that gets passed around as recursion happens. There are some subtleties with using this approach (I added comments for those). In local testing on a micro benchmark (not included here), this shows about ~10% improvement on the prepaint tree walk when everything is invalidated via SetSubtreeNeedsPaintPropertyUpdate. One thing that is important is that contexts can store references to its parent contexts, both top level PrePaintTreeWalkContext and PaintInvalidatorContext. However since a vector may reallocate, it will invalidate these parent references. For the former (PrePaintTreeWalkContext), we simply have an accessor that uses an index to look up the context in the context storage. Similar thing is done for PaintInvalidatorContext. However, in the latter, because it's implemented and accessed in different files, we instead put in a ParentContextAccessor which hides the underlying access to the context storage on the PrePaintTreeWalk object. R=chrishtr@chromium.org Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: Id69fae9db5ef76d64342cf3082d81762ee18dd15 Reviewed-on: https://chromium-review.googlesource.com/910085 Commit-Queue: vmpstr <vmpstr@chromium.org> Reviewed-by:Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/master@{#536768}
Showing
This diff is collapsed.
Please register or sign in to comment