| // Copyright 2018 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_PAINT_TIMING_DETECTOR_H_ |
| #define THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_PAINT_TIMING_DETECTOR_H_ |
| |
| #include "third_party/blink/public/platform/web_input_event.h" |
| #include "third_party/blink/renderer/core/core_export.h" |
| #include "third_party/blink/renderer/platform/heap/member.h" |
| #include "third_party/blink/renderer/platform/scroll/scroll_types.h" |
| |
| namespace blink { |
| |
| class LayoutObject; |
| class LocalFrameView; |
| class PaintLayer; |
| class LayoutRect; |
| class TextPaintTimingDetector; |
| class ImagePaintTimingDetector; |
| class PropertyTreeState; |
| |
| // PaintTimingDetector contains some of paint metric detectors, |
| // providing common infrastructure for these detectors. |
| // |
| // Users has to enable 'loading' trace category to enable the metrics. |
| // |
| // See also: |
| // https://docs.google.com/document/d/1DRVd4a2VU8-yyWftgOparZF-sf16daf0vfbsHuz2rws/edit |
| class CORE_EXPORT PaintTimingDetector |
| : public GarbageCollected<PaintTimingDetector> { |
| public: |
| PaintTimingDetector(LocalFrameView*); |
| void NotifyObjectPrePaint(const LayoutObject& object, |
| const PaintLayer& painting_layer); |
| static void NotifyTextPaint(const Node* node, const PropertyTreeState&); |
| static void NotifyTextPaint(const LayoutObject& object, |
| const PropertyTreeState&); |
| void NotifyNodeRemoved(const LayoutObject& object); |
| void NotifyPrePaintFinished(); |
| void NotifyInputEvent(WebInputEvent::Type); |
| bool NeedToNotifyInputOrScroll(); |
| void NotifyScroll(ScrollType scroll_type); |
| void DidChangePerformanceTiming(); |
| uint64_t CalculateVisualSize(const LayoutRect& invalidated_rect, |
| const PaintLayer& painting_layer) const; |
| uint64_t CalculateVisualSize(const LayoutRect& invalidated_rect, |
| const PropertyTreeState&) const; |
| void Dispose(); |
| |
| TextPaintTimingDetector& GetTextPaintTimingDetector() { |
| return *text_paint_timing_detector_; |
| } |
| ImagePaintTimingDetector& GetImagePaintTimingDetector() { |
| return *image_paint_timing_detector_; |
| } |
| void Trace(Visitor* visitor); |
| |
| private: |
| Member<LocalFrameView> frame_view_; |
| Member<TextPaintTimingDetector> text_paint_timing_detector_; |
| Member<ImagePaintTimingDetector> image_paint_timing_detector_; |
| }; |
| |
| } // namespace blink |
| |
| #endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_PAINT_TIMING_DETECTOR_H_ |