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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1644543002: Moved element style recalc count and stats to StyleEngine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 281497ca4858358e3a6b229b6f1806410ff59386..c655c6f33ac68eb4000b0d3d7126ea656ea08d6f 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -452,7 +452,6 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsTimerFired)
, m_timers(timerTaskRunner()->adoptClone())
, m_hasViewportUnits(false)
- , m_styleRecalcElementCounter(0)
, m_parserSyncPolicy(AllowAsynchronousParsing)
, m_nodeCount(0)
{
@@ -1775,8 +1774,8 @@ void Document::updateLayoutTree(StyleRecalcChange change)
TRACE_EVENT_BEGIN1("blink,devtools.timeline", "UpdateLayoutTree", "beginData", InspectorRecalculateStylesEvent::data(frame()));
TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "UpdateLayoutTree");
- // FIXME: Remove m_styleRecalcElementCounter, we should just use the accessCount() on the resolver.
- m_styleRecalcElementCounter = 0;
+ unsigned startElementCount = styleEngine().styleForElementCount();
+
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this);
DocumentAnimations::updateAnimationTimingIfNeeded(*this);
@@ -1808,8 +1807,10 @@ void Document::updateLayoutTree(StyleRecalcChange change)
ASSERT(!DocumentAnimations::needsAnimationTimingUpdate(*this));
- TRACE_EVENT_END1("blink,devtools.timeline", "UpdateLayoutTree", "elementCount", m_styleRecalcElementCounter);
- InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCounter);
+ unsigned elementCount = styleEngine().styleForElementCount() - startElementCount;
+
+ TRACE_EVENT_END1("blink,devtools.timeline", "UpdateLayoutTree", "elementCount", elementCount);
+ InspectorInstrumentation::didRecalculateStyle(cookie, elementCount);
#if ENABLE(ASSERT)
assertLayoutTreeUpdated(*this);
@@ -1822,7 +1823,7 @@ void Document::updateStyle(StyleRecalcChange change)
return;
TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle");
- unsigned initialResolverAccessCount = styleEngine().resolverAccessCount();
+ unsigned initialElementCount = styleEngine().styleForElementCount();
HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc);
@@ -1851,7 +1852,7 @@ void Document::updateStyle(StyleRecalcChange change)
bool shouldRecordStats;
TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats);
- resolver.setStatsEnabled(shouldRecordStats);
+ styleEngine().setStatsEnabled(shouldRecordStats);
if (Element* documentElement = this->documentElement()) {
inheritHtmlAndBodyElementStyles(change);
@@ -1880,11 +1881,11 @@ void Document::updateStyle(StyleRecalcChange change)
m_lifecycle.advanceTo(DocumentLifecycle::StyleClean);
if (shouldRecordStats) {
TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle",
- "resolverAccessCount", styleEngine().resolverAccessCount() - initialResolverAccessCount,
- "counters", resolver.stats()->toTracedValue());
+ "resolverAccessCount", styleEngine().styleForElementCount() - initialElementCount,
+ "counters", styleEngine().stats()->toTracedValue());
} else {
TRACE_EVENT_END1("blink,blink_style", "Document::updateStyle",
- "resolverAccessCount", styleEngine().resolverAccessCount() - initialResolverAccessCount);
+ "resolverAccessCount", styleEngine().styleForElementCount() - initialElementCount);
}
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698