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

Unified Diff: third_party/WebKit/Source/core/css/StyleSheetContents.cpp

Issue 2468913002: Add CSSTiming to collect aggregate PLT-level stats about CSS. (Closed)
Patch Set: fix browser test Created 4 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
Index: third_party/WebKit/Source/core/css/StyleSheetContents.cpp
diff --git a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
index 0e6397fa873fbed6093505d54431650d9a884b2d..668a264c1c175bfd0a32ecb132a6339163fc3994 100644
--- a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
+++ b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
@@ -21,6 +21,7 @@
#include "core/css/StyleSheetContents.h"
#include "core/css/CSSStyleSheet.h"
+#include "core/css/CSSTiming.h"
#include "core/css/StylePropertySet.h"
#include "core/css/StyleRule.h"
#include "core/css/StyleRuleImport.h"
@@ -327,7 +328,7 @@ void StyleSheetContents::parseAuthorStyleSheet(
const SecurityOrigin* securityOrigin) {
TRACE_EVENT1("blink,devtools.timeline", "ParseAuthorStyleSheet", "data",
InspectorParseAuthorStyleSheetEvent::data(cachedStyleSheet));
- SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Style.AuthorStyleSheet.ParseTime");
+ double startTimeMS = monotonicallyIncreasingTimeMS();
bool isSameOriginRequest =
securityOrigin && securityOrigin->canRequest(baseURL());
@@ -360,6 +361,16 @@ void StyleSheetContents::parseAuthorStyleSheet(
CSSParserContext context(parserContext(), UseCounter::getFrom(this));
CSSParser::parseSheet(context, this, sheetText,
RuntimeEnabledFeatures::lazyParseCSSEnabled());
+
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, parseHistogram,
+ ("Style.AuthorStyleSheet.ParseTime", 0, 10000000, 50));
+ double parseDurationMS = (monotonicallyIncreasingTimeMS() - startTimeMS);
+ parseHistogram.count(parseDurationMS * 1000);
+ if (Document* document = singleOwnerDocument()) {
+ // CSSTiming expects time in seconds.
+ CSSTiming::from(*document).recordAuthorStyleSheetParseTime(parseDurationMS /
+ 1000);
+ }
}
void StyleSheetContents::parseString(const String& sheetText) {
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSTiming.cpp ('k') | third_party/WebKit/Source/core/timing/PerformanceTiming.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698