| 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 3ac1d2db32233eb83b1e9b6f25b0bc92e4d069c6..80884370f0a7a77fc71d8568fb311cda364f22a8 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintTiming.h
|
| +++ b/third_party/WebKit/Source/core/paint/PaintTiming.h
|
| @@ -7,7 +7,10 @@
|
|
|
| #include "core/dom/Document.h"
|
| #include "platform/Supplementable.h"
|
| +#include "platform/geometry/IntRect.h"
|
| #include "platform/heap/Handle.h"
|
| +#include "wtf/HashMap.h"
|
| +#include "wtf/Int32Array.h"
|
|
|
| namespace blink {
|
|
|
| @@ -23,12 +26,20 @@ public:
|
| void markFirstPaint();
|
| void markFirstTextPaint();
|
| void markFirstImagePaint();
|
| + void markPaintInvalidation(const IntRect* visualRect, int paintCount);
|
|
|
| // These return monotonically-increasing seconds.
|
| double firstPaint() const { return m_firstPaint; }
|
| double firstTextPaint() const { return m_firstTextPaint; }
|
| double firstImagePaint() const { return m_firstImagePaint; }
|
|
|
| + // When a consumer asks for the speed index, stop collecting and analyzing
|
| + // invalidation rects and give the result using information collected at the
|
| + // first request time.
|
| + double speedIndex(double referenceTime) const;
|
| +
|
| + void setLoadCommitted() { m_loadCommitted = true; }
|
| +
|
| DECLARE_VIRTUAL_TRACE();
|
|
|
| private:
|
| @@ -39,6 +50,30 @@ private:
|
| double m_firstPaint = 0.0;
|
| double m_firstTextPaint = 0.0;
|
| double m_firstImagePaint = 0.0;
|
| + // Speed Index is calculated once when first queried, then cached.
|
| + mutable double m_speedIndex = 0.0;
|
| +
|
| + // Members needed to calculate SpeedIndex:
|
| +
|
| + // Ignore all paint invalidations until the load commits.
|
| + bool m_loadCommitted = false;
|
| +
|
| + IntRect m_viewPortRect;
|
| + int m_lastPaintCount = 0;
|
| +
|
| + // Forbids duplicate rect invalidations that occur before painting.
|
| + WTF::HashSet<unsigned> frameRects;
|
| +
|
| + // Counts rect occurrences.
|
| + typedef WTF::HashMap<unsigned, int> RectCountMap;
|
| + RectCountMap m_rectCounts;
|
| +
|
| + double m_lastPaintInvalidationTime = 0.0;
|
| +
|
| + // The current area under the curve of "painted area over time."
|
| + double m_totalLoadedArea = 0.0;
|
| + // The total amount of painted area.
|
| + double m_totalContributions = 0.0;
|
|
|
| RawPtrWillBeMember<Document> m_document;
|
| };
|
|
|