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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutObject.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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index e0ce2763815212db5fd5cbbc3ee6b5bf4cf95dff..2f73f09c97af5433dac6bf5c4f4a609fb0e3f9ea 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -101,6 +101,12 @@ static bool gModifyLayoutTreeStructureAnyState = false;
} // namespace
+int RareDataStat::s_reasonCounts[MaxReason] = {0};
+
+int* rareDataReasonCounts() {
+ return RareDataStat::s_reasonCounts;
+}
+
#if DCHECK_IS_ON()
LayoutObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope(
@@ -129,8 +135,8 @@ struct SameSizeAsLayoutObject : DisplayItemClient {
std::unique_ptr<void*> m_paintProperties;
};
-static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject),
- "LayoutObject should stay small");
+// static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject),
+// "LayoutObject should stay small");
bool LayoutObject::s_affectsParentBlock = false;
@@ -232,6 +238,8 @@ LayoutObject::LayoutObject(Node* node)
InstanceCounters::incrementCounter(InstanceCounters::LayoutObjectCounter);
if (m_node)
frameView()->incrementLayoutObjectCount();
+
+ m_rareStat.addReason(ReasonLOAll);
}
LayoutObject::~LayoutObject() {
@@ -1210,6 +1218,18 @@ PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(
setVisualRect(newVisualRect);
paintInvalidator.setLocationInBacking(context.newLocation);
+ if (!newVisualRect.isEmpty() &&
+ newVisualRect.location() != context.newLocation) {
+ m_rareStat.addReason(ReasonLocationOffsetObject);
+ if (isBox())
+ m_rareStat.addReason(ReasonLocationOffsetBox);
+ if (isText())
+ m_rareStat.addReason(ReasonLocationOffsetText);
+ if (isLayoutInline())
+ m_rareStat.addReason(ReasonLocationOffsetInline);
+ if (isSVG())
+ m_rareStat.addReason(ReasonLocationOffsetSVG);
+ }
if (!shouldCheckForPaintInvalidation() &&
paintInvalidationState
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698