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

Unified Diff: Source/core/testing/Internals.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/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index bad025393980c4db3519338174a074dce763b326..d438771fc80ff3f69537a188dcfad139e8a171f0 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -45,6 +45,7 @@
#include "core/animation/DocumentTimeline.h"
#include "core/css/StyleSheetContents.h"
#include "core/css/resolver/StyleResolver.h"
+#include "core/css/resolver/StyleResolverStats.h"
#include "core/css/resolver/ViewportStyleResolver.h"
#include "core/dom/ClientRect.h"
#include "core/dom/ClientRectList.h"
@@ -303,6 +304,35 @@ void Internals::crash()
CRASH();
}
+void Internals::setStyleResolverStatsEnabled(bool enabled)
+{
+ Document* document = contextDocument();
+ if (enabled)
+ document->styleResolver()->enableStats(StyleResolver::ReportSlowStats);
+ else
+ document->styleResolver()->disableStats();
+}
+
+String Internals::styleResolverStatsReport(ExceptionState& es) const
+{
+ Document* document = contextDocument();
+ if (!document->styleResolver()->stats()) {
+ es.throwDOMException(InvalidStateError, "Style resolver stats not enabled");
+ return String();
+ }
+ return document->styleResolver()->stats()->report();
+}
+
+String Internals::styleResolverStatsTotalsReport(ExceptionState& es) const
+{
+ Document* document = contextDocument();
+ if (!document->styleResolver()->statsTotals()) {
+ es.throwDOMException(InvalidStateError, "Style resolver stats not enabled");
+ return String();
+ }
+ return document->styleResolver()->statsTotals()->report();
+}
+
PassRefPtr<Element> Internals::createContentElement(ExceptionState& es)
{
Document* document = contextDocument();
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698