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

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

Issue 34623009: Revamp style resolver stats (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix stats for mac, crazy StyleResolver constructor side effects Created 7 years, 1 month 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 | « Source/core/css/resolver/StyleResolverStats.cpp ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index ab1e4efa16585612da3153947a4803a48e31b440..9434464ee0b25904c59243bbd9873e9233bc785f 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -55,6 +55,7 @@
#include "core/css/StyleSheetList.h"
#include "core/css/resolver/FontBuilder.h"
#include "core/css/resolver/StyleResolver.h"
+#include "core/css/resolver/StyleResolverStats.h"
#include "core/dom/AddConsoleMessageTask.h"
#include "core/dom/Attr.h"
#include "core/dom/CDATASection.h"
@@ -1691,6 +1692,11 @@ void Document::recalcStyle(StyleRecalcChange change)
if (styleChangeType() >= SubtreeStyleChange)
change = Force;
+ // FIXME: Cannot access the styleResolver() before calling styleForDocument below because
+ // apparently the StyleResolver's constructor has side effects. We should fix it.
+ // See printing/setPrinting.html, printing/width-overflow.html though they only fail on
+ // mac when accessing the resolver by what appears to be a viewport size difference.
+
if (change == Force || (change >= Inherit && shouldDisplaySeamlesslyWithParent())) {
m_hasNodesWithPlaceholderStyle = false;
RefPtr<RenderStyle> documentStyle = StyleResolver::styleForDocument(*this, m_styleResolver ? m_styleResolver->fontSelector() : 0);
@@ -1701,12 +1707,23 @@ void Document::recalcStyle(StyleRecalcChange change)
clearNeedsStyleRecalc();
+ // Uncomment to enable printing of statistics about style sharing and the matched property cache.
+ // Optionally pass StyleResolver::ReportSlowStats to print numbers that require crawling the
+ // entire DOM (where collecting them is very slow).
+ // FIXME: Expose this as a runtime flag.
+ // styleResolver()->enableStats(/*StyleResolver::ReportSlowStats*/);
+
+ if (StyleResolverStats* stats = styleResolver()->stats())
+ stats->reset();
+
if (Element* documentElement = this->documentElement()) {
inheritHtmlAndBodyElementStyles(change);
if (shouldRecalcStyle(change, documentElement))
documentElement->recalcStyle(change);
}
+ styleResolver()->printStats();
+
view()->updateCompositingLayersAfterStyleChange();
clearChildNeedsStyleRecalc();
@@ -1724,9 +1741,6 @@ void Document::recalcStyle(StyleRecalcChange change)
}
}
- STYLE_STATS_PRINT();
- STYLE_STATS_CLEAR();
-
InspectorInstrumentation::didRecalculateStyle(cookie);
// As a result of the style recalculation, the currently hovered element might have been
« no previous file with comments | « Source/core/css/resolver/StyleResolverStats.cpp ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698