Title: [288991] trunk
Revision
288991
Author
[email protected]
Date
2022-02-02 13:08:41 -0800 (Wed, 02 Feb 2022)

Log Message

[GPU Process] Remove DisplayList::Replayer::Delegate and DisplayList::RecorderImpl::Delegate
https://bugs.webkit.org/show_bug.cgi?id=235939

Reviewed by Wenson Hsieh.

Source/WebCore:

These classes are abstract classes and they are not overridden by any
client right now. These unused classes should be removed after the display
list stream connection refactoring.

* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::displayListForTextRun const):
* platform/graphics/ImageBuffer.h:
(WebCore::ImageBuffer::changeDestinationImageBuffer): Deleted.
(WebCore::ImageBuffer::prepareToAppendDisplayListItems): Deleted.
* platform/graphics/displaylists/DisplayListDrawingContext.cpp:
(WebCore::DisplayList::DrawingContext::DrawingContext):
* platform/graphics/displaylists/DisplayListDrawingContext.h:
(WebCore::DisplayList::DrawingContext::DrawingContext):
* platform/graphics/displaylists/DisplayListImageBuffer.h:
(WebCore::DisplayList::ImageBuffer::ImageBuffer):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/displaylists/DisplayListRecorderImpl.cpp:
(WebCore::DisplayList::RecorderImpl::RecorderImpl):
(WebCore::DisplayList::RecorderImpl::recordResourceUse):
(WebCore::DisplayList::RecorderImpl::canAppendItemOfType const): Deleted.
(WebCore::DisplayList::RecorderImpl::canDrawImageBuffer const): Deleted.
(WebCore::DisplayList::RecorderImpl::renderingMode const): Deleted.
* platform/graphics/displaylists/DisplayListRecorderImpl.h:
(WebCore::DisplayList::RecorderImpl::append):
(WebCore::DisplayList::RecorderImpl::Delegate::~Delegate): Deleted.
(WebCore::DisplayList::RecorderImpl::Delegate::canAppendItemOfType): Deleted.
(WebCore::DisplayList::RecorderImpl::Delegate::recordNativeImageUse): Deleted.
(WebCore::DisplayList::RecorderImpl::Delegate::isCachedImageBuffer const): Deleted.
(WebCore::DisplayList::RecorderImpl::Delegate::recordFontUse): Deleted.
(WebCore::DisplayList::RecorderImpl::Delegate::recordImageBufferUse): Deleted.
(WebCore::DisplayList::RecorderImpl::Delegate::renderingMode const): Deleted.
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::Replayer):
(WebCore::DisplayList::applyImageBufferItem):
(WebCore::DisplayList::applyNativeImageItem):
(WebCore::DisplayList::applySetStateItem):
(WebCore::DisplayList::applyFontItem):
(WebCore::DisplayList::Replayer::applyItem):
* platform/graphics/displaylists/DisplayListReplayer.h:
(WebCore::DisplayList::Replayer::Delegate::~Delegate): Deleted.
(WebCore::DisplayList::Replayer::Delegate::apply): Deleted.
(WebCore::DisplayList::Replayer::Delegate::didCreateMaskImageBuffer): Deleted.
(WebCore::DisplayList::Replayer::Delegate::didResetMaskImageBuffer): Deleted.
(WebCore::DisplayList::Replayer::Delegate::recordResourceUse): Deleted.

Source/WebKit:

* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::recordResourceUse):
(WebKit::RemoteDisplayListRecorderProxy::canDrawImageBuffer const): Deleted.
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:

Tools:

* TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288990 => 288991)


--- trunk/Source/WebCore/ChangeLog	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebCore/ChangeLog	2022-02-02 21:08:41 UTC (rev 288991)
@@ -1,3 +1,55 @@
+2022-02-02  Said Abou-Hallawa  <[email protected]>
+
+        [GPU Process] Remove DisplayList::Replayer::Delegate and DisplayList::RecorderImpl::Delegate
+        https://bugs.webkit.org/show_bug.cgi?id=235939
+
+        Reviewed by Wenson Hsieh.
+
+        These classes are abstract classes and they are not overridden by any
+        client right now. These unused classes should be removed after the display
+        list stream connection refactoring.
+
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::displayListForTextRun const):
+        * platform/graphics/ImageBuffer.h:
+        (WebCore::ImageBuffer::changeDestinationImageBuffer): Deleted.
+        (WebCore::ImageBuffer::prepareToAppendDisplayListItems): Deleted.
+        * platform/graphics/displaylists/DisplayListDrawingContext.cpp:
+        (WebCore::DisplayList::DrawingContext::DrawingContext):
+        * platform/graphics/displaylists/DisplayListDrawingContext.h:
+        (WebCore::DisplayList::DrawingContext::DrawingContext):
+        * platform/graphics/displaylists/DisplayListImageBuffer.h:
+        (WebCore::DisplayList::ImageBuffer::ImageBuffer):
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        * platform/graphics/displaylists/DisplayListRecorderImpl.cpp:
+        (WebCore::DisplayList::RecorderImpl::RecorderImpl):
+        (WebCore::DisplayList::RecorderImpl::recordResourceUse):
+        (WebCore::DisplayList::RecorderImpl::canAppendItemOfType const): Deleted.
+        (WebCore::DisplayList::RecorderImpl::canDrawImageBuffer const): Deleted.
+        (WebCore::DisplayList::RecorderImpl::renderingMode const): Deleted.
+        * platform/graphics/displaylists/DisplayListRecorderImpl.h:
+        (WebCore::DisplayList::RecorderImpl::append):
+        (WebCore::DisplayList::RecorderImpl::Delegate::~Delegate): Deleted.
+        (WebCore::DisplayList::RecorderImpl::Delegate::canAppendItemOfType): Deleted.
+        (WebCore::DisplayList::RecorderImpl::Delegate::recordNativeImageUse): Deleted.
+        (WebCore::DisplayList::RecorderImpl::Delegate::isCachedImageBuffer const): Deleted.
+        (WebCore::DisplayList::RecorderImpl::Delegate::recordFontUse): Deleted.
+        (WebCore::DisplayList::RecorderImpl::Delegate::recordImageBufferUse): Deleted.
+        (WebCore::DisplayList::RecorderImpl::Delegate::renderingMode const): Deleted.
+        * platform/graphics/displaylists/DisplayListReplayer.cpp:
+        (WebCore::DisplayList::Replayer::Replayer):
+        (WebCore::DisplayList::applyImageBufferItem):
+        (WebCore::DisplayList::applyNativeImageItem):
+        (WebCore::DisplayList::applySetStateItem):
+        (WebCore::DisplayList::applyFontItem):
+        (WebCore::DisplayList::Replayer::applyItem):
+        * platform/graphics/displaylists/DisplayListReplayer.h:
+        (WebCore::DisplayList::Replayer::Delegate::~Delegate): Deleted.
+        (WebCore::DisplayList::Replayer::Delegate::apply): Deleted.
+        (WebCore::DisplayList::Replayer::Delegate::didCreateMaskImageBuffer): Deleted.
+        (WebCore::DisplayList::Replayer::Delegate::didResetMaskImageBuffer): Deleted.
+        (WebCore::DisplayList::Replayer::Delegate::recordResourceUse): Deleted.
+
 2022-02-02  Lauro Moura  <[email protected]>
 
         [GLIB] Unreviewed debug buildfix after r288872

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (288990 => 288991)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2022-02-02 21:08:41 UTC (rev 288991)
@@ -214,7 +214,7 @@
         return nullptr;
     
     std::unique_ptr<DisplayList::InMemoryDisplayList> displayList = makeUnique<DisplayList::InMemoryDisplayList>();
-    DisplayList::RecorderImpl recordingContext(*displayList, context.state(), FloatRect(), AffineTransform(), nullptr, DrawGlyphsRecorder::DeconstructDrawGlyphs::No);
+    DisplayList::RecorderImpl recordingContext(*displayList, context.state(), FloatRect(), AffineTransform(), DrawGlyphsRecorder::DeconstructDrawGlyphs::No);
     
     FloatPoint startPoint = toFloatPoint(WebCore::size(glyphBuffer.initialAdvance()));
     drawGlyphBuffer(recordingContext, glyphBuffer, startPoint, customFontNotReadyAction);

Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (288990 => 288991)


--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2022-02-02 21:08:41 UTC (rev 288991)
@@ -95,9 +95,6 @@
     virtual void flushDrawingContextAsync() { }
     virtual void didFlush(GraphicsContextFlushIdentifier) { }
 
-    virtual void changeDestinationImageBuffer(RenderingResourceIdentifier) { }
-    virtual void prepareToAppendDisplayListItems(DisplayList::ItemBufferHandle&&) { }
-
     virtual FloatSize logicalSize() const = 0;
     virtual IntSize truncatedLogicalSize() const = 0; // This truncates the real size. You probably should be calling logicalSize() instead.
     virtual float resolutionScale() const = 0;

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.cpp (288990 => 288991)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.cpp	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.cpp	2022-02-02 21:08:41 UTC (rev 288991)
@@ -33,8 +33,8 @@
 namespace WebCore {
 namespace DisplayList {
 
-DrawingContext::DrawingContext(const FloatSize& logicalSize, const AffineTransform& initialCTM, RecorderImpl::Delegate* delegate)
-    : m_context(m_displayList, GraphicsContextState(), FloatRect({ }, logicalSize), initialCTM, delegate)
+DrawingContext::DrawingContext(const FloatSize& logicalSize, const AffineTransform& initialCTM)
+    : m_context(m_displayList, GraphicsContextState(), FloatRect({ }, logicalSize), initialCTM)
 {
 }
 

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h (288990 => 288991)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h	2022-02-02 21:08:41 UTC (rev 288991)
@@ -37,7 +37,7 @@
 class DrawingContext {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    WEBCORE_EXPORT DrawingContext(const FloatSize& logicalSize, const AffineTransform& initialCTM = { }, RecorderImpl::Delegate* = nullptr);
+    WEBCORE_EXPORT DrawingContext(const FloatSize& logicalSize, const AffineTransform& initialCTM = { });
 
     GraphicsContext& context() const { return const_cast<DrawingContext&>(*this).m_context; }
     RecorderImpl& recorder() { return m_context; };

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h (288990 => 288991)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h	2022-02-02 21:08:41 UTC (rev 288991)
@@ -60,9 +60,9 @@
         m_drawingContext.displayList().setItemBufferReadingClient(m_readingClient.get());
     }
 
-    ImageBuffer(const ImageBufferBackend::Parameters& parameters, RecorderImpl::Delegate* delegate = nullptr)
+    ImageBuffer(const ImageBufferBackend::Parameters& parameters)
         : BaseConcreteImageBuffer(parameters)
-        , m_drawingContext(logicalSize(), baseTransform(), delegate)
+        , m_drawingContext(logicalSize(), baseTransform())
         , m_writingClient(makeUnique<InMemoryDisplayList::WritingClient>())
         , m_readingClient(makeUnique<InMemoryDisplayList::ReadingClient>())
     {

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (288990 => 288991)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2022-02-02 21:08:41 UTC (rev 288991)
@@ -144,10 +144,6 @@
     virtual bool recordResourceUse(const SourceImage&) = 0;
     virtual bool recordResourceUse(Font&) = 0;
 
-    // FIXME: Maybe remove this?
-    virtual bool canDrawImageBuffer(const ImageBuffer&) const = 0;
-    virtual RenderingMode renderingMode() const = 0;
-
     virtual std::unique_ptr<GraphicsContext> createNestedContext(const FloatRect& initialClip, const AffineTransform& initialCTM) = 0;
 
     struct ContextState {

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp (288990 => 288991)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp	2022-02-02 21:08:41 UTC (rev 288991)
@@ -42,10 +42,9 @@
 namespace WebCore {
 namespace DisplayList {
 
-RecorderImpl::RecorderImpl(DisplayList& displayList, const GraphicsContextState& state, const FloatRect& initialClip, const AffineTransform& initialCTM, Delegate* delegate, DrawGlyphsRecorder::DeconstructDrawGlyphs deconstructDrawGlyphs)
+RecorderImpl::RecorderImpl(DisplayList& displayList, const GraphicsContextState& state, const FloatRect& initialClip, const AffineTransform& initialCTM, DrawGlyphsRecorder::DeconstructDrawGlyphs deconstructDrawGlyphs)
     : Recorder(state, initialClip, initialCTM, deconstructDrawGlyphs)
     , m_displayList(displayList)
-    , m_delegate(delegate)
 {
     LOG_WITH_STREAM(DisplayLists, stream << "\nRecording with clip " << initialClip);
 }
@@ -53,7 +52,6 @@
 RecorderImpl::RecorderImpl(RecorderImpl& parent, const GraphicsContextState& state, const FloatRect& initialClip, const AffineTransform& initialCTM)
     : Recorder(parent, state, initialClip, initialCTM)
     , m_displayList(parent.m_displayList)
-    , m_delegate(parent.m_delegate)
     , m_isNested(true)
 {
 }
@@ -75,21 +73,6 @@
     append<PutPixelBuffer>(pixelBuffer, srcRect, destPoint, destFormat);
 }
 
-bool RecorderImpl::canAppendItemOfType(ItemType type) const
-{
-    return !m_delegate || m_delegate->canAppendItemOfType(type);
-}
-
-bool RecorderImpl::canDrawImageBuffer(const ImageBuffer& imageBuffer) const
-{
-    return !m_delegate || m_delegate->isCachedImageBuffer(imageBuffer);
-}
-
-RenderingMode RecorderImpl::renderingMode() const
-{
-    return m_delegate ? m_delegate->renderingMode() : RenderingMode::Unaccelerated;
-}
-
 std::unique_ptr<GraphicsContext> RecorderImpl::createNestedContext(const FloatRect& initialClip, const AffineTransform& initialCTM)
 {
     return makeUnique<RecorderImpl>(*this, GraphicsContextState { }, initialClip, initialCTM);
@@ -421,8 +404,6 @@
 
 bool RecorderImpl::recordResourceUse(NativeImage& nativeImage)
 {
-    if (m_delegate)
-        m_delegate->recordNativeImageUse(nativeImage);
     m_displayList.cacheNativeImage(nativeImage);
     return true;
 }
@@ -429,10 +410,6 @@
 
 bool RecorderImpl::recordResourceUse(ImageBuffer& imageBuffer)
 {
-    if (!canDrawImageBuffer(imageBuffer))
-        return false;
-    if (m_delegate)
-        m_delegate->recordImageBufferUse(imageBuffer);
     m_displayList.cacheImageBuffer(imageBuffer);
     return true;
 }
@@ -450,8 +427,6 @@
 
 bool RecorderImpl::recordResourceUse(Font& font)
 {
-    if (m_delegate)
-        m_delegate->recordFontUse(font);
     m_displayList.cacheFont(font);
     return true;
 }

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h (288990 => 288991)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h	2022-02-02 21:08:41 UTC (rev 288991)
@@ -35,8 +35,7 @@
     WTF_MAKE_FAST_ALLOCATED;
     WTF_MAKE_NONCOPYABLE(RecorderImpl);
 public:
-    class Delegate;
-    WEBCORE_EXPORT RecorderImpl(DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&, Delegate* = nullptr, DrawGlyphsRecorder::DeconstructDrawGlyphs = DrawGlyphsRecorder::DeconstructDrawGlyphs::Yes);
+    WEBCORE_EXPORT RecorderImpl(DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&, DrawGlyphsRecorder::DeconstructDrawGlyphs = DrawGlyphsRecorder::DeconstructDrawGlyphs::Yes);
     RecorderImpl(RecorderImpl& parent, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform& initialCTM);
 
     WEBCORE_EXPORT virtual ~RecorderImpl();
@@ -43,17 +42,6 @@
 
     bool isEmpty() const { return m_displayList.isEmpty(); }
 
-    class Delegate {
-    public:
-        virtual ~Delegate() { }
-        virtual bool canAppendItemOfType(ItemType) { return false; }
-        virtual void recordNativeImageUse(NativeImage&) { }
-        virtual bool isCachedImageBuffer(const ImageBuffer&) const { return false; }
-        virtual void recordFontUse(Font&) { }
-        virtual void recordImageBufferUse(ImageBuffer&) { }
-        virtual RenderingMode renderingMode() const { return RenderingMode::Unaccelerated; }
-    };
-
     void getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& sourceRect) final;
     void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) final;
     void convertToLuminanceMask() final { }
@@ -61,10 +49,6 @@
     void flushContext(GraphicsContextFlushIdentifier identifier) final { append<FlushContext>(identifier); }
 
 private:
-    // FIXME: Maybe remove this?
-    bool canDrawImageBuffer(const ImageBuffer&) const final;
-    RenderingMode renderingMode() const final;
-
     void recordSave() final;
     void recordRestore() final;
     void recordTranslate(float x, float y) final;
@@ -146,9 +130,6 @@
     template<typename T, class... Args>
     void append(Args&&... args)
     {
-        if (UNLIKELY(!canAppendItemOfType(T::itemType)))
-            return;
-
         m_displayList.append<T>(std::forward<Args>(args)...);
 
         if constexpr (T::isDrawingItem) {
@@ -166,10 +147,8 @@
     }
 
     FloatRect extentFromLocalBounds(const FloatRect&) const;
-    WEBCORE_EXPORT bool canAppendItemOfType(ItemType) const;
 
     DisplayList& m_displayList;
-    Delegate* m_delegate { nullptr };
     bool m_isNested { false };
 };
 

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp (288990 => 288991)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2022-02-02 21:08:41 UTC (rev 288991)
@@ -37,17 +37,13 @@
 namespace WebCore {
 namespace DisplayList {
 
-Replayer::Replayer(GraphicsContext& context, const DisplayList& displayList, const ResourceHeap* resourceHeap, ImageBuffer* maskImageBuffer, Delegate* delegate)
+Replayer::Replayer(GraphicsContext& context, const DisplayList& displayList, const ResourceHeap* resourceHeap)
     : m_context(context)
-    , m_maskImageBuffer(maskImageBuffer)
     , m_displayList(displayList)
     , m_resourceHeap(resourceHeap ? *resourceHeap : m_displayList.resourceHeap())
-    , m_delegate(delegate)
 {
 }
 
-Replayer::~Replayer() = default;
-
 GraphicsContext& Replayer::context() const
 {
     return m_maskImageBuffer ? m_maskImageBuffer->context() : m_context;
@@ -54,14 +50,12 @@
 }
 
 template<class T>
-inline static std::optional<RenderingResourceIdentifier> applyImageBufferItem(GraphicsContext& context, const ResourceHeap& resourceHeap, ItemHandle item, Replayer::Delegate* delegate)
+inline static std::optional<RenderingResourceIdentifier> applyImageBufferItem(GraphicsContext& context, const ResourceHeap& resourceHeap, ItemHandle item)
 {
     auto& imageBufferItem = item.get<T>();
     auto resourceIdentifier = imageBufferItem.imageBufferIdentifier();
     if (auto* imageBuffer = resourceHeap.getImageBuffer(resourceIdentifier)) {
         imageBufferItem.apply(context, *imageBuffer);
-        if (delegate)
-            delegate->recordResourceUse(resourceIdentifier);
         return std::nullopt;
     }
     return resourceIdentifier;
@@ -68,64 +62,51 @@
 }
 
 template<class T>
-inline static std::optional<RenderingResourceIdentifier> applyNativeImageItem(GraphicsContext& context, const ResourceHeap& resourceHeap, ItemHandle item, Replayer::Delegate* delegate)
+inline static std::optional<RenderingResourceIdentifier> applyNativeImageItem(GraphicsContext& context, const ResourceHeap& resourceHeap, ItemHandle item)
 {
     auto& nativeImageItem = item.get<T>();
     auto resourceIdentifier = nativeImageItem.imageIdentifier();
     if (auto* image = resourceHeap.getNativeImage(resourceIdentifier)) {
         nativeImageItem.apply(context, *image);
-        if (delegate)
-            delegate->recordResourceUse(resourceIdentifier);
         return std::nullopt;
     }
     return resourceIdentifier;
 }
 
-inline static std::optional<RenderingResourceIdentifier> applySetStateItem(GraphicsContext& context, const ResourceHeap& resourceHeap, ItemHandle item, Replayer::Delegate* delegate)
+inline static std::optional<RenderingResourceIdentifier> applySetStateItem(GraphicsContext& context, const ResourceHeap& resourceHeap, ItemHandle item)
 {
-    RenderingResourceIdentifier strokePatternImageIdentifier;
-    RenderingResourceIdentifier fillPatternImageIdentifier;
     auto& setStateItem = item.get<SetState>();
 
-    if (auto& strokePattern = setStateItem.stateChange().m_state.strokePattern) {
-        strokePatternImageIdentifier = strokePattern->tileImage().imageIdentifier();
-        auto strokePatternImage = resourceHeap.getSourceImage(strokePatternImageIdentifier);
-        if (!strokePatternImage)
-            return strokePatternImageIdentifier;
+    auto fixPatternTileImage = [&](Pattern* pattern) -> std::optional<RenderingResourceIdentifier> {
+        if (!pattern)
+            return std::nullopt;
 
-        strokePattern->setTileImage(WTFMove(*strokePatternImage));
-    }
+        auto imageIdentifier = pattern->tileImage().imageIdentifier();
+        auto sourceImage = resourceHeap.getSourceImage(imageIdentifier);
+        if (!sourceImage)
+            return imageIdentifier;
 
-    if (auto& fillPattern = setStateItem.stateChange().m_state.fillPattern) {
-        fillPatternImageIdentifier = fillPattern->tileImage().imageIdentifier();
-        auto fillPatternImage = resourceHeap.getSourceImage(fillPatternImageIdentifier);
-        if (!fillPatternImage)
-            return fillPatternImageIdentifier;
+        pattern->setTileImage(WTFMove(*sourceImage));
+        return std::nullopt;
+    };
 
-        fillPattern->setTileImage(WTFMove(*fillPatternImage));
-    }
+    if (auto imageIdentifier = fixPatternTileImage(setStateItem.stateChange().m_state.strokePattern.get()))
+        return *imageIdentifier;
 
+    if (auto imageIdentifier = fixPatternTileImage(setStateItem.stateChange().m_state.fillPattern.get()))
+        return *imageIdentifier;
+
     setStateItem.apply(context);
-
-    if (!delegate)
-        return std::nullopt;
-
-    if (strokePatternImageIdentifier)
-        delegate->recordResourceUse(strokePatternImageIdentifier);
-    if (fillPatternImageIdentifier)
-        delegate->recordResourceUse(fillPatternImageIdentifier);
     return std::nullopt;
 }
 
 template<class T>
-inline static std::optional<RenderingResourceIdentifier> applyFontItem(GraphicsContext& context, const ResourceHeap& resourceHeap, ItemHandle item, Replayer::Delegate* delegate)
+inline static std::optional<RenderingResourceIdentifier> applyFontItem(GraphicsContext& context, const ResourceHeap& resourceHeap, ItemHandle item)
 {
     auto& fontItem = item.get<T>();
     auto resourceIdentifier = fontItem.fontIdentifier();
     if (auto* font = resourceHeap.getFont(resourceIdentifier)) {
         fontItem.apply(context, *font);
-        if (delegate)
-            delegate->recordResourceUse(resourceIdentifier);
         return std::nullopt;
     }
     return resourceIdentifier;
@@ -133,41 +114,38 @@
 
 std::pair<std::optional<StopReplayReason>, std::optional<RenderingResourceIdentifier>> Replayer::applyItem(ItemHandle item)
 {
-    if (m_delegate && m_delegate->apply(item, context()))
-        return { std::nullopt, std::nullopt };
-
     if (item.is<DrawImageBuffer>()) {
-        if (auto missingCachedResourceIdentifier = applyImageBufferItem<DrawImageBuffer>(context(), m_resourceHeap, item, m_delegate))
+        if (auto missingCachedResourceIdentifier = applyImageBufferItem<DrawImageBuffer>(context(), m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
 
     if (item.is<ClipToImageBuffer>()) {
-        if (auto missingCachedResourceIdentifier = applyImageBufferItem<ClipToImageBuffer>(context(), m_resourceHeap, item, m_delegate))
+        if (auto missingCachedResourceIdentifier = applyImageBufferItem<ClipToImageBuffer>(context(), m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
 
     if (item.is<DrawNativeImage>()) {
-        if (auto missingCachedResourceIdentifier = applyNativeImageItem<DrawNativeImage>(context(), m_resourceHeap, item, m_delegate))
+        if (auto missingCachedResourceIdentifier = applyNativeImageItem<DrawNativeImage>(context(), m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
 
     if (item.is<DrawGlyphs>()) {
-        if (auto missingCachedResourceIdentifier = applyFontItem<DrawGlyphs>(context(), m_resourceHeap, item, m_delegate))
+        if (auto missingCachedResourceIdentifier = applyFontItem<DrawGlyphs>(context(), m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
 
     if (item.is<DrawPattern>()) {
-        if (auto missingCachedResourceIdentifier = applyNativeImageItem<DrawPattern>(context(), m_resourceHeap, item, m_delegate))
+        if (auto missingCachedResourceIdentifier = applyNativeImageItem<DrawPattern>(context(), m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
 
     if (item.is<SetState>()) {
-        if (auto missingCachedResourceIdentifier = applySetStateItem(context(), m_resourceHeap, item, m_delegate))
+        if (auto missingCachedResourceIdentifier = applySetStateItem(context(), m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
@@ -179,8 +157,6 @@
         m_maskImageBuffer = ImageBuffer::createCompatibleBuffer(clipItem.destination().size(), clipItem.colorSpace(), m_context);
         if (!m_maskImageBuffer)
             return { StopReplayReason::OutOfMemory, std::nullopt };
-        if (m_delegate)
-            m_delegate->didCreateMaskImageBuffer(*m_maskImageBuffer);
         return { std::nullopt, std::nullopt };
     }
 
@@ -190,8 +166,6 @@
         auto& clipItem = item.get<EndClipToDrawingCommands>();
         m_context.clipToImageBuffer(*m_maskImageBuffer, clipItem.destination());
         m_maskImageBuffer = nullptr;
-        if (m_delegate)
-            m_delegate->didResetMaskImageBuffer();
         return { std::nullopt, std::nullopt };
     }
 

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h (288990 => 288991)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h	2022-02-02 21:08:41 UTC (rev 288991)
@@ -31,7 +31,6 @@
 
 namespace WebCore {
 
-enum class AlphaPremultiplication : uint8_t;
 class FloatRect;
 class GraphicsContext;
 
@@ -42,7 +41,6 @@
 enum class StopReplayReason : uint8_t {
     ReplayedAllItems,
     MissingCachedResource,
-    ChangeDestinationImageBuffer,
     InvalidItemOrExtent,
     OutOfMemory
 };
@@ -50,7 +48,6 @@
 struct ReplayResult {
     std::unique_ptr<InMemoryDisplayList> trackedDisplayList;
     size_t numberOfBytesRead { 0 };
-    std::optional<RenderingResourceIdentifier> nextDestinationImageBuffer;
     std::optional<RenderingResourceIdentifier> missingCachedResourceIdentifier;
     StopReplayReason reasonForStopping { StopReplayReason::ReplayedAllItems };
 };
@@ -58,30 +55,19 @@
 class Replayer {
     WTF_MAKE_NONCOPYABLE(Replayer);
 public:
-    class Delegate;
-    WEBCORE_EXPORT Replayer(GraphicsContext&, const DisplayList&, const ResourceHeap* = nullptr, WebCore::ImageBuffer* maskImageBuffer = nullptr, Delegate* = nullptr);
-    WEBCORE_EXPORT ~Replayer();
+    WEBCORE_EXPORT Replayer(GraphicsContext&, const DisplayList&, const ResourceHeap* = nullptr);
+    ~Replayer() = default;
 
     WEBCORE_EXPORT ReplayResult replay(const FloatRect& initialClip = { }, bool trackReplayList = false);
 
-    class Delegate {
-    public:
-        virtual ~Delegate() { }
-        virtual bool apply(ItemHandle, GraphicsContext&) { return false; }
-        virtual void didCreateMaskImageBuffer(WebCore::ImageBuffer&) { }
-        virtual void didResetMaskImageBuffer() { }
-        virtual void recordResourceUse(RenderingResourceIdentifier) { }
-    };
-    
 private:
     GraphicsContext& context() const;
     std::pair<std::optional<StopReplayReason>, std::optional<RenderingResourceIdentifier>> applyItem(ItemHandle);
 
     GraphicsContext& m_context;
-    RefPtr<WebCore::ImageBuffer> m_maskImageBuffer;
     const DisplayList& m_displayList;
     const ResourceHeap& m_resourceHeap;
-    Delegate* m_delegate;
+    RefPtr<WebCore::ImageBuffer> m_maskImageBuffer;
 };
 
 }

Modified: trunk/Source/WebKit/ChangeLog (288990 => 288991)


--- trunk/Source/WebKit/ChangeLog	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebKit/ChangeLog	2022-02-02 21:08:41 UTC (rev 288991)
@@ -1,3 +1,15 @@
+2022-02-02  Said Abou-Hallawa  <[email protected]>
+
+        [GPU Process] Remove DisplayList::Replayer::Delegate and DisplayList::RecorderImpl::Delegate
+        https://bugs.webkit.org/show_bug.cgi?id=235939
+
+        Reviewed by Wenson Hsieh.
+
+        * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
+        (WebKit::RemoteDisplayListRecorderProxy::recordResourceUse):
+        (WebKit::RemoteDisplayListRecorderProxy::canDrawImageBuffer const): Deleted.
+        * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
+
 2022-02-02  Chris Dumez  <[email protected]>
 
         Move and rename ServiceWorkerFrameLoaderClient & ServiceWorkerLibWebRTCProvider

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp (288990 => 288991)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp	2022-02-02 21:08:41 UTC (rev 288991)
@@ -80,11 +80,6 @@
     send(Messages::RemoteDisplayListRecorder::TransformToColorSpace(colorSpace));
 }
 
-bool RemoteDisplayListRecorderProxy::canDrawImageBuffer(const ImageBuffer& imageBuffer) const
-{
-    return m_renderingBackend && m_renderingBackend->isCached(imageBuffer);
-}
-
 RenderingMode RemoteDisplayListRecorderProxy::renderingMode() const
 {
     return m_imageBuffer ? m_imageBuffer->renderingMode() : RenderingMode::Unaccelerated;
@@ -430,7 +425,7 @@
         return false;
     }
 
-    if (!canDrawImageBuffer(imageBuffer))
+    if (!m_renderingBackend->isCached(imageBuffer))
         return false;
 
     m_renderingBackend->remoteResourceCacheProxy().recordImageBufferUse(imageBuffer);

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h (288990 => 288991)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	2022-02-02 21:08:41 UTC (rev 288991)
@@ -66,7 +66,6 @@
 
     friend class WebCore::DrawGlyphsRecorder;
 
-    bool canDrawImageBuffer(const WebCore::ImageBuffer&) const final;
     WebCore::RenderingMode renderingMode() const final;
 
     void recordSave() final;

Modified: trunk/Tools/ChangeLog (288990 => 288991)


--- trunk/Tools/ChangeLog	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Tools/ChangeLog	2022-02-02 21:08:41 UTC (rev 288991)
@@ -1,3 +1,13 @@
+2022-02-02  Said Abou-Hallawa  <[email protected]>
+
+        [GPU Process] Remove DisplayList::Replayer::Delegate and DisplayList::RecorderImpl::Delegate
+        https://bugs.webkit.org/show_bug.cgi?id=235939
+
+        Reviewed by Wenson Hsieh.
+
+        * TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp:
+        (TestWebKitAPI::TEST):
+
 2022-02-01  Ryan Haddad  <[email protected]>
 
         Bring up additional test queues on Big Sur

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp (288990 => 288991)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp	2022-02-02 20:54:14 UTC (rev 288990)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp	2022-02-02 21:08:41 UTC (rev 288991)
@@ -136,7 +136,6 @@
     Replayer replayer { context, shallowCopy };
     auto result = replayer.replay();
     EXPECT_GT(result.numberOfBytesRead, 0U);
-    EXPECT_EQ(result.nextDestinationImageBuffer, std::nullopt);
     EXPECT_EQ(result.missingCachedResourceIdentifier, std::nullopt);
     EXPECT_EQ(result.reasonForStopping, StopReplayReason::InvalidItemOrExtent);
 }
@@ -160,7 +159,6 @@
         Replayer replayer { context, list };
         auto result = replayer.replay();
         EXPECT_EQ(result.numberOfBytesRead, 0U);
-        EXPECT_EQ(result.nextDestinationImageBuffer, std::nullopt);
         EXPECT_EQ(result.missingCachedResourceIdentifier, std::nullopt);
         EXPECT_EQ(result.reasonForStopping, StopReplayReason::InvalidItemOrExtent);
     };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to