Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Nicosia] Simplify NicosiaPlatformLayer #19637

Merged

Conversation

carlosgcampos
Copy link
Contributor

@carlosgcampos carlosgcampos commented Oct 27, 2023

ee8fbcb

[Nicosia] Simplify NicosiaPlatformLayer
https://bugs.webkit.org/show_bug.cgi?id=263775

Reviewed by Alejandro G. Castro.

We currently have generic classes that are created with a factory that
creates the actual implementation. We only have one implementation, so
we can just remove the unnecessary abstraction to save heap allocations,
avoid casts and make the code easier to read.

There's no change in behavior.

* Source/WebCore/page/scrolling/nicosia/ScrollingTreeFixedNodeNicosia.cpp:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeFixedNodeNicosia.h:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeNicosia.cpp:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNodeNicosia.cpp:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNodeNicosia.h:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreePositionedNodeNicosia.cpp:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreePositionedNodeNicosia.h:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeStickyNodeNicosia.h:
* Source/WebCore/platform/TextureMapper.cmake:
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::pushTextureToCompositor):
(WebCore::MediaPlayerPrivateGStreamer::pushDMABufToCompositor):
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint):
(WebCore::MediaPlayerPrivateGStreamer::flushCurrentBuffer):
(WebCore::MediaPlayerPrivateGStreamer::pushNextHolePunchBuffer):
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* Source/WebCore/platform/graphics/nicosia/NicosiaBackingStore.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.cpp.
(Nicosia::BackingStore::tiledBackingStoreHasPendingTileCreation):
(Nicosia::BackingStore::createTile):
(Nicosia::BackingStore::updateTile):
(Nicosia::BackingStore::removeTile):
(Nicosia::BackingStore::flushUpdate):
(Nicosia::BackingStore::takeUpdate):
* Source/WebCore/platform/graphics/nicosia/NicosiaBackingStore.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.h.
* Source/WebCore/platform/graphics/nicosia/NicosiaCompositionLayer.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h.
* Source/WebCore/platform/graphics/nicosia/NicosiaContentLayer.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp.
(Nicosia::ContentLayer::create):
(Nicosia::ContentLayer::ContentLayer):
(Nicosia::ContentLayer::~ContentLayer):
(Nicosia::ContentLayer::invalidateClient):
(Nicosia::ContentLayer::flushUpdate):
(Nicosia::ContentLayer::swapBuffersIfNeeded):
* Source/WebCore/platform/graphics/nicosia/NicosiaContentLayer.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.h.
* Source/WebCore/platform/graphics/nicosia/NicosiaGCGLANGLELayer.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp.
(Nicosia::GCGLANGLELayer::swapBuffersIfNeeded):
(Nicosia::GCGLANGLELayer::GCGLANGLELayer):
(Nicosia::GCGLANGLELayer::~GCGLANGLELayer):
* Source/WebCore/platform/graphics/nicosia/NicosiaGCGLANGLELayer.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h.
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBacking.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.cpp.
(Nicosia::ImageBacking::flushUpdate):
(Nicosia::ImageBacking::takeUpdate):
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBacking.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.h.
(Nicosia::ImageBacking::create):
(Nicosia::ImageBacking::layerState):
(Nicosia::ImageBacking::compositionState):
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBackingStore.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingStore.cpp.
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBackingStore.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingStore.h.
(Nicosia::ImageBackingStore::backingStoreState):
(Nicosia::ImageBackingStore::CompositionState::CompositionState):
(Nicosia::ImageBackingStore::compositionState):
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp:
(Nicosia::NicosiaImageBufferPipeSource::NicosiaImageBufferPipeSource):
(Nicosia::NicosiaImageBufferPipeSource::~NicosiaImageBufferPipeSource):
(Nicosia::NicosiaImageBufferPipeSource::handle):
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.h:
* Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.cpp: Removed.
* Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h:
(Nicosia::PlatformLayer::PlatformLayer):
(Nicosia::CompositionLayer::Impl::isTextureMapperImpl const): Deleted.
(Nicosia::CompositionLayer::create): Deleted.
(Nicosia::CompositionLayer::impl const): Deleted.
(Nicosia::CompositionLayer::LayerState::Flags::Flags): Deleted.
(Nicosia::CompositionLayer::flushState): Deleted.
(Nicosia::CompositionLayer::commitState): Deleted.
(Nicosia::CompositionLayer::accessPending): Deleted.
(Nicosia::CompositionLayer::accessCommitted): Deleted.
(Nicosia::ContentLayer::Impl::isTextureMapperImpl const): Deleted.
(Nicosia::ContentLayer::create): Deleted.
(Nicosia::ContentLayer::impl const): Deleted.
(Nicosia::BackingStore::Impl::isTextureMapperImpl const): Deleted.
(Nicosia::BackingStore::create): Deleted.
(Nicosia::BackingStore::impl const): Deleted.
(Nicosia::ImageBacking::Impl::isTextureMapperImpl const): Deleted.
(Nicosia::ImageBacking::create): Deleted.
(Nicosia::ImageBacking::impl const): Deleted.
* Source/WebCore/platform/graphics/nicosia/NicosiaScene.cpp:
* Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.cpp:
* Source/WebCore/platform/graphics/nicosia/texmap/NicosiaCompositionLayerTextureMapperImpl.cpp: Removed.
* Source/WebCore/platform/graphics/nicosia/texmap/NicosiaCompositionLayerTextureMapperImpl.h: Removed.
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
(WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
(WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
(WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
(WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
* Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
(WebKit::texmapLayer):
(WebKit::updateBackingStore):
(WebKit::updateImageBacking):
(WebKit::removeLayer):
(WebKit::CoordinatedGraphicsScene::updateSceneState):
(WebKit::compositionLayerImpl): Deleted.
(WebKit::contentLayerImpl): Deleted.
(WebKit::backingStoreImpl): Deleted.
(WebKit::imageBackingImpl): Deleted.
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
(WebKit::CompositingCoordinator::flushPendingLayerChanges):

Canonical link: https://commits.webkit.org/269998@main

14e74c3

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🛠 gtk
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🧪 gtk-wk2
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🧪 api-gtk
✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 🧪 unsafe-merge ✅ 🛠 watch-sim

@carlosgcampos carlosgcampos self-assigned this Oct 27, 2023
@carlosgcampos carlosgcampos added the Platform Portability improvements and other general platform improvements not driven directly by site bugs. label Oct 27, 2023
Copy link
Contributor

@alexgcastro alexgcastro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great simplification of the code.

@carlosgcampos carlosgcampos added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Oct 31, 2023
https://bugs.webkit.org/show_bug.cgi?id=263775

Reviewed by Alejandro G. Castro.

We currently have generic classes that are created with a factory that
creates the actual implementation. We only have one implementation, so
we can just remove the unnecessary abstraction to save heap allocations,
avoid casts and make the code easier to read.

There's no change in behavior.

* Source/WebCore/page/scrolling/nicosia/ScrollingTreeFixedNodeNicosia.cpp:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeFixedNodeNicosia.h:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeNicosia.cpp:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNodeNicosia.cpp:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNodeNicosia.h:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreePositionedNodeNicosia.cpp:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreePositionedNodeNicosia.h:
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeStickyNodeNicosia.h:
* Source/WebCore/platform/TextureMapper.cmake:
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::pushTextureToCompositor):
(WebCore::MediaPlayerPrivateGStreamer::pushDMABufToCompositor):
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint):
(WebCore::MediaPlayerPrivateGStreamer::flushCurrentBuffer):
(WebCore::MediaPlayerPrivateGStreamer::pushNextHolePunchBuffer):
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* Source/WebCore/platform/graphics/nicosia/NicosiaBackingStore.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.cpp.
(Nicosia::BackingStore::tiledBackingStoreHasPendingTileCreation):
(Nicosia::BackingStore::createTile):
(Nicosia::BackingStore::updateTile):
(Nicosia::BackingStore::removeTile):
(Nicosia::BackingStore::flushUpdate):
(Nicosia::BackingStore::takeUpdate):
* Source/WebCore/platform/graphics/nicosia/NicosiaBackingStore.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.h.
* Source/WebCore/platform/graphics/nicosia/NicosiaCompositionLayer.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h.
* Source/WebCore/platform/graphics/nicosia/NicosiaContentLayer.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp.
(Nicosia::ContentLayer::create):
(Nicosia::ContentLayer::ContentLayer):
(Nicosia::ContentLayer::~ContentLayer):
(Nicosia::ContentLayer::invalidateClient):
(Nicosia::ContentLayer::flushUpdate):
(Nicosia::ContentLayer::swapBuffersIfNeeded):
* Source/WebCore/platform/graphics/nicosia/NicosiaContentLayer.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.h.
* Source/WebCore/platform/graphics/nicosia/NicosiaGCGLANGLELayer.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.cpp.
(Nicosia::GCGLANGLELayer::swapBuffersIfNeeded):
(Nicosia::GCGLANGLELayer::GCGLANGLELayer):
(Nicosia::GCGLANGLELayer::~GCGLANGLELayer):
* Source/WebCore/platform/graphics/nicosia/NicosiaGCGLANGLELayer.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGCGLANGLELayer.h.
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBacking.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.cpp.
(Nicosia::ImageBacking::flushUpdate):
(Nicosia::ImageBacking::takeUpdate):
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBacking.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.h.
(Nicosia::ImageBacking::create):
(Nicosia::ImageBacking::layerState):
(Nicosia::ImageBacking::compositionState):
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBackingStore.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingStore.cpp.
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBackingStore.h: Renamed from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingStore.h.
(Nicosia::ImageBackingStore::backingStoreState):
(Nicosia::ImageBackingStore::CompositionState::CompositionState):
(Nicosia::ImageBackingStore::compositionState):
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp:
(Nicosia::NicosiaImageBufferPipeSource::NicosiaImageBufferPipeSource):
(Nicosia::NicosiaImageBufferPipeSource::~NicosiaImageBufferPipeSource):
(Nicosia::NicosiaImageBufferPipeSource::handle):
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.h:
* Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.cpp: Removed.
* Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h:
(Nicosia::PlatformLayer::PlatformLayer):
(Nicosia::CompositionLayer::Impl::isTextureMapperImpl const): Deleted.
(Nicosia::CompositionLayer::create): Deleted.
(Nicosia::CompositionLayer::impl const): Deleted.
(Nicosia::CompositionLayer::LayerState::Flags::Flags): Deleted.
(Nicosia::CompositionLayer::flushState): Deleted.
(Nicosia::CompositionLayer::commitState): Deleted.
(Nicosia::CompositionLayer::accessPending): Deleted.
(Nicosia::CompositionLayer::accessCommitted): Deleted.
(Nicosia::ContentLayer::Impl::isTextureMapperImpl const): Deleted.
(Nicosia::ContentLayer::create): Deleted.
(Nicosia::ContentLayer::impl const): Deleted.
(Nicosia::BackingStore::Impl::isTextureMapperImpl const): Deleted.
(Nicosia::BackingStore::create): Deleted.
(Nicosia::BackingStore::impl const): Deleted.
(Nicosia::ImageBacking::Impl::isTextureMapperImpl const): Deleted.
(Nicosia::ImageBacking::create): Deleted.
(Nicosia::ImageBacking::impl const): Deleted.
* Source/WebCore/platform/graphics/nicosia/NicosiaScene.cpp:
* Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.cpp:
* Source/WebCore/platform/graphics/nicosia/texmap/NicosiaCompositionLayerTextureMapperImpl.cpp: Removed.
* Source/WebCore/platform/graphics/nicosia/texmap/NicosiaCompositionLayerTextureMapperImpl.h: Removed.
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
(WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
(WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
(WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
(WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
* Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
(WebKit::texmapLayer):
(WebKit::updateBackingStore):
(WebKit::updateImageBacking):
(WebKit::removeLayer):
(WebKit::CoordinatedGraphicsScene::updateSceneState):
(WebKit::compositionLayerImpl): Deleted.
(WebKit::contentLayerImpl): Deleted.
(WebKit::backingStoreImpl): Deleted.
(WebKit::imageBackingImpl): Deleted.
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
(WebKit::CompositingCoordinator::flushPendingLayerChanges):

Canonical link: https://commits.webkit.org/269998@main
@webkit-commit-queue
Copy link
Collaborator

Committed 269998@main (ee8fbcb): https://commits.webkit.org/269998@main

Reviewed commits have been landed. Closing PR #19637 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit ee8fbcb into WebKit:main Oct 31, 2023
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Oct 31, 2023
@carlosgcampos carlosgcampos deleted the nicosia-platform-layer branch October 31, 2023 06:00
@nikolaszimmermann
Copy link
Contributor

Thanks @carlosgcampos - much easier to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform Portability improvements and other general platform improvements not driven directly by site bugs.
Projects
None yet
5 participants