Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Issue 335963002: Change LayoutState to be stack-allocated (Closed)

Created:
6 years, 6 months ago by leviw_travelin_and_unemployed
Modified:
6 years, 6 months ago
CC:
blink-layers+watch_chromium.org, blink-reviews, blink-reviews-rendering, cbiesinger, krit, eae+blinkwatch, ed+blinkwatch_opera.com, eric.carlson_apple.com, feature-media-reviews_chromium.org, f(malita), fs, gyuyoung.kim_webkit.org, jchaffraix+rendering, jfernandez, kouhei+svg_chromium.org, leviw+renderwatch, pdr., philipj_slow, Manuel Rego, rwlbuis, rune+blink, Stephen Chennney, svillar, zoltan1
Project:
blink
Visibility:
Public.

Description

Change LayoutState to be stack-allocated LayoutState does 2 fundamentally different things: it acts as a quick repaint mapping between renderers and their repaint container (currently only the RenderView crbug.com/363834), and keeps track of various layout tree information (like the current pagination model). Because the fast repaint mapping doesn't work for all types of renderers, there's a concept of LayoutState being disabled, and sometimes not 'pushed' at all. This CL renames the disabled state, which only applies to the repaint optimization, to layoutStateCachedOffsetsEnabled, and makes LayoutState stack-based instead of heap-based. It now will always "push," and tracks whether or not the repaint optimization is disabled as part of itself. This is one step in the process of teaching LayoutState to work on renderers that aren't the RenderView. BUG=363834 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=176362

Patch Set 1 #

Patch Set 2 : Speculative multi-column fix (tests pass on Mac) #

Patch Set 3 : Fix assert #

Total comments: 15

Patch Set 4 : Address comments #

Total comments: 3

Patch Set 5 : Address nits #

Patch Set 6 : ++++++--------------------- #

Patch Set 7 : Correct LayoutState destuctor logic to match RenderView's pop method #

Patch Set 8 : And one more issue with the disabler... #

Patch Set 9 : Fix push function to match old behavior... #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+150 lines, -290 lines) Patch
M Source/core/frame/FrameView.cpp View 1 2 3 4 5 6 7 8 3 chunks +3 lines, -29 lines 0 comments Download
M Source/core/rendering/LayoutState.h View 3 chunks +27 lines, -29 lines 0 comments Download
M Source/core/rendering/LayoutState.cpp View 1 2 3 4 5 4 chunks +54 lines, -21 lines 6 comments Download
M Source/core/rendering/RenderBlock.h View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -1 line 0 comments Download
M Source/core/rendering/RenderBlock.cpp View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -3 lines 0 comments Download
M Source/core/rendering/RenderBlockFlow.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderBox.cpp View 1 2 3 4 5 6 7 8 6 chunks +6 lines, -6 lines 0 comments Download
M Source/core/rendering/RenderBoxModelObject.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderDeprecatedFlexibleBox.cpp View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/rendering/RenderFlexibleBox.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderGrid.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderInline.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M Source/core/rendering/RenderLayerRepainter.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderMedia.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderObject.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderTable.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderTableCell.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderTableRow.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderTableSection.cpp View 1 2 3 4 chunks +4 lines, -8 lines 0 comments Download
M Source/core/rendering/RenderVTTCue.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderView.h View 1 2 3 4 5 6 7 6 chunks +23 lines, -142 lines 0 comments Download
M Source/core/rendering/RenderView.cpp View 1 2 3 4 5 6 7 8 6 chunks +12 lines, -33 lines 1 comment Download
M Source/core/rendering/svg/RenderSVGContainer.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/svg/RenderSVGForeignObject.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 18 (0 generated)
leviw_travelin_and_unemployed
6 years, 6 months ago (2014-06-13 22:06:31 UTC) #1
esprehn
You need to sync, the ASSERT_DISABLED thing is gone. https://codereview.chromium.org/335963002/diff/40001/Source/core/rendering/LayoutState.cpp File Source/core/rendering/LayoutState.cpp (right): https://codereview.chromium.org/335963002/diff/40001/Source/core/rendering/LayoutState.cpp#newcode170 Source/core/rendering/LayoutState.cpp:170: ...
6 years, 6 months ago (2014-06-13 23:25:26 UTC) #2
leviw_travelin_and_unemployed
Thanks! https://codereview.chromium.org/335963002/diff/40001/Source/core/rendering/RenderBlock.cpp File Source/core/rendering/RenderBlock.cpp (right): https://codereview.chromium.org/335963002/diff/40001/Source/core/rendering/RenderBlock.cpp#newcode382 Source/core/rendering/RenderBlock.cpp:382: LayoutState statePusher(*this, isTableRow() ? LayoutSize() : locationOffset()); On ...
6 years, 6 months ago (2014-06-13 23:46:16 UTC) #3
leviw_travelin_and_unemployed
ptal
6 years, 6 months ago (2014-06-14 02:12:34 UTC) #4
esprehn
lgtm, couple random nits. https://codereview.chromium.org/335963002/diff/60001/Source/core/frame/FrameView.cpp File Source/core/frame/FrameView.cpp (right): https://codereview.chromium.org/335963002/diff/60001/Source/core/frame/FrameView.cpp#newcode1019 Source/core/frame/FrameView.cpp:1019: LayoutState rootLayoutStateScope(*root); rootLayoutState https://codereview.chromium.org/335963002/diff/60001/Source/core/rendering/LayoutState.cpp File ...
6 years, 6 months ago (2014-06-14 03:08:27 UTC) #5
leviw_travelin_and_unemployed
The CQ bit was checked by leviw@chromium.org
6 years, 6 months ago (2014-06-16 19:12:18 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/leviw@chromium.org/335963002/80001
6 years, 6 months ago (2014-06-16 19:13:04 UTC) #7
leviw_travelin_and_unemployed
The CQ bit was checked by leviw@chromium.org
6 years, 6 months ago (2014-06-16 22:08:02 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/leviw@chromium.org/335963002/140001
6 years, 6 months ago (2014-06-16 22:09:07 UTC) #9
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-16 23:52:36 UTC) #10
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/12097)
6 years, 6 months ago (2014-06-16 23:52:37 UTC) #11
leviw_travelin_and_unemployed
PTAL. I had to fix a couple things that somehow passed locally for me on ...
6 years, 6 months ago (2014-06-17 22:06:22 UTC) #12
esprehn
lgtm
6 years, 6 months ago (2014-06-17 23:26:34 UTC) #13
leviw_travelin_and_unemployed
The CQ bit was checked by leviw@chromium.org
6 years, 6 months ago (2014-06-17 23:27:04 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/leviw@chromium.org/335963002/160001
6 years, 6 months ago (2014-06-17 23:27:56 UTC) #15
commit-bot: I haz the power
Change committed as 176362
6 years, 6 months ago (2014-06-17 23:31:21 UTC) #16
Julien - ping for review
Late at the party but lgtm (with some comments) https://codereview.chromium.org/335963002/diff/160001/Source/core/rendering/LayoutState.cpp File Source/core/rendering/LayoutState.cpp (right): https://codereview.chromium.org/335963002/diff/160001/Source/core/rendering/LayoutState.cpp#newcode58 Source/core/rendering/LayoutState.cpp:58: ...
6 years, 6 months ago (2014-06-17 23:34:26 UTC) #17
leviw_travelin_and_unemployed
6 years, 6 months ago (2014-06-17 23:37:04 UTC) #18
Message was sent while issue was closed.
https://codereview.chromium.org/335963002/diff/160001/Source/core/rendering/L...
File Source/core/rendering/LayoutState.cpp (right):

https://codereview.chromium.org/335963002/diff/160001/Source/core/rendering/L...
Source/core/rendering/LayoutState.cpp:58: {
On 2014/06/17 23:34:25, Julien Chaffraix - PST wrote:
> Should we add ASSERT(m_renderer.view()->layoutState())? (we are accessing
m_next
> below so we will definitely see a crash but that should make it obvious what's
> wrong)

Sure.

https://codereview.chromium.org/335963002/diff/160001/Source/core/rendering/L...
Source/core/rendering/LayoutState.cpp:154: ,
m_cachedOffsetsEnabled(shouldDisableLayoutStateForSubtree(root))
On 2014/06/17 23:34:26, Julien Chaffraix - PST wrote:
> That potentially makes the code O(depth_of_tree^2) :(
> 
> shouldDisableLayoutStateForSubtree should hit any previous |root| from another
> LayoutState, which should prevent this performance bottleneck.

This is only created in FrameView for a sub-tree root. This works exactly like
RootLayoutState used to work.

Powered by Google App Engine
This is Rietveld 408576698