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

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

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
Index: third_party/WebKit/Source/core/paint/PaintTiming.h
diff --git a/third_party/WebKit/Source/core/paint/PaintTiming.h b/third_party/WebKit/Source/core/paint/PaintTiming.h
index c62174e9a9221c94dd0b3a3af4d3443bfc9b8927..b2a28a1b3041df71f736cdfb4305fa1a544d33b2 100644
--- a/third_party/WebKit/Source/core/paint/PaintTiming.h
+++ b/third_party/WebKit/Source/core/paint/PaintTiming.h
@@ -8,28 +8,55 @@
#include "core/dom/Document.h"
#include "platform/Supplementable.h"
#include "platform/heap/Handle.h"
+#include "wtf/Noncopyable.h"
namespace blink {
class LocalFrame;
+// PaintTiming is responsible for tracking paint-related timings for a given
+// document.
class PaintTiming final : public NoBaseWillBeGarbageCollectedFinalized<PaintTiming>, public WillBeHeapSupplement<Document> {
+ WTF_MAKE_NONCOPYABLE(PaintTiming);
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PaintTiming);
public:
virtual ~PaintTiming() { }
static PaintTiming& from(Document&);
+ // mark*() methods record the time for the given paint event, record a trace
+ // event, and notify that paint timing has changed. These methods do nothing
+ // (early return) if a time has already been recorded for the given paint
+ // event.
void markFirstPaint();
+
+ // markFirstTextPaint, markFirstImagePaint, and markFirstContentfulPaint
+ // will also record first paint if first paint hasn't been recorded yet.
+ void markFirstContentfulPaint();
+
+ // markFirstTextPaint and markFirstImagePaint will also record first
+ // contentful paint if first contentful paint hasn't been recorded yet.
void markFirstTextPaint();
void markFirstImagePaint();
- void markFirstContentfulPaint();
- // These return monotonically-increasing seconds.
+ // The getters below return monotonically-increasing seconds, or zero if the
+ // given paint event has not yet occurred. See the comments for
+ // monotonicallyIncreasingTime in wtf/CurrentTime.h for additional details.
+
+ // firstPaint returns the first time that anything was painted for the
+ // current document.
double firstPaint() const { return m_firstPaint; }
+
+ // firstContentfulPaint returns the first time that 'contentful' content was
+ // painted. For instance, the first time that text or image content was
+ // painted.
+ double firstContentfulPaint() const { return m_firstContentfulPaint; }
+
+ // firstTextPaint returns the first time that text content was painted.
double firstTextPaint() const { return m_firstTextPaint; }
+
+ // firstImagePaint returns the first time that image content was painted.
double firstImagePaint() const { return m_firstImagePaint; }
- double firstContentfulPaint() const { return m_firstContentfulPaint; }
DECLARE_VIRTUAL_TRACE();
@@ -38,6 +65,18 @@ private:
LocalFrame* frame() const;
void notifyPaintTimingChanged();
+ // set*() set the timing for the given paint event to the given timestamp
+ // and record a trace event if the value is currently zero, but do not
+ // notify that paint timing changed. These methods can be invoked from other
+ // mark*() or set*() methods to make sure that first paint is marked as part
+ // of marking first contentful paint, or that first contentful paint is
+ // marked as part of marking first text/image paint, for example.
+ void setFirstPaint(double stamp);
+
+ // setFirstContentfulPaint will also set first paint time if first paint
+ // time has not yet been recorded.
+ void setFirstContentfulPaint(double stamp);
+
double m_firstPaint = 0.0;
double m_firstTextPaint = 0.0;
double m_firstImagePaint = 0.0;

Powered by Google App Engine
This is Rietveld 408576698