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

Unified Diff: third_party/WebKit/Source/core/paint/PaintTiming.cpp

Issue 1715513002: Move background related shorthands into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase test Created 4 years, 10 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/paint/PaintTiming.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintTiming.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintTiming.cpp b/third_party/WebKit/Source/core/paint/PaintTiming.cpp
index 87884799a2a4667e6a77f25b5c15f78504e791b5..aa205b6548752a69c6027c88ff6efa02461fbc7a 100644
--- a/third_party/WebKit/Source/core/paint/PaintTiming.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintTiming.cpp
@@ -23,33 +23,26 @@ PaintTiming& PaintTiming::from(Document& document)
return *timing;
}
-PaintTiming::PaintTiming(Document& document)
- : m_document(document)
-{
-}
-
-DEFINE_TRACE(PaintTiming)
-{
- visitor->trace(m_document);
-}
-
-LocalFrame* PaintTiming::frame() const
-{
- return m_document ? m_document->frame() : nullptr;
-}
-
-void PaintTiming::notifyPaintTimingChanged()
+void PaintTiming::markFirstPaint()
{
- if (m_document && m_document->loader())
- m_document->loader()->didChangePerformanceTiming();
+ // Test that m_firstPaint is non-zero here, as well as in setFirstPaint, so
+ // we avoid invoking monotonicallyIncreasingTime() on every call to
+ // markFirstPaint().
+ if (m_firstPaint != 0.0)
+ return;
+ setFirstPaint(monotonicallyIncreasingTime());
+ notifyPaintTimingChanged();
}
-void PaintTiming::markFirstPaint()
+void PaintTiming::markFirstContentfulPaint()
{
- if (m_firstPaint != 0.0)
+ // Test that m_firstContentfulPaint is non-zero here, as well as in
+ // setFirstContentfulPaint, so we avoid invoking
+ // monotonicallyIncreasingTime() on every call to
+ // markFirstContentfulPaint().
+ if (m_firstContentfulPaint != 0.0)
return;
- m_firstPaint = monotonicallyIncreasingTime();
- TRACE_EVENT_INSTANT1("blink.user_timing", "firstPaint", TRACE_EVENT_SCOPE_PROCESS, "frame", frame());
+ setFirstContentfulPaint(monotonicallyIncreasingTime());
notifyPaintTimingChanged();
}
@@ -58,12 +51,9 @@ void PaintTiming::markFirstTextPaint()
if (m_firstTextPaint != 0.0)
return;
m_firstTextPaint = monotonicallyIncreasingTime();
+ setFirstContentfulPaint(m_firstTextPaint);
TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "firstTextPaint", m_firstTextPaint, "frame", frame());
-
- if (firstContentfulPaint() == 0.0)
- markFirstContentfulPaint();
- else
- notifyPaintTimingChanged();
+ notifyPaintTimingChanged();
}
void PaintTiming::markFirstImagePaint()
@@ -71,21 +61,47 @@ void PaintTiming::markFirstImagePaint()
if (m_firstImagePaint != 0.0)
return;
m_firstImagePaint = monotonicallyIncreasingTime();
+ setFirstContentfulPaint(m_firstImagePaint);
TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "firstImagePaint", m_firstImagePaint, "frame", frame());
+ notifyPaintTimingChanged();
+}
- if (firstContentfulPaint() == 0.0)
- markFirstContentfulPaint();
- else
- notifyPaintTimingChanged();
+DEFINE_TRACE(PaintTiming)
+{
+ visitor->trace(m_document);
}
-void PaintTiming::markFirstContentfulPaint()
+PaintTiming::PaintTiming(Document& document)
+ : m_document(document)
+{
+}
+
+LocalFrame* PaintTiming::frame() const
+{
+ return m_document ? m_document->frame() : nullptr;
+}
+
+void PaintTiming::notifyPaintTimingChanged()
+{
+ if (m_document && m_document->loader())
+ m_document->loader()->didChangePerformanceTiming();
+}
+
+void PaintTiming::setFirstPaint(double stamp)
+{
+ if (m_firstPaint != 0.0)
+ return;
+ m_firstPaint = stamp;
+ TRACE_EVENT_INSTANT1("blink.user_timing", "firstPaint", TRACE_EVENT_SCOPE_PROCESS, "frame", frame());
+}
+
+void PaintTiming::setFirstContentfulPaint(double stamp)
{
if (m_firstContentfulPaint != 0.0)
return;
- m_firstContentfulPaint = monotonicallyIncreasingTime();
+ setFirstPaint(stamp);
+ m_firstContentfulPaint = stamp;
TRACE_EVENT_INSTANT1("blink.user_timing", "firstContentfulPaint", TRACE_EVENT_SCOPE_PROCESS, "frame", frame());
- notifyPaintTimingChanged();
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintTiming.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698