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

Side by Side 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, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PaintTiming_h 5 #ifndef PaintTiming_h
6 #define PaintTiming_h 6 #define PaintTiming_h
7 7
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "platform/Supplementable.h" 9 #include "platform/Supplementable.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 #include "wtf/Noncopyable.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 class LocalFrame; 15 class LocalFrame;
15 16
17 // PaintTiming is responsible for tracking paint-related timings for a given
18 // document.
16 class PaintTiming final : public NoBaseWillBeGarbageCollectedFinalized<PaintTimi ng>, public WillBeHeapSupplement<Document> { 19 class PaintTiming final : public NoBaseWillBeGarbageCollectedFinalized<PaintTimi ng>, public WillBeHeapSupplement<Document> {
20 WTF_MAKE_NONCOPYABLE(PaintTiming);
17 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PaintTiming); 21 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PaintTiming);
18 public: 22 public:
19 virtual ~PaintTiming() { } 23 virtual ~PaintTiming() { }
20 24
21 static PaintTiming& from(Document&); 25 static PaintTiming& from(Document&);
22 26
27 // mark*() methods record the time for the given paint event, record a trace
28 // event, and notify that paint timing has changed. These methods do nothing
29 // (early return) if a time has already been recorded for the given paint
30 // event.
23 void markFirstPaint(); 31 void markFirstPaint();
32
33 // markFirstTextPaint, markFirstImagePaint, and markFirstContentfulPaint
34 // will also record first paint if first paint hasn't been recorded yet.
35 void markFirstContentfulPaint();
36
37 // markFirstTextPaint and markFirstImagePaint will also record first
38 // contentful paint if first contentful paint hasn't been recorded yet.
24 void markFirstTextPaint(); 39 void markFirstTextPaint();
25 void markFirstImagePaint(); 40 void markFirstImagePaint();
26 void markFirstContentfulPaint();
27 41
28 // These return monotonically-increasing seconds. 42 // The getters below return monotonically-increasing seconds, or zero if the
43 // given paint event has not yet occurred. See the comments for
44 // monotonicallyIncreasingTime in wtf/CurrentTime.h for additional details.
45
46 // firstPaint returns the first time that anything was painted for the
47 // current document.
29 double firstPaint() const { return m_firstPaint; } 48 double firstPaint() const { return m_firstPaint; }
49
50 // firstContentfulPaint returns the first time that 'contentful' content was
51 // painted. For instance, the first time that text or image content was
52 // painted.
53 double firstContentfulPaint() const { return m_firstContentfulPaint; }
54
55 // firstTextPaint returns the first time that text content was painted.
30 double firstTextPaint() const { return m_firstTextPaint; } 56 double firstTextPaint() const { return m_firstTextPaint; }
57
58 // firstImagePaint returns the first time that image content was painted.
31 double firstImagePaint() const { return m_firstImagePaint; } 59 double firstImagePaint() const { return m_firstImagePaint; }
32 double firstContentfulPaint() const { return m_firstContentfulPaint; }
33 60
34 DECLARE_VIRTUAL_TRACE(); 61 DECLARE_VIRTUAL_TRACE();
35 62
36 private: 63 private:
37 explicit PaintTiming(Document&); 64 explicit PaintTiming(Document&);
38 LocalFrame* frame() const; 65 LocalFrame* frame() const;
39 void notifyPaintTimingChanged(); 66 void notifyPaintTimingChanged();
40 67
68 // set*() set the timing for the given paint event to the given timestamp
69 // and record a trace event if the value is currently zero, but do not
70 // notify that paint timing changed. These methods can be invoked from other
71 // mark*() or set*() methods to make sure that first paint is marked as part
72 // of marking first contentful paint, or that first contentful paint is
73 // marked as part of marking first text/image paint, for example.
74 void setFirstPaint(double stamp);
75
76 // setFirstContentfulPaint will also set first paint time if first paint
77 // time has not yet been recorded.
78 void setFirstContentfulPaint(double stamp);
79
41 double m_firstPaint = 0.0; 80 double m_firstPaint = 0.0;
42 double m_firstTextPaint = 0.0; 81 double m_firstTextPaint = 0.0;
43 double m_firstImagePaint = 0.0; 82 double m_firstImagePaint = 0.0;
44 double m_firstContentfulPaint = 0.0; 83 double m_firstContentfulPaint = 0.0;
45 84
46 RawPtrWillBeMember<Document> m_document; 85 RawPtrWillBeMember<Document> m_document;
47 }; 86 };
48 87
49 } // namespace blink 88 } // namespace blink
50 89
51 #endif 90 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698