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

Unified Diff: third_party/WebKit/Source/core/css/CSSTiming.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/CSSTiming.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSTiming.cpp b/third_party/WebKit/Source/core/css/CSSTiming.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..abb080559bb69b3e80b68b540935c0e63a115604
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/CSSTiming.cpp
@@ -0,0 +1,37 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/css/CSSTiming.h"
+
+#include "core/paint/PaintTiming.h"
+
+namespace blink {
+
+static const char kSupplementName[] = "CSSTiming";
+
+CSSTiming& CSSTiming::from(Document& document) {
+ CSSTiming* timing = static_cast<CSSTiming*>(
+ Supplement<Document>::from(document, kSupplementName));
+ if (!timing) {
+ timing = new CSSTiming(document);
+ Supplement<Document>::provideTo(document, kSupplementName, timing);
+ }
+ return *timing;
+}
+
+void CSSTiming::recordAuthorStyleSheetParseTime(double seconds) {
+ if (!m_paintTiming->firstContentfulPaint())
+ m_parseTimeBeforeFCP += seconds;
+}
+
+DEFINE_TRACE(CSSTiming) {
+ visitor->trace(m_document);
+ visitor->trace(m_paintTiming);
+ Supplement<Document>::trace(visitor);
+}
+
+CSSTiming::CSSTiming(Document& document)
+ : m_document(document), m_paintTiming(PaintTiming::from(document)) {}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSTiming.h ('k') | third_party/WebKit/Source/core/css/StyleSheetContents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698