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

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

Issue 2873823002: Put PaintInvalidatorContext on the heap, to reduce stack overflows. (Closed)
Patch Set: Merge branch 'master' into fastmallocpaintinvalidator Created 3 years, 7 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 | « third_party/WebKit/Source/core/paint/PaintInvalidator.h ('k') | 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 d363bd8b79152c07a7e200a5cef31b5ec8f15c29..346651b5ec021295be6122363e840e237a1eb5bb 100644
--- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
+++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
@@ -19,6 +19,7 @@ struct PrePaintTreeWalkContext {
PrePaintTreeWalkContext()
: tree_builder_context(
WTF::WrapUnique(new PaintPropertyTreeBuilderContext)),
+ paint_invalidator_context(WTF::WrapUnique(new PaintInvalidatorContext)),
ancestor_overflow_paint_layer(nullptr),
ancestor_transformed_or_root_paint_layer(nullptr) {}
@@ -29,7 +30,8 @@ struct PrePaintTreeWalkContext {
? new PaintPropertyTreeBuilderContext(
*parent_context.tree_builder_context)
: nullptr)),
- paint_invalidator_context(parent_context.paint_invalidator_context),
+ paint_invalidator_context(WTF::WrapUnique(new PaintInvalidatorContext(
+ *parent_context.paint_invalidator_context))),
ancestor_overflow_paint_layer(
parent_context.ancestor_overflow_paint_layer),
ancestor_transformed_or_root_paint_layer(
@@ -46,7 +48,7 @@ struct PrePaintTreeWalkContext {
// See: https://crbug.com/698653.
std::unique_ptr<PaintPropertyTreeBuilderContext> tree_builder_context;
- PaintInvalidatorContext paint_invalidator_context;
+ std::unique_ptr<PaintInvalidatorContext> paint_invalidator_context;
// The ancestor in the PaintLayer tree which has overflow clip, or
// is the root layer. Note that it is tree ancestor, not containing
@@ -93,7 +95,7 @@ void PrePaintTreeWalk::Walk(FrameView& frame_view,
}
paint_invalidator_.InvalidatePaint(frame_view,
context.tree_builder_context.get(),
- context.paint_invalidator_context);
+ *context.paint_invalidator_context);
if (LayoutView* view = frame_view.GetLayoutView()) {
Walk(*view, context);
@@ -155,7 +157,7 @@ void PrePaintTreeWalk::InvalidatePaintLayerOptimizationsIfNeeded(
PaintLayer& paint_layer = *ToLayoutBoxModelObject(object).Layer();
if (object.StyleRef().HasTransform() ||
&object ==
- context.paint_invalidator_context.paint_invalidation_container) {
+ context.paint_invalidator_context->paint_invalidation_container) {
context.ancestor_transformed_or_root_paint_layer = &paint_layer;
}
@@ -174,7 +176,7 @@ void PrePaintTreeWalk::InvalidatePaintLayerOptimizationsIfNeeded(
if (InvalidatePaintLayerOptimizationsForFragment(
object, context.ancestor_transformed_or_root_paint_layer, fragment,
*fragment_data)) {
- context.paint_invalidator_context.forced_subtree_invalidation_flags |=
+ context.paint_invalidator_context->forced_subtree_invalidation_flags |=
PaintInvalidatorContext::kForcedSubtreeVisualRectUpdate;
}
fragment_data = fragment_data->NextFragment();
@@ -281,7 +283,8 @@ bool PrePaintTreeWalk::NeedsTreeBuilderContextUpdate(
parent_context.tree_builder_context->force_subtree_update) ||
// If the object needs visual rect update, we should update tree
// builder context which is needed by visual rect update.
- parent_context.paint_invalidator_context.NeedsVisualRectUpdate(object);
+ parent_context.paint_invalidator_context->NeedsVisualRectUpdate(
+ object);
}
void PrePaintTreeWalk::ClearPreviousClipRectsForTesting(
@@ -312,7 +315,7 @@ void PrePaintTreeWalk::Walk(const LayoutObject& object,
}
paint_invalidator_.InvalidatePaint(object, context.tree_builder_context.get(),
- context.paint_invalidator_context);
+ *context.paint_invalidator_context);
if (context.tree_builder_context) {
property_tree_builder_.UpdatePropertiesForChildren(
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInvalidator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698