Commit 10c09eae authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Add counters for LayoutObject::UpdateLayout

This CL has no user-visible behavior changes, but might have
performance impact.

Note that LayoutNG ratio computed by these counters is 83.7% on
nytimes.com.

Bug: 1067527
Change-Id: I73cda07e55e9c9a7d8cef580ebf59fda10b61d1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134031Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756201}
parent 5609a463
...@@ -680,6 +680,9 @@ class CORE_EXPORT Document : public ContainerNode, ...@@ -680,6 +680,9 @@ class CORE_EXPORT Document : public ContainerNode,
kRunPostLayoutTasksSynchronously, kRunPostLayoutTasksSynchronously,
}; };
void UpdateStyleAndLayoutForNode(const Node*, DocumentUpdateReason); void UpdateStyleAndLayoutForNode(const Node*, DocumentUpdateReason);
void IncLayoutCallsCounter() { ++layout_calls_counter_; }
void IncLayoutCallsCounterNG() { ++layout_calls_counter_ng_; }
scoped_refptr<const ComputedStyle> StyleForPage(int page_index); scoped_refptr<const ComputedStyle> StyleForPage(int page_index);
// Ensures that location-based data will be valid for a given node. // Ensures that location-based data will be valid for a given node.
...@@ -2253,6 +2256,13 @@ class CORE_EXPORT Document : public ContainerNode, ...@@ -2253,6 +2256,13 @@ class CORE_EXPORT Document : public ContainerNode,
// The number of canvas elements on the document // The number of canvas elements on the document
int num_canvases_ = 0; int num_canvases_ = 0;
// The number of LayoutObject::UpdateLayout() calls for both of the legacy
// layout and LayoutNG.
uint32_t layout_calls_counter_ = 0;
// The number of LayoutObject::UpdateLayout() calls for LayoutNG.
uint32_t layout_calls_counter_ng_ = 0;
// Number of display locks in this document that block all activation. // Number of display locks in this document that block all activation.
int display_lock_blocking_all_activation_count_ = 0; int display_lock_blocking_all_activation_count_ = 0;
// Number of locked display locks in the document. // Number of locked display locks in the document.
......
...@@ -886,6 +886,11 @@ void LayoutBox::UpdateAfterLayout() { ...@@ -886,6 +886,11 @@ void LayoutBox::UpdateAfterLayout() {
// Legacy, then NG again, NG won't use a stale layout result. // Legacy, then NG again, NG won't use a stale layout result.
if (IsOutOfFlowPositioned() && !IsLayoutNGObject()) if (IsOutOfFlowPositioned() && !IsLayoutNGObject())
ClearLayoutResults(); ClearLayoutResults();
Document& document = GetDocument();
document.IncLayoutCallsCounter();
if (IsLayoutNGObject())
document.IncLayoutCallsCounterNG();
} }
bool LayoutBox::HasOverrideIntrinsicContentWidth() const { bool LayoutBox::HasOverrideIntrinsicContentWidth() const {
......
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