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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1577433003: Statistics of LayoutBox rare data reasons Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 m_hasMarkupTruncation(false), 96 m_hasMarkupTruncation(false),
97 m_widthAvailableToChildrenChanged(false), 97 m_widthAvailableToChildrenChanged(false),
98 m_heightAvailableToChildrenChanged(false), 98 m_heightAvailableToChildrenChanged(false),
99 m_isSelfCollapsing(false), 99 m_isSelfCollapsing(false),
100 m_descendantsWithFloatsMarkedForLayout(false), 100 m_descendantsWithFloatsMarkedForLayout(false),
101 m_hasPositionedObjects(false), 101 m_hasPositionedObjects(false),
102 m_hasPercentHeightDescendants(false), 102 m_hasPercentHeightDescendants(false),
103 m_paginationStateChanged(false) { 103 m_paginationStateChanged(false) {
104 // LayoutBlockFlow calls setChildrenInline(true). 104 // LayoutBlockFlow calls setChildrenInline(true).
105 // By default, subclasses do not have inline children. 105 // By default, subclasses do not have inline children.
106 m_rareStat.addReason(ReasonLBLAll);
106 } 107 }
107 108
108 void LayoutBlock::removeFromGlobalMaps() { 109 void LayoutBlock::removeFromGlobalMaps() {
109 if (hasPositionedObjects()) { 110 if (hasPositionedObjects()) {
110 std::unique_ptr<TrackedLayoutBoxListHashSet> descendants = 111 std::unique_ptr<TrackedLayoutBoxListHashSet> descendants =
111 gPositionedDescendantsMap->take(this); 112 gPositionedDescendantsMap->take(this);
112 ASSERT(!descendants->isEmpty()); 113 ASSERT(!descendants->isEmpty());
113 for (LayoutBox* descendant : *descendants) { 114 for (LayoutBox* descendant : *descendants) {
114 ASSERT(gPositionedContainerMap->at(descendant) == this); 115 ASSERT(gPositionedContainerMap->at(descendant) == this);
115 gPositionedContainerMap->erase(descendant); 116 gPositionedContainerMap->erase(descendant);
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 if (!gPositionedDescendantsMap) 949 if (!gPositionedDescendantsMap)
949 gPositionedDescendantsMap = new TrackedDescendantsMap; 950 gPositionedDescendantsMap = new TrackedDescendantsMap;
950 TrackedLayoutBoxListHashSet* descendantSet = 951 TrackedLayoutBoxListHashSet* descendantSet =
951 gPositionedDescendantsMap->at(this); 952 gPositionedDescendantsMap->at(this);
952 if (!descendantSet) { 953 if (!descendantSet) {
953 descendantSet = new TrackedLayoutBoxListHashSet; 954 descendantSet = new TrackedLayoutBoxListHashSet;
954 gPositionedDescendantsMap->set(this, WTF::wrapUnique(descendantSet)); 955 gPositionedDescendantsMap->set(this, WTF::wrapUnique(descendantSet));
955 } 956 }
956 descendantSet->insert(o); 957 descendantSet->insert(o);
957 958
959 o->m_rareStat.addReason(ReasonLBPositionedContainer);
960 m_rareStat.addReason(ReasonLBLPositionedDescendants);
961
958 m_hasPositionedObjects = true; 962 m_hasPositionedObjects = true;
959 } 963 }
960 964
961 void LayoutBlock::removePositionedObject(LayoutBox* o) { 965 void LayoutBlock::removePositionedObject(LayoutBox* o) {
962 if (!gPositionedContainerMap) 966 if (!gPositionedContainerMap)
963 return; 967 return;
964 968
965 LayoutBlock* container = gPositionedContainerMap->take(o); 969 LayoutBlock* container = gPositionedContainerMap->take(o);
966 if (!container) 970 if (!container)
967 return; 971 return;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 if (!gPercentHeightDescendantsMap) 1061 if (!gPercentHeightDescendantsMap)
1058 gPercentHeightDescendantsMap = new TrackedDescendantsMap; 1062 gPercentHeightDescendantsMap = new TrackedDescendantsMap;
1059 TrackedLayoutBoxListHashSet* descendantSet = 1063 TrackedLayoutBoxListHashSet* descendantSet =
1060 gPercentHeightDescendantsMap->at(this); 1064 gPercentHeightDescendantsMap->at(this);
1061 if (!descendantSet) { 1065 if (!descendantSet) {
1062 descendantSet = new TrackedLayoutBoxListHashSet; 1066 descendantSet = new TrackedLayoutBoxListHashSet;
1063 gPercentHeightDescendantsMap->set(this, WTF::wrapUnique(descendantSet)); 1067 gPercentHeightDescendantsMap->set(this, WTF::wrapUnique(descendantSet));
1064 } 1068 }
1065 descendantSet->insert(descendant); 1069 descendantSet->insert(descendant);
1066 1070
1071 m_rareStat.addReason(ReasonLBLPercentHeightDescendants);
1072
1067 m_hasPercentHeightDescendants = true; 1073 m_hasPercentHeightDescendants = true;
1068 } 1074 }
1069 1075
1070 void LayoutBlock::removePercentHeightDescendant(LayoutBox* descendant) { 1076 void LayoutBlock::removePercentHeightDescendant(LayoutBox* descendant) {
1071 if (TrackedLayoutBoxListHashSet* descendants = percentHeightDescendants()) { 1077 if (TrackedLayoutBoxListHashSet* descendants = percentHeightDescendants()) {
1072 descendants->erase(descendant); 1078 descendants->erase(descendant);
1073 descendant->setPercentHeightContainer(nullptr); 1079 descendant->setPercentHeightContainer(nullptr);
1074 if (descendants->isEmpty()) { 1080 if (descendants->isEmpty()) {
1075 gPercentHeightDescendantsMap->erase(this); 1081 gPercentHeightDescendantsMap->erase(this);
1076 m_hasPercentHeightDescendants = false; 1082 m_hasPercentHeightDescendants = false;
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
2166 } 2172 }
2167 2173
2168 return availableHeight; 2174 return availableHeight;
2169 } 2175 }
2170 2176
2171 bool LayoutBlock::hasDefiniteLogicalHeight() const { 2177 bool LayoutBlock::hasDefiniteLogicalHeight() const {
2172 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); 2178 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1);
2173 } 2179 }
2174 2180
2175 } // namespace blink 2181 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698