Commit 853d7a68 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Add counters to count the numbers of legacy and LayoutNG LayoutBlocks

This CL has no user-visible behavior changes.

Note that LayoutNG ratio computed by these counters is 83.1%
on nytiimes.com.

Bug: 1067527
Change-Id: I0f2628d3eb5c4d7da7a4d5b3cc44cc918137a17b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2138653Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756945}
parent 7cb8f204
...@@ -680,6 +680,8 @@ class CORE_EXPORT Document : public ContainerNode, ...@@ -680,6 +680,8 @@ class CORE_EXPORT Document : public ContainerNode,
void UpdateStyleAndLayoutForNode(const Node*, DocumentUpdateReason); void UpdateStyleAndLayoutForNode(const Node*, DocumentUpdateReason);
void IncLayoutCallsCounter() { ++layout_calls_counter_; } void IncLayoutCallsCounter() { ++layout_calls_counter_; }
void IncLayoutCallsCounterNG() { ++layout_calls_counter_ng_; } void IncLayoutCallsCounterNG() { ++layout_calls_counter_ng_; }
void IncLayoutBlockCounter() { ++layout_blocks_counter_; }
void IncLayoutBlockCounterNG() { ++layout_blocks_counter_ng_; }
scoped_refptr<const ComputedStyle> StyleForPage(int page_index); scoped_refptr<const ComputedStyle> StyleForPage(int page_index);
...@@ -2218,6 +2220,13 @@ class CORE_EXPORT Document : public ContainerNode, ...@@ -2218,6 +2220,13 @@ class CORE_EXPORT Document : public ContainerNode,
// The number of LayoutObject::UpdateLayout() calls for LayoutNG. // The number of LayoutObject::UpdateLayout() calls for LayoutNG.
uint32_t layout_calls_counter_ng_ = 0; uint32_t layout_calls_counter_ng_ = 0;
// The number of LayoutBlock instances for both of the legacy layout
// and LayoutNG.
uint32_t layout_blocks_counter_ = 0;
// The number of LayoutNGMixin<LayoutBlock> instances
uint32_t layout_blocks_counter_ng_ = 0;
bool deferred_compositor_commit_is_allowed_ = false; bool deferred_compositor_commit_is_allowed_ = false;
// True when the document was created (in DomImplementation) for specific MIME // True when the document was created (in DomImplementation) for specific MIME
......
...@@ -111,6 +111,9 @@ LayoutBlock::LayoutBlock(ContainerNode* node) ...@@ -111,6 +111,9 @@ LayoutBlock::LayoutBlock(ContainerNode* node)
has_percent_height_descendants_(false), has_percent_height_descendants_(false),
pagination_state_changed_(false), pagination_state_changed_(false),
is_legacy_initiated_out_of_flow_layout_(false) { is_legacy_initiated_out_of_flow_layout_(false) {
if (node)
GetDocument().IncLayoutBlockCounter();
// LayoutBlockFlow calls setChildrenInline(true). // LayoutBlockFlow calls setChildrenInline(true).
// By default, subclasses do not have inline children. // By default, subclasses do not have inline children.
} }
......
...@@ -26,6 +26,8 @@ LayoutNGMixin<Base>::LayoutNGMixin(Element* element) : Base(element) { ...@@ -26,6 +26,8 @@ LayoutNGMixin<Base>::LayoutNGMixin(Element* element) : Base(element) {
std::is_base_of<LayoutBlock, Base>::value, std::is_base_of<LayoutBlock, Base>::value,
"Base class of LayoutNGMixin must be LayoutBlock or derived class."); "Base class of LayoutNGMixin must be LayoutBlock or derived class.");
DCHECK(!element || !element->ShouldForceLegacyLayout()); DCHECK(!element || !element->ShouldForceLegacyLayout());
if (element)
Base::GetDocument().IncLayoutBlockCounterNG();
} }
template <typename Base> template <typename Base>
......
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