Commit 5931a113 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[layout] Remove TrackLayoutPassesPerBlock

This test doesn't add a lot of value now that we have:
ng_layout_result_caching_test.cc
...to test cache hits/misses.

There should be no behaviour change.

Change-Id: I4d13d6f61cdfce0dd00dd3e85eab6d03a7b12d63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2256156
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811528}
parent be872638
...@@ -1182,7 +1182,6 @@ source_set("unit_tests") { ...@@ -1182,7 +1182,6 @@ source_set("unit_tests") {
"layout/layout_block_test.cc", "layout/layout_block_test.cc",
"layout/layout_box_model_object_test.cc", "layout/layout_box_model_object_test.cc",
"layout/layout_box_test.cc", "layout/layout_box_test.cc",
"layout/layout_count_test.cc",
"layout/layout_embedded_content_test.cc", "layout/layout_embedded_content_test.cc",
"layout/layout_flexible_box_test.cc", "layout/layout_flexible_box_test.cc",
"layout/layout_geometry_map_test.cc", "layout/layout_geometry_map_test.cc",
......
...@@ -87,12 +87,6 @@ ASSERT_SIZE(LayoutBlockFlow, SameSizeAsLayoutBlockFlow); ...@@ -87,12 +87,6 @@ ASSERT_SIZE(LayoutBlockFlow, SameSizeAsLayoutBlockFlow);
ASSERT_SIZE(LayoutBlockFlow::MarginValues, LayoutUnit[4]); ASSERT_SIZE(LayoutBlockFlow::MarginValues, LayoutUnit[4]);
typedef HashMap<LayoutBlockFlow*, int> LayoutPassCountMap;
static LayoutPassCountMap& GetLayoutPassCountMap() {
DEFINE_STATIC_LOCAL(LayoutPassCountMap, map, ());
return map;
}
// Caches all our current margin collapsing state. // Caches all our current margin collapsing state.
class MarginInfo { class MarginInfo {
// Collapsing flags for whether we can collapse our margins with our // Collapsing flags for whether we can collapse our margins with our
...@@ -452,9 +446,6 @@ void LayoutBlockFlow::UpdateBlockLayout(bool relayout_children) { ...@@ -452,9 +446,6 @@ void LayoutBlockFlow::UpdateBlockLayout(bool relayout_children) {
DCHECK(NeedsLayout()); DCHECK(NeedsLayout());
DCHECK(IsInlineBlockOrInlineTable() || !IsInline()); DCHECK(IsInlineBlockOrInlineTable() || !IsInline());
if (RuntimeEnabledFeatures::TrackLayoutPassesPerBlockEnabled())
IncrementLayoutPassCount();
ClearOffsetMappingIfNeeded(); ClearOffsetMappingIfNeeded();
if (!relayout_children && SimplifiedLayout()) if (!relayout_children && SimplifiedLayout())
...@@ -4951,21 +4942,6 @@ void LayoutBlockFlow::InvalidateDisplayItemClients( ...@@ -4951,21 +4942,6 @@ void LayoutBlockFlow::InvalidateDisplayItemClients(
invalidation_reason); invalidation_reason);
} }
void LayoutBlockFlow::IncrementLayoutPassCount() {
NOT_DESTROYED();
int layout_pass_count = 0;
HashMap<LayoutBlockFlow*, int>::iterator layout_count_iterator =
GetLayoutPassCountMap().find(this);
if (layout_count_iterator != GetLayoutPassCountMap().end())
layout_pass_count = layout_count_iterator->value;
GetLayoutPassCountMap().Set(this, ++layout_pass_count);
}
int LayoutBlockFlow::GetLayoutPassCountForTesting() {
NOT_DESTROYED();
return GetLayoutPassCountMap().find(this)->value;
}
LayoutBlockFlow::LayoutBlockFlowRareData::LayoutBlockFlowRareData( LayoutBlockFlow::LayoutBlockFlowRareData::LayoutBlockFlowRareData(
const LayoutBlockFlow* block) const LayoutBlockFlow* block)
: margins_(PositiveMarginBeforeDefault(block), : margins_(PositiveMarginBeforeDefault(block),
......
...@@ -877,11 +877,6 @@ class CORE_EXPORT LayoutBlockFlow : public LayoutBlock { ...@@ -877,11 +877,6 @@ class CORE_EXPORT LayoutBlockFlow : public LayoutBlock {
bool ShouldTruncateOverflowingText() const; bool ShouldTruncateOverflowingText() const;
int GetLayoutPassCountForTesting();
// This is public only for use by LayoutNG, so that NGBlockNode can call it.
void IncrementLayoutPassCount();
protected: protected:
LayoutUnit MaxPositiveMarginBefore() const { LayoutUnit MaxPositiveMarginBefore() const {
NOT_DESTROYED(); NOT_DESTROYED();
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/layout/layout_block_flow.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
namespace blink {
class LayoutCountTest : public RenderingTest {};
TEST_F(LayoutCountTest, SimpleBlockLayoutIsOnePass) {
ScopedTrackLayoutPassesPerBlockForTest track_layout_passes_per_block(true);
SetBodyInnerHTML(
"<!DOCTYPE html>"
" <div id='block' style='height:1000px'>Item</div>");
auto* block = To<LayoutBlockFlow>(
GetDocument().getElementById("block")->GetLayoutObject());
ASSERT_EQ(block->GetLayoutPassCountForTesting(), 1);
}
} // namespace blink
...@@ -420,10 +420,6 @@ scoped_refptr<const NGLayoutResult> NGBlockNode::Layout( ...@@ -420,10 +420,6 @@ scoped_refptr<const NGLayoutResult> NGBlockNode::Layout(
if (!CanUseNewLayout()) if (!CanUseNewLayout())
return RunLegacyLayout(constraint_space); return RunLegacyLayout(constraint_space);
auto* block_flow = DynamicTo<LayoutBlockFlow>(box_);
if (RuntimeEnabledFeatures::TrackLayoutPassesPerBlockEnabled() && block_flow)
block_flow->IncrementLayoutPassCount();
// The exclusion space internally is a pointer to a shared vector, and // The exclusion space internally is a pointer to a shared vector, and
// equality of exclusion spaces is performed using pointer comparison on this // equality of exclusion spaces is performed using pointer comparison on this
// internal shared vector. // internal shared vector.
...@@ -476,6 +472,8 @@ scoped_refptr<const NGLayoutResult> NGBlockNode::Layout( ...@@ -476,6 +472,8 @@ scoped_refptr<const NGLayoutResult> NGBlockNode::Layout(
NGLayoutAlgorithmParams params(*this, *fragment_geometry, constraint_space, NGLayoutAlgorithmParams params(*this, *fragment_geometry, constraint_space,
break_token, early_break); break_token, early_break);
auto* block_flow = DynamicTo<LayoutBlockFlow>(box_);
// Try to perform "simplified" layout. // Try to perform "simplified" layout.
if (cache_status == NGLayoutCacheStatus::kNeedsSimplifiedLayout && if (cache_status == NGLayoutCacheStatus::kNeedsSimplifiedLayout &&
!GetFlowThread(block_flow)) { !GetFlowThread(block_flow)) {
......
...@@ -1868,11 +1868,6 @@ ...@@ -1868,11 +1868,6 @@
origin_trial_feature_name: "ForceTouchEventFeatureDetectionForInspector", origin_trial_feature_name: "ForceTouchEventFeatureDetectionForInspector",
status: "stable", status: "stable",
}, },
// When enabled, tracks the number of times each LayoutBlock
// goes through layout. For testing purposes only.
{
name: "TrackLayoutPassesPerBlock",
},
{ {
name: "TransferableStreams", name: "TransferableStreams",
status: "experimental", status: "experimental",
......
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