Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/paint/PaintController.h |
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h |
| index 5bfc86ec8e4156d37fca6adf2b74337b78eb6f6e..e401d760525c7c58949ebcba457b5d6b53a80690 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h |
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h |
| @@ -33,6 +33,22 @@ static const size_t kInitialDisplayItemListCapacityBytes = 512; |
| template class RasterInvalidationTrackingMap<const PaintChunk>; |
| +// FrameFirstPaint stores first-paint, text or image painted for the |
| +// corresponding frame. They are never reset to false. First-paint is defined in |
| +// https://github.com/WICG/paint-timing. It excludes default background paint. |
| +struct FrameFirstPaint { |
| + FrameFirstPaint(const void* frame) |
| + : frame(frame), |
| + first_painted(false), |
| + text_painted(false), |
| + image_painted(false) {} |
| + |
| + const void* frame; |
| + bool first_painted : 1; |
| + bool text_painted : 1; |
| + bool image_painted : 1; |
| +}; |
| + |
| // Responsible for processing display items as they are produced, and producing |
| // a final paint artifact when complete. This class includes logic for caching, |
| // cache invalidation, and merging. |
| @@ -161,12 +177,9 @@ class PLATFORM_EXPORT PaintController { |
| subsequence_caching_disabled_ = disable; |
| } |
| - bool FirstPainted() const { return first_painted_; } |
| - void SetFirstPainted() { first_painted_ = true; } |
| - bool TextPainted() const { return text_painted_; } |
| - void SetTextPainted() { text_painted_ = true; } |
| - bool ImagePainted() const { return image_painted_; } |
| - void SetImagePainted() { image_painted_ = true; } |
| + void SetFirstPainted(); |
| + void SetTextPainted(); |
| + void SetImagePainted(); |
| // Returns displayItemList added using createAndAppend() since beginning or |
| // the last commitNewDisplayItems(). Use with care. |
| @@ -211,14 +224,14 @@ class PLATFORM_EXPORT PaintController { |
| bool LastDisplayItemIsSubsequenceEnd() const; |
| + void BeginFrame(const void* frame); |
| + FrameFirstPaint EndFrame(const void* frame); |
| + |
| protected: |
| PaintController() |
| : new_display_item_list_(0), |
| construction_disabled_(false), |
| subsequence_caching_disabled_(false), |
| - first_painted_(false), |
| - text_painted_(false), |
| - image_painted_(false), |
| skipping_cache_count_(0), |
| num_cached_new_items_(0), |
| current_cached_subsequence_begin_index_in_new_list_(kNotFound), |
| @@ -233,6 +246,7 @@ class PLATFORM_EXPORT PaintController { |
| ResetCurrentListIndices(); |
| SetTracksRasterInvalidations( |
| RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()); |
| + frame_first_paints_.push_back(FrameFirstPaint(nullptr)); |
|
Xianzhu
2017/05/09 23:13:08
Please add a comment to explain the reason.
Zhen Wang
2017/05/09 23:26:24
Done.
|
| } |
| private: |
| @@ -340,13 +354,8 @@ class PLATFORM_EXPORT PaintController { |
| // caching. |
| bool subsequence_caching_disabled_; |
| - // The following fields indicate that this PaintController has ever had |
| - // first-paint, text or image painted. They are never reset to false. |
| - // First-paint is defined in https://github.com/WICG/paint-timing. It excludes |
| - // default background paint. |
| - bool first_painted_; |
| - bool text_painted_; |
| - bool image_painted_; |
| + // A stack recording current frames' first paints. |
| + Vector<FrameFirstPaint> frame_first_paints_; |
| int skipping_cache_count_; |