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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintTiming.h

Issue 2039363003: FirstMeaningfulPaint UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ready for review Created 4 years, 4 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 "core/paint/FirstMeaningfulPaintDetector.h"
9 #include "platform/Supplementable.h" 10 #include "platform/Supplementable.h"
10 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
11 #include "wtf/Noncopyable.h" 12 #include "wtf/Noncopyable.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class LocalFrame; 16 class LocalFrame;
16 17
17 // PaintTiming is responsible for tracking paint-related timings for a given 18 // PaintTiming is responsible for tracking paint-related timings for a given
18 // document. 19 // document.
(...skipping 13 matching lines...) Expand all
32 33
33 // markFirstTextPaint, markFirstImagePaint, and markFirstContentfulPaint 34 // markFirstTextPaint, markFirstImagePaint, and markFirstContentfulPaint
34 // will also record first paint if first paint hasn't been recorded yet. 35 // will also record first paint if first paint hasn't been recorded yet.
35 void markFirstContentfulPaint(); 36 void markFirstContentfulPaint();
36 37
37 // markFirstTextPaint and markFirstImagePaint will also record first 38 // markFirstTextPaint and markFirstImagePaint will also record first
38 // contentful paint if first contentful paint hasn't been recorded yet. 39 // contentful paint if first contentful paint hasn't been recorded yet.
39 void markFirstTextPaint(); 40 void markFirstTextPaint();
40 void markFirstImagePaint(); 41 void markFirstImagePaint();
41 42
43 void setFirstMeaningfulPaint(double stamp);
44
42 // The getters below return monotonically-increasing seconds, or zero if the 45 // The getters below return monotonically-increasing seconds, or zero if the
43 // given paint event has not yet occurred. See the comments for 46 // given paint event has not yet occurred. See the comments for
44 // monotonicallyIncreasingTime in wtf/CurrentTime.h for additional details. 47 // monotonicallyIncreasingTime in wtf/CurrentTime.h for additional details.
45 48
46 // firstPaint returns the first time that anything was painted for the 49 // firstPaint returns the first time that anything was painted for the
47 // current document. 50 // current document.
48 double firstPaint() const { return m_firstPaint; } 51 double firstPaint() const { return m_firstPaint; }
49 52
50 // firstContentfulPaint returns the first time that 'contentful' content was 53 // firstContentfulPaint returns the first time that 'contentful' content was
51 // painted. For instance, the first time that text or image content was 54 // painted. For instance, the first time that text or image content was
52 // painted. 55 // painted.
53 double firstContentfulPaint() const { return m_firstContentfulPaint; } 56 double firstContentfulPaint() const { return m_firstContentfulPaint; }
54 57
55 // firstTextPaint returns the first time that text content was painted. 58 // firstTextPaint returns the first time that text content was painted.
56 double firstTextPaint() const { return m_firstTextPaint; } 59 double firstTextPaint() const { return m_firstTextPaint; }
57 60
58 // firstImagePaint returns the first time that image content was painted. 61 // firstImagePaint returns the first time that image content was painted.
59 double firstImagePaint() const { return m_firstImagePaint; } 62 double firstImagePaint() const { return m_firstImagePaint; }
60 63
64 // firstMeaningfulPaint returns the first time that page's primary content
65 // was painted.
66 double firstMeaningfulPaint() const { return m_firstMeaningfulPaint; }
67
68 Document* document() { return m_document.get(); }
69 FirstMeaningfulPaintDetector& firstMeaningfulPaintDetector() { return *m_fmp Detector; }
70
61 DECLARE_VIRTUAL_TRACE(); 71 DECLARE_VIRTUAL_TRACE();
62 72
63 private: 73 private:
64 explicit PaintTiming(Document&); 74 explicit PaintTiming(Document&);
65 LocalFrame* frame() const; 75 LocalFrame* frame() const;
66 void notifyPaintTimingChanged(); 76 void notifyPaintTimingChanged();
67 77
68 // set*() set the timing for the given paint event to the given timestamp 78 // 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 79 // 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 80 // 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 81 // 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 82 // of marking first contentful paint, or that first contentful paint is
73 // marked as part of marking first text/image paint, for example. 83 // marked as part of marking first text/image paint, for example.
74 void setFirstPaint(double stamp); 84 void setFirstPaint(double stamp);
75 85
76 // setFirstContentfulPaint will also set first paint time if first paint 86 // setFirstContentfulPaint will also set first paint time if first paint
77 // time has not yet been recorded. 87 // time has not yet been recorded.
78 void setFirstContentfulPaint(double stamp); 88 void setFirstContentfulPaint(double stamp);
79 89
80 double m_firstPaint = 0.0; 90 double m_firstPaint = 0.0;
81 double m_firstTextPaint = 0.0; 91 double m_firstTextPaint = 0.0;
82 double m_firstImagePaint = 0.0; 92 double m_firstImagePaint = 0.0;
83 double m_firstContentfulPaint = 0.0; 93 double m_firstContentfulPaint = 0.0;
94 double m_firstMeaningfulPaint = 0.0;
84 95
85 Member<Document> m_document; 96 Member<Document> m_document;
97 Member<FirstMeaningfulPaintDetector> m_fmpDetector;
86 }; 98 };
87 99
88 } // namespace blink 100 } // namespace blink
89 101
90 #endif 102 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698