1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PLATFORM_PAINT_WORKLET_LAYER_PAINTER_H_ 6 #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PLATFORM_PAINT_WORKLET_LAYER_PAINTER_H_ 7 8 #include <memory> 9 10 #include "cc/paint/paint_record.h" 11 #include "cc/paint/paint_worklet_job.h" 12 #include "cc/paint/paint_worklet_layer_painter.h" 13 #include "third_party/blink/renderer/platform/platform_export.h" 14 15 namespace blink { 16 17 using CompositorPaintWorkletInput = cc::PaintWorkletInput; 18 using CompositorPaintWorkletJob = cc::PaintWorkletJob; 19 20 class PaintWorkletPaintDispatcher; 21 22 // This class serves as a bridge which connects the compositor and the paint 23 // worklet thread. The compositor issues requests to execute the JS paint 24 // callback, and this class asks the PaintWorkletPaintDispatcher to dispatch the 25 // request to the paint worklet thread. 26 class PLATFORM_EXPORT PlatformPaintWorkletLayerPainter 27 : public cc::PaintWorkletLayerPainter { 28 public: 29 explicit PlatformPaintWorkletLayerPainter( 30 std::unique_ptr<PaintWorkletPaintDispatcher>); 31 ~PlatformPaintWorkletLayerPainter() override; 32 33 // cc::PaintWorkletLayerPainter 34 void DispatchWorklets(cc::PaintWorkletJobMap, DoneCallback) override; 35 bool HasOngoingDispatch() const override; 36 37 private: 38 std::unique_ptr<PaintWorkletPaintDispatcher> dispatcher_; 39 }; 40 41 } // namespace blink 42 43 #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PLATFORM_PAINT_WORKLET_LAYER_PAINTER_H_ 44