REGRESSION(r246963) GTK's debug build is broken
authormagomez@igalia.com <magomez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Jul 2019 13:42:25 +0000 (13:42 +0000)
committermagomez@igalia.com <magomez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Jul 2019 13:42:25 +0000 (13:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199358

Reviewed by Michael Catanzaro.

Add traits to be able to downcast AnimatedBackingStoreClient.

* platform/graphics/nicosia/NicosiaAnimatedBackingStoreClient.h:
(Nicosia::AnimatedBackingStoreClient::AnimatedBackingStoreClient):
(Nicosia::AnimatedBackingStoreClient::type const):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::updateContentBuffers):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247007 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/nicosia/NicosiaAnimatedBackingStoreClient.h
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp

index 1fb5a9c..ea5ad68 100644 (file)
@@ -1,3 +1,18 @@
+2019-07-01  Miguel Gomez  <magomez@igalia.com>
+
+        REGRESSION(r246963) GTK's debug build is broken
+        https://bugs.webkit.org/show_bug.cgi?id=199358
+
+        Reviewed by Michael Catanzaro.
+
+        Add traits to be able to downcast AnimatedBackingStoreClient.
+
+        * platform/graphics/nicosia/NicosiaAnimatedBackingStoreClient.h:
+        (Nicosia::AnimatedBackingStoreClient::AnimatedBackingStoreClient):
+        (Nicosia::AnimatedBackingStoreClient::type const):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
+
 2019-07-01  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Fix GTK build with GSTREAMER_GL disabled after r246710
index 21de15e..4d03a32 100644 (file)
@@ -40,10 +40,28 @@ namespace Nicosia {
 
 class AnimatedBackingStoreClient : public ThreadSafeRefCounted<AnimatedBackingStoreClient> {
 public:
+    enum class Type {
+        Coordinated
+    };
+
+    explicit AnimatedBackingStoreClient(Type type)
+        : m_type(type)
+    {
+    }
+
+    Type type() const { return m_type; }
     virtual ~AnimatedBackingStoreClient() = default;
     virtual void requestBackingStoreUpdateIfNeeded(const WebCore::TransformationMatrix&) = 0;
+
+private:
+    Type m_type;
 };
 
 } // namespace Nicosia
 
+#define SPECIALIZE_TYPE_TRAITS_ANIMATEDBACKINGSTORECLIENT(ToValueTypeName, predicate) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(ToValueTypeName) \
+    static bool isType(const Nicosia::AnimatedBackingStoreClient& client) { return client.predicate; } \
+SPECIALIZE_TYPE_TRAITS_END()
+
 #endif // USE(COORDINATED_GRAPHICS)
index 0b051a9..367d8a5 100644 (file)
@@ -699,7 +699,8 @@ public:
 
 private:
     CoordinatedAnimatedBackingStoreClient(RefPtr<CoordinatedGraphicsLayer::AnimatedBackingStoreHost>&& host, const FloatRect& visibleRect, const FloatRect& coverRect, const FloatSize& size, float contentsScale)
-        : m_host(WTFMove(host))
+        : Nicosia::AnimatedBackingStoreClient(Type::Coordinated)
+        , m_host(WTFMove(host))
         , m_visibleRect(visibleRect)
         , m_coverRect(coverRect)
         , m_size(size)
@@ -1004,9 +1005,9 @@ void CoordinatedGraphicsLayer::updateContentBuffers()
         layerState.mainBackingStore->createTilesIfNeeded(transformedVisibleRect(), IntRect(0, 0, m_size.width(), m_size.height()));
     }
 
-    if (m_nicosia.animatedBackingStoreClient) {
+    if (is<CoordinatedAnimatedBackingStoreClient>(m_nicosia.animatedBackingStoreClient)) {
         // Determine the coverRect and set it to the client.
-        downcast<CoordinatedAnimatedBackingStoreClient>(m_nicosia.animatedBackingStoreClient.get())->setCoverRect(layerState.mainBackingStore->coverRect());
+        downcast<CoordinatedAnimatedBackingStoreClient>(*m_nicosia.animatedBackingStoreClient).setCoverRect(layerState.mainBackingStore->coverRect());
     }
 
     ASSERT(m_coordinator && m_coordinator->isFlushingLayerChanges());
@@ -1303,4 +1304,6 @@ bool CoordinatedGraphicsLayer::usesContentsLayer() const
 
 } // namespace WebCore
 
+SPECIALIZE_TYPE_TRAITS_ANIMATEDBACKINGSTORECLIENT(WebCore::CoordinatedAnimatedBackingStoreClient, type() == Nicosia::AnimatedBackingStoreClient::Type::Coordinated)
+
 #endif // USE(COORDINATED_GRAPHICS)