Commit 3f4b3cca authored by pdr's avatar pdr Committed by Commit bot

Use a create-or-update pattern for faster local border box property updates

This patch switches to a create-or-update pattern for paint property
updates of the local border box. This is a 6% improvement on
large-table-collapsed-border-change-with-text [1].

[1] tools/perf/run_benchmark blink_perf.paint --browser=content-shell-release --pageset-repeat=5 --extra-browser-args=--enable-slimming-paint-v2

BUG=645667
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2538273002
Cr-Commit-Position: refs/heads/master@{#435546}
parent d8c0e2d7
......@@ -124,9 +124,23 @@ class CORE_EXPORT ObjectPaintProperties {
const PropertyTreeStateWithOffset* localBorderBoxProperties() const {
return m_localBorderBoxProperties.get();
}
void setLocalBorderBoxProperties(
std::unique_ptr<PropertyTreeStateWithOffset> properties) {
m_localBorderBoxProperties = std::move(properties);
void updateLocalBorderBoxProperties(
LayoutPoint& paintOffset,
const TransformPaintPropertyNode* transform,
const ClipPaintPropertyNode* clip,
const EffectPaintPropertyNode* effect,
const ScrollPaintPropertyNode* scroll) {
if (m_localBorderBoxProperties) {
m_localBorderBoxProperties->paintOffset = paintOffset;
m_localBorderBoxProperties->propertyTreeState.setTransform(transform);
m_localBorderBoxProperties->propertyTreeState.setClip(clip);
m_localBorderBoxProperties->propertyTreeState.setEffect(effect);
m_localBorderBoxProperties->propertyTreeState.setScroll(scroll);
} else {
m_localBorderBoxProperties =
wrapUnique(new ObjectPaintProperties::PropertyTreeStateWithOffset(
paintOffset, PropertyTreeState(transform, clip, effect, scroll)));
}
}
// This is the complete set of property nodes and paint offset that can be
......
......@@ -466,16 +466,10 @@ void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(
if (auto* properties = object.getMutableForPainting().paintProperties())
properties->clearLocalBorderBoxProperties();
} else {
std::unique_ptr<ObjectPaintProperties::PropertyTreeStateWithOffset>
borderBoxContext =
wrapUnique(new ObjectPaintProperties::PropertyTreeStateWithOffset(
context.current.paintOffset,
PropertyTreeState(context.current.transform,
context.current.clip, context.currentEffect,
context.current.scroll)));
object.getMutableForPainting()
.ensurePaintProperties()
.setLocalBorderBoxProperties(std::move(borderBoxContext));
auto& properties = object.getMutableForPainting().ensurePaintProperties();
properties.updateLocalBorderBoxProperties(
context.current.paintOffset, context.current.transform,
context.current.clip, context.currentEffect, context.current.scroll);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment