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

Unified Diff: third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp

Issue 2751753004: Store PaintPropertyTreeBuilderContext inline (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
diff --git a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
index d6e05ed112949823acd0f2522df469b6bab35b3c..24300b7bf5068b5e3b96729f9962677f66588587 100644
--- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
+++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
@@ -15,25 +15,23 @@
namespace blink {
struct PrePaintTreeWalkContext {
+ USING_FAST_MALLOC(PrePaintTreeWalkContext);
+
+ public:
PrePaintTreeWalkContext()
- : treeBuilderContext(
- WTF::wrapUnique(new PaintPropertyTreeBuilderContext)),
- paintInvalidatorContext(*treeBuilderContext),
+ : treeBuilderContext(),
+ paintInvalidatorContext(treeBuilderContext),
ancestorOverflowPaintLayer(nullptr),
ancestorTransformedOrRootPaintLayer(nullptr) {}
PrePaintTreeWalkContext(const PrePaintTreeWalkContext& parentContext)
- : treeBuilderContext(WTF::wrapUnique(new PaintPropertyTreeBuilderContext(
- *parentContext.treeBuilderContext))),
- paintInvalidatorContext(*treeBuilderContext,
+ : treeBuilderContext(parentContext.treeBuilderContext),
+ paintInvalidatorContext(treeBuilderContext,
parentContext.paintInvalidatorContext),
ancestorOverflowPaintLayer(parentContext.ancestorOverflowPaintLayer),
ancestorTransformedOrRootPaintLayer(
parentContext.ancestorTransformedOrRootPaintLayer) {}
- // PaintPropertyTreeBuilderContext is large and can lead to stack overflows
- // when recursion is deep so this context object is allocated on the heap.
- // See: https://crbug.com/698653.
- std::unique_ptr<PaintPropertyTreeBuilderContext> treeBuilderContext;
+ PaintPropertyTreeBuilderContext treeBuilderContext;
PaintInvalidatorContext paintInvalidatorContext;
@@ -49,7 +47,7 @@ void PrePaintTreeWalk::walk(FrameView& rootFrame) {
DocumentLifecycle::InPrePaint);
PrePaintTreeWalkContext initialContext;
- m_propertyTreeBuilder.setupInitialContext(*initialContext.treeBuilderContext);
+ m_propertyTreeBuilder.setupInitialContext(initialContext.treeBuilderContext);
initialContext.ancestorTransformedOrRootPaintLayer =
rootFrame.layoutView()->layer();
@@ -73,8 +71,7 @@ void PrePaintTreeWalk::walk(FrameView& frameView,
PrePaintTreeWalkContext context(parentContext);
// ancestorOverflowLayer does not cross frame boundaries.
context.ancestorOverflowPaintLayer = nullptr;
- m_propertyTreeBuilder.updateProperties(frameView,
- *context.treeBuilderContext);
+ m_propertyTreeBuilder.updateProperties(frameView, context.treeBuilderContext);
m_paintInvalidator.invalidatePaintIfNeeded(frameView,
context.paintInvalidatorContext);
@@ -186,8 +183,8 @@ void PrePaintTreeWalk::invalidatePaintLayerOptimizationsIfNeeded(
FloatClipRect clipRect;
const EffectPaintPropertyNode* effect =
- context.treeBuilderContext->currentEffect;
- computeClipRectForContext(context.treeBuilderContext->current, effect,
+ context.treeBuilderContext.currentEffect;
+ computeClipRectForContext(context.treeBuilderContext.current, effect,
ancestorState, ancestorPaintOffset, hasClip,
clipRect);
clipRects->setOverflowClipRect(clipRect);
@@ -197,7 +194,7 @@ void PrePaintTreeWalk::invalidatePaintLayerOptimizationsIfNeeded(
<< "rect= " << clipRects->overflowClipRect().toString();
#endif
- computeClipRectForContext(context.treeBuilderContext->fixedPosition, effect,
+ computeClipRectForContext(context.treeBuilderContext.fixedPosition, effect,
ancestorState, ancestorPaintOffset, hasClip,
clipRect);
clipRects->setFixedClipRect(clipRect);
@@ -206,8 +203,8 @@ void PrePaintTreeWalk::invalidatePaintLayerOptimizationsIfNeeded(
<< " fixed=" << clipRects->fixedClipRect().toString();
#endif
- computeClipRectForContext(context.treeBuilderContext->absolutePosition,
- effect, ancestorState, ancestorPaintOffset, hasClip,
+ computeClipRectForContext(context.treeBuilderContext.absolutePosition, effect,
+ ancestorState, ancestorPaintOffset, hasClip,
clipRect);
clipRects->setPosClipRect(clipRect);
#ifdef CHECK_CLIP_RECTS
@@ -237,7 +234,7 @@ bool PrePaintTreeWalk::shouldEndWalkBefore(
return (
!object.needsPaintPropertyUpdate() &&
!object.descendantNeedsPaintPropertyUpdate() &&
- !context.treeBuilderContext->forceSubtreeUpdate &&
+ !context.treeBuilderContext.forceSubtreeUpdate &&
!context.paintInvalidatorContext.forcedSubtreeInvalidationFlags &&
!object
.shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState());
@@ -255,11 +252,11 @@ void PrePaintTreeWalk::walk(const LayoutObject& object,
updateAuxiliaryObjectProperties(object, context);
m_propertyTreeBuilder.updatePropertiesForSelf(object,
- *context.treeBuilderContext);
+ context.treeBuilderContext);
m_paintInvalidator.invalidatePaintIfNeeded(object,
context.paintInvalidatorContext);
- m_propertyTreeBuilder.updatePropertiesForChildren(
- object, *context.treeBuilderContext);
+ m_propertyTreeBuilder.updatePropertiesForChildren(object,
+ context.treeBuilderContext);
invalidatePaintLayerOptimizationsIfNeeded(object, context);
@@ -276,11 +273,11 @@ void PrePaintTreeWalk::walk(const LayoutObject& object,
const LayoutPart& layoutPart = toLayoutPart(object);
FrameViewBase* frameViewBase = layoutPart.frameViewBase();
if (frameViewBase && frameViewBase->isFrameView()) {
- context.treeBuilderContext->current.paintOffset +=
+ context.treeBuilderContext.current.paintOffset +=
layoutPart.replacedContentRect().location() -
frameViewBase->frameRect().location();
- context.treeBuilderContext->current.paintOffset =
- roundedIntPoint(context.treeBuilderContext->current.paintOffset);
+ context.treeBuilderContext.current.paintOffset =
+ roundedIntPoint(context.treeBuilderContext.current.paintOffset);
walk(*toFrameView(frameViewBase), context);
}
// TODO(pdr): Investigate RemoteFrameView (crbug.com/579281).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698