WebKit Bugzilla
Attachment 346617 Details for
Bug 188341
: [Nicosia] Add additional layer state classes, use impl-based approach to make them extendable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188341-20180806100333.patch (text/plain), 11.25 KB, created by
Zan Dobersek
on 2018-08-06 01:03:35 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Zan Dobersek
Created:
2018-08-06 01:03:35 PDT
Size:
11.25 KB
patch
obsolete
>Subversion Revision: 234586 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 35b4a0bee7cbfc70b72a03107b6fe4225ea06ee0..87b3a77c5824b0aa4b4cc39c6b30025e58971bd9 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,55 @@ >+2018-08-06 Zan Dobersek <zdobersek@igalia.com> >+ >+ [Nicosia] Add additional layer state classes, use impl-based approach to make them extendable >+ https://bugs.webkit.org/show_bug.cgi?id=188341 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add the ContentLayer, BackingStore and ImageBacking classes in the >+ Nicosia namespace. State objects of CompositionLayer instances keep >+ references to objects of these classes depending on the content that's >+ presented in the associated GraphicsLayer. >+ >+ ContentLayer derives from the PlatformLayer class. It's used for layers >+ that display things like WebGL and HTML5 canvas and media content in a >+ platform-specific way. In case of TextureMapper the hardware-accelerated >+ content is piped into that rendering pipeline. >+ >+ BackingStore is meant to represent the painted contents of a layer. The >+ equivalent current functionality is using a tiled backing store that >+ has its contents copied into the CoordinatedBackingStore instance. >+ >+ ImageBacking is used for a layer whose content is a simple Image object. >+ Image's pixel data is rasterized and again managed through >+ CoordinatedBackingStore for rendering. >+ >+ All these classes, along with the CompositionLayer class, should now be >+ constructed with a factory function that returns an object that derives >+ the class-specific Impl interface. This will allow for simpler >+ implementation of different approaches in parallel. The TextureMapper >+ variants will be the first ones, replicating the current behavior as it >+ is implemented across classes in the CoordinatedGraphics and >+ TextureMapper layers. >+ >+ * platform/graphics/nicosia/NicosiaPlatformLayer.cpp: >+ (Nicosia::CompositionLayer::CompositionLayer): >+ * platform/graphics/nicosia/NicosiaPlatformLayer.h: >+ (Nicosia::PlatformLayer::isContentLayer const): >+ (Nicosia::CompositionLayer::Impl::isTextureMapperImpl const): >+ (Nicosia::CompositionLayer::create): >+ (Nicosia::CompositionLayer::impl const): >+ (Nicosia::ContentLayer::Impl::isTextureMapperImpl const): >+ (Nicosia::ContentLayer::create): >+ (Nicosia::ContentLayer::impl const): >+ (Nicosia::BackingStore::Impl::isTextureMapperImpl const): >+ (Nicosia::BackingStore::create): >+ (Nicosia::BackingStore::impl const): >+ (Nicosia::ImageBacking::Impl::isTextureMapperImpl const): >+ (Nicosia::ImageBacking::create): >+ (Nicosia::ImageBacking::impl const): >+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: >+ (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer): >+ > 2018-08-05 Yusuke Suzuki <utatane.tea@gmail.com> > > Add support for microtasks in workers >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.cpp b/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.cpp >index 9b328232c94ca4cb8f0aee059caf477f5dedfa55..63c6262b9f7837b4a3ca390fe4a0db3b46e86588 100644 >--- a/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.cpp >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.cpp >@@ -38,11 +38,14 @@ PlatformLayer::PlatformLayer(uint64_t id) > > PlatformLayer::~PlatformLayer() = default; > >-CompositionLayer::CompositionLayer(uint64_t id) >+ >+CompositionLayer::CompositionLayer(uint64_t id, const Impl::Factory& factory) > : PlatformLayer(id) >+ , m_impl(factory(id, *this)) > { > } > > CompositionLayer::~CompositionLayer() = default; >+CompositionLayer::Impl::~Impl() = default; > > } // namespace Nicosia >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h b/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h >index c206e9b7441e5953d8ef7e5d7c2cb58fcc873ea5..780aceb7274447d9e493588e09c843d7200e2994 100644 >--- a/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h >@@ -36,6 +36,7 @@ > #include "FloatSize.h" > #include "TextureMapperAnimation.h" > #include "TransformationMatrix.h" >+#include <wtf/Function.h> > #include <wtf/Lock.h> > #include <wtf/ThreadSafeRefCounted.h> > #include <wtf/TypeCasts.h> >@@ -47,6 +48,7 @@ public: > virtual ~PlatformLayer(); > > virtual bool isCompositionLayer() const { return false; } >+ virtual bool isContentLayer() const { return false; } > > uint64_t id() const { return m_id; } > >@@ -60,16 +62,29 @@ protected: > } m_state; > }; > >+class ContentLayer; >+class BackingStore; >+class ImageBacking; >+ > class CompositionLayer : public PlatformLayer { > public: >- static Ref<CompositionLayer> create(uint64_t id) >+ class Impl { >+ public: >+ using Factory = WTF::Function<std::unique_ptr<Impl>(uint64_t, CompositionLayer&)>; >+ >+ virtual ~Impl(); >+ virtual bool isTextureMapperImpl() const { return false; } >+ }; >+ >+ static Ref<CompositionLayer> create(uint64_t id, const Impl::Factory& factory) > { >- return adoptRef(*new CompositionLayer(id)); >+ return adoptRef(*new CompositionLayer(id, factory)); > } > virtual ~CompositionLayer(); >- > bool isCompositionLayer() const override { return true; } > >+ Impl& impl() const { return *m_impl; } >+ > struct LayerState { > struct Delta { > Delta() = default; >@@ -91,6 +106,9 @@ public: > bool maskChanged : 1; > bool replicaChanged : 1; > bool flagsChanged : 1; >+ bool contentLayerChanged : 1; >+ bool backingStoreChanged : 1; >+ bool imageBackingChanged : 1; > bool repaintCounterChanged : 1; > bool debugBorderChanged : 1; > }; >@@ -140,6 +158,10 @@ public: > RefPtr<CompositionLayer> replica; > RefPtr<CompositionLayer> mask; > >+ RefPtr<ContentLayer> contentLayer; >+ RefPtr<BackingStore> backingStore; >+ RefPtr<ImageBacking> imageBacking; >+ > struct RepaintCounter { > unsigned count { 0 }; > bool visible { false }; >@@ -159,13 +181,88 @@ public: > } > > private: >- explicit CompositionLayer(uint64_t); >+ CompositionLayer(uint64_t, const Impl::Factory&); >+ >+ std::unique_ptr<Impl> m_impl; > > struct { > LayerState pending; > } m_state; > }; > >+class ContentLayer : public PlatformLayer { >+public: >+ class Impl { >+ public: >+ using Factory = WTF::Function<std::unique_ptr<Impl>(ContentLayer&)>; >+ >+ virtual ~Impl(); >+ virtual bool isTextureMapperImpl() const { return false; } >+ }; >+ >+ static Ref<ContentLayer> create(const Impl::Factory& factory) >+ { >+ return adoptRef(*new ContentLayer(factory)); >+ } >+ virtual ~ContentLayer(); >+ bool isContentLayer() const override { return true; } >+ >+ Impl& impl() const { return *m_impl; } >+ >+private: >+ ContentLayer(const Impl::Factory&); >+ >+ std::unique_ptr<Impl> m_impl; >+}; >+ >+class BackingStore : public ThreadSafeRefCounted<BackingStore> { >+public: >+ class Impl { >+ public: >+ using Factory = WTF::Function<std::unique_ptr<Impl>(BackingStore&)>; >+ >+ virtual ~Impl(); >+ virtual bool isTextureMapperImpl() const { return false; } >+ }; >+ >+ static Ref<BackingStore> create(const Impl::Factory& factory) >+ { >+ return adoptRef(*new BackingStore(factory)); >+ } >+ virtual ~BackingStore(); >+ >+ Impl& impl() const { return *m_impl; } >+ >+private: >+ BackingStore(const Impl::Factory&); >+ >+ std::unique_ptr<Impl> m_impl; >+}; >+ >+class ImageBacking : public ThreadSafeRefCounted<ImageBacking> { >+public: >+ class Impl { >+ public: >+ using Factory = WTF::Function<std::unique_ptr<Impl>(ImageBacking&)>; >+ >+ virtual ~Impl(); >+ virtual bool isTextureMapperImpl() const { return false; } >+ }; >+ >+ static Ref<ImageBacking> create(const Impl::Factory& factory) >+ { >+ return adoptRef(*new ImageBacking(factory)); >+ } >+ virtual ~ImageBacking(); >+ >+ Impl& impl() const { return *m_impl; } >+ >+private: >+ ImageBacking(const Impl::Factory&); >+ >+ std::unique_ptr<Impl> m_impl; >+}; >+ > } // namespace Nicosia > > #define SPECIALIZE_TYPE_TRAITS_NICOSIA_PLATFORMLAYER(ToClassName, predicate) \ >@@ -174,3 +271,24 @@ private: > SPECIALIZE_TYPE_TRAITS_END() > > SPECIALIZE_TYPE_TRAITS_NICOSIA_PLATFORMLAYER(CompositionLayer, isCompositionLayer()); >+SPECIALIZE_TYPE_TRAITS_NICOSIA_PLATFORMLAYER(ContentLayer, isContentLayer()); >+ >+#define SPECIALIZE_TYPE_TRAITS_NICOSIA_COMPOSITIONLAYER_IMPL(ToClassName, predicate) \ >+ SPECIALIZE_TYPE_TRAITS_BEGIN(Nicosia::ToClassName) \ >+ static bool isType(const Nicosia::CompositionLayer::Impl& impl) { return impl.predicate; } \ >+ SPECIALIZE_TYPE_TRAITS_END() >+ >+#define SPECIALIZE_TYPE_TRAITS_NICOSIA_CONTENTLAYER_IMPL(ToClassName, predicate) \ >+ SPECIALIZE_TYPE_TRAITS_BEGIN(Nicosia::ToClassName) \ >+ static bool isType(const Nicosia::ContentLayer::Impl& impl) { return impl.predicate; } \ >+ SPECIALIZE_TYPE_TRAITS_END() >+ >+#define SPECIALIZE_TYPE_TRAITS_NICOSIA_BACKINGSTORE_IMPL(ToClassName, predicate) \ >+ SPECIALIZE_TYPE_TRAITS_BEGIN(Nicosia::ToClassName) \ >+ static bool isType(const Nicosia::BackingStore::Impl& impl) { return impl.predicate; } \ >+ SPECIALIZE_TYPE_TRAITS_END() >+ >+#define SPECIALIZE_TYPE_TRAITS_NICOSIA_IMAGEBACKING_IMPL(ToClassName, predicate) \ >+ SPECIALIZE_TYPE_TRAITS_BEGIN(Nicosia::ToClassName) \ >+ static bool isType(const Nicosia::ImageBacking::Impl& impl) { return impl.predicate; } \ >+ SPECIALIZE_TYPE_TRAITS_END() >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >index 98158c753e4b19878def1987634520b3fe2021e6..36d841f3f4a159b493c0808b34a5e295d7673c73 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >@@ -121,6 +121,13 @@ void CoordinatedGraphicsLayer::didChangeGeometry() > setShouldUpdateVisibleRect(); > } > >+// FIXME: this is a temporary helper class to keep Nicosia::CompositionLayer creation working. >+class CompositionLayerNoopImpl final : public Nicosia::CompositionLayer::Impl { >+public: >+ CompositionLayerNoopImpl() = default; >+ virtual ~CompositionLayerNoopImpl() = default; >+}; >+ > CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(Type layerType, GraphicsLayerClient& client) > : GraphicsLayer(layerType, client) > #ifndef NDEBUG >@@ -147,7 +154,11 @@ CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(Type layerType, GraphicsLayer > static CoordinatedLayerID nextLayerID = 1; > m_id = nextLayerID++; > >- m_nicosia.layer = Nicosia::CompositionLayer::create(m_id); >+ m_nicosia.layer = Nicosia::CompositionLayer::create(m_id, >+ [](uint64_t, Nicosia::CompositionLayer&) >+ { >+ return std::make_unique<CompositionLayerNoopImpl>(); >+ }); > } > > CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188341
: 346617