WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-217558-20201019171307.patch (text/plain), 54.66 KB, created by
Said Abou-Hallawa
on 2020-10-19 17:13:08 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2020-10-19 17:13:08 PDT
Size:
54.66 KB
patch
obsolete
>Subversion Revision: 268638 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b45f647174b1b55147d54132c299c55e4565d54b..35eef6aaa8b68aa86e2e2981750b248d47e0b5c6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,45 @@ >+2020-10-19 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [GPU Process]: Introduce RemoteResourceCacheProxy to manage the remote resources in Web Process >+ https://bugs.webkit.org/show_bug.cgi?id=217558 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Rename Recorder::Observer to Recorder::Delegate because it will be responsible >+ for creating DisplayListItems in future patches. So it will not be just >+ an observer. Also do not make DisplayList::ImageBuffer a superclass of it. >+ RemoteImageBufferProxy, which is a superclass of DisplayList::ImageBuffer, >+ will be the superclass of Recorder::Delegate. >+ >+ Make ImageBufferBackend::isAccelerated a static member instead of a virtual >+ method. RemoteRenderingBackendProxy would want to know whether the backend >+ of an ImageBuffer isAccelerated or not without having to create it. >+ ImageBufferBackend::isAccelerated will be set to false and >+ ImageBufferIOSurfaceBackend::isAccelerated will be set to true. >+ >+ * platform/graphics/ConcreteImageBuffer.h: >+ * platform/graphics/ImageBuffer.h: >+ (WebCore::ImageBuffer::remoteResourceIdentifier const): >+ * platform/graphics/ImageBufferBackend.h: >+ (WebCore::ImageBufferBackend::isAccelerated const): Deleted. >+ * platform/graphics/RemoteResourceIdentifier.h: >+ * platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp: >+ (WebCore::ImageBufferIOSurfaceBackend::isAccelerated const): Deleted. >+ * platform/graphics/cg/ImageBufferIOSurfaceBackend.h: >+ * 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.cpp: >+ (WebCore::DisplayList::Recorder::Recorder): >+ (WebCore::DisplayList::Recorder::willAppendItem): >+ * platform/graphics/displaylists/DisplayListRecorder.h: >+ (WebCore::DisplayList::Recorder::Delegate::~Delegate): >+ (WebCore::DisplayList::Recorder::Observer::~Observer): Deleted. >+ (WebCore::DisplayList::Recorder::Observer::willAppendItem): Deleted. >+ > 2020-10-17 Myles C. Maxfield <mmaxfield@apple.com> > > REGRESSION(r268561): Synthetic oblique text is drawn upside-down >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index bde88111ffe8f80d5a9c039556d9a48fbac44987..76db6db528814d7e00bc561d6f543eec6dd724b5 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,54 @@ >+2020-10-19 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [GPU Process]: Introduce RemoteResourceCacheProxy to manage the remote resources in Web Process >+ https://bugs.webkit.org/show_bug.cgi?id=217558 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove RemoteImageBufferMessageHandlerProxy and move sending the messages >+ to RemoteRenderingBackendProxy. >+ >+ To allow casting ImageBuffer to RemoteImageBufferProxy, a new method named >+ remoteResourceIdentifier() is added to IamgeBuffer and it is only overridden >+ by RemoteImageBufferProxy. This method is used in SPECIALIZE_TYPE_TRAITS >+ macros along with IamgeBuffer::isAccelerated(). >+ >+ Introduce RemoteResourceCacheProxy which will manage caching and releasing >+ the RemoteImageBufferProxy. Caching NativeImage will be added to it in >+ future patches. More about controlling the life cycles of remote resources >+ will be added with supporting drawing remote resources to remote client. >+ >+ * Sources.txt: >+ * WebKit.xcodeproj/project.pbxproj: >+ * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h: >+ (isType): >+ * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp: Removed. >+ * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h: Removed. >+ * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: >+ (WebKit::RemoteImageBufferProxy::create): >+ (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): >+ (WebKit::RemoteImageBufferProxy::createBackend): >+ (WebKit::RemoteImageBufferProxy::commitFlushDisplayList): >+ (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): >+ (WebKit::RemoteImageBufferProxy::isPendingFlush const): >+ * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: >+ (WebKit::RemoteRenderingBackendProxy::createImageBuffer): >+ (WebKit::RemoteRenderingBackendProxy::getImageData): >+ (WebKit::RemoteRenderingBackendProxy::flushDisplayList): >+ (WebKit::RemoteRenderingBackendProxy::flushDisplayListAndCommit): >+ (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): >+ (WebKit::RemoteRenderingBackendProxy::imageBufferBackendWasCreated): >+ (WebKit::RemoteRenderingBackendProxy::flushDisplayListWasCommitted): >+ * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: >+ (WebKit::RemoteRenderingBackendProxy::remoteResourceCacheProxy): >+ (WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const): Deleted. >+ * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: Copied from Source/WebCore/platform/graphics/RemoteResourceIdentifier.h. >+ (WebKit::RemoteResourceCacheProxy::RemoteResourceCacheProxy): >+ (WebKit::RemoteResourceCacheProxy::cacheImageBuffer): >+ (WebKit::RemoteResourceCacheProxy::cachedImageBuffer): >+ (WebKit::RemoteResourceCacheProxy::releaseImageBuffer): >+ * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: Copied from Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h. >+ > 2020-10-16 Said Abou-Hallawa <sabouhallawa@apple.com> > > [GPU Process] Introduce RemoteResourceCacheProxy to manage the resources in the GPU Process >diff --git a/Source/WebCore/platform/graphics/ConcreteImageBuffer.h b/Source/WebCore/platform/graphics/ConcreteImageBuffer.h >index c6c19e1289f48b020ea78bce39d106c3db93b07d..8697395fa4c8d0851c7b7790406e61c918fcea50 100644 >--- a/Source/WebCore/platform/graphics/ConcreteImageBuffer.h >+++ b/Source/WebCore/platform/graphics/ConcreteImageBuffer.h >@@ -50,13 +50,8 @@ public: > return nullptr; > return std::unique_ptr<ImageBufferType>(new ImageBufferType(WTFMove(backend), std::forward<Arguments>(arguments)...)); > } >- >- bool isAccelerated() const override >- { >- if (auto* backend = ensureBackendCreated()) >- return backend->isAccelerated(); >- return false; >- } >+ >+ bool isAccelerated() const override { return BackendType::isAccelerated; } > > protected: > ConcreteImageBuffer(std::unique_ptr<BackendType>&& backend) >diff --git a/Source/WebCore/platform/graphics/ImageBuffer.h b/Source/WebCore/platform/graphics/ImageBuffer.h >index 0ae9fcbd0588d4c4e1ef5af3cc7f12b612bf78da..8b94f91d9ba9146244f01b703cb347a8a9d7d198 100644 >--- a/Source/WebCore/platform/graphics/ImageBuffer.h >+++ b/Source/WebCore/platform/graphics/ImageBuffer.h >@@ -28,6 +28,7 @@ > #pragma once > > #include "ImageBufferBackend.h" >+#include "RemoteResourceIdentifier.h" > #include "RenderingMode.h" > > namespace WebCore { >@@ -60,6 +61,9 @@ public: > > WEBCORE_EXPORT virtual ~ImageBuffer() = default; > >+ virtual bool isAccelerated() const = 0; >+ virtual RemoteResourceIdentifier remoteResourceIdentifier() const { return { }; } >+ > virtual GraphicsContext& context() const = 0; > virtual void flushContext() = 0; > >@@ -104,8 +108,6 @@ public: > virtual bool copyToPlatformTexture(GraphicsContextGLOpenGL&, GCGLenum, PlatformGLObject, GCGLenum, bool, bool) const = 0; > virtual PlatformLayer* platformLayer() const = 0; > >- virtual bool isAccelerated() const = 0; >- > protected: > ImageBuffer() = default; > >diff --git a/Source/WebCore/platform/graphics/ImageBufferBackend.h b/Source/WebCore/platform/graphics/ImageBufferBackend.h >index c010a0f0cfcd8c5e7ab6c94c5c3c36f48386d01f..171ed3e694130a340141e61d92101e28101d737c 100644 >--- a/Source/WebCore/platform/graphics/ImageBufferBackend.h >+++ b/Source/WebCore/platform/graphics/ImageBufferBackend.h >@@ -100,7 +100,7 @@ public: > virtual bool copyToPlatformTexture(GraphicsContextGLOpenGL&, GCGLenum, PlatformGLObject, GCGLenum, bool, bool) const { return false; } > > static constexpr bool isOriginAtUpperLeftCorner = false; >- virtual bool isAccelerated() const { return false; } >+ static constexpr bool isAccelerated = false; > > protected: > WEBCORE_EXPORT ImageBufferBackend(const FloatSize& logicalSize, const IntSize& backendSize, float resolutionScale, ColorSpace); >diff --git a/Source/WebCore/platform/graphics/RemoteResourceIdentifier.h b/Source/WebCore/platform/graphics/RemoteResourceIdentifier.h >index 2af542dfec847abc371aa2f1e8e4b8dd9fb110e5..6690becdc8b4aae8524b3f6810fb9264c85c499c 100644 >--- a/Source/WebCore/platform/graphics/RemoteResourceIdentifier.h >+++ b/Source/WebCore/platform/graphics/RemoteResourceIdentifier.h >@@ -25,8 +25,6 @@ > > #pragma once > >-#if ENABLE(GPU_PROCESS) >- > #include <wtf/ObjectIdentifier.h> > > namespace WebCore { >@@ -35,5 +33,3 @@ enum RemoteResourceIdentifierType { }; > using RemoteResourceIdentifier = ObjectIdentifier<RemoteResourceIdentifierType>; > > } // namespace WebCore >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp >index c8065a9ec2514644f7405f9a5413f62235627154..dbc3b7eb8b3d1ad88d0ab3f0eef90a7c8d85e030 100644 >--- a/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp >+++ b/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp >@@ -190,11 +190,6 @@ IOSurface* ImageBufferIOSurfaceBackend::surface() > return m_surface.get(); > } > >-bool ImageBufferIOSurfaceBackend::isAccelerated() const >-{ >- return true; >-} >- > } // namespace WebCore > > #endif // HAVE(IOSURFACE) >diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h b/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h >index 2418f1d45d53d45933b3904a288c6101f14bcc31..323094ea795c5d2483c884403124a9040cc740fb 100644 >--- a/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h >+++ b/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h >@@ -62,9 +62,9 @@ public: > RefPtr<ImageData> getImageData(AlphaPremultiplication outputFormat, const IntRect&) const override; > void putImageData(AlphaPremultiplication inputFormat, const ImageData&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) override; > IOSurface* surface(); >- bool isAccelerated() const override; > > static constexpr bool isOriginAtUpperLeftCorner = true; >+ static constexpr bool isAccelerated = true; > > protected: > static RetainPtr<CGColorSpaceRef> contextColorSpace(const GraphicsContext&); >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.cpp >index 23cc07e8ae442bdcea0d3674a5a8551c65cfdc87..d4617d3516f4f3e51d75d64434a6a39457a0001f 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.cpp >@@ -33,9 +33,9 @@ > namespace WebCore { > namespace DisplayList { > >-DrawingContext::DrawingContext(const FloatSize& logicalSize, const AffineTransform& initialCTM, Recorder::Observer* observer) >+DrawingContext::DrawingContext(const FloatSize& logicalSize, const AffineTransform& initialCTM, Recorder::Delegate* delegate) > : m_context([&](GraphicsContext& displayListContext) { >- return makeUnique<Recorder>(displayListContext, m_displayList, GraphicsContextState(), FloatRect({ }, logicalSize), initialCTM, observer); >+ return makeUnique<Recorder>(displayListContext, m_displayList, GraphicsContextState(), FloatRect({ }, logicalSize), initialCTM, delegate); > }) > { > } >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h b/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h >index 7b673f32ad815a50081b7e7ab108131717fde543..22ed256e80ad293a052069b743088a1351f47cc0 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h >@@ -35,7 +35,7 @@ namespace DisplayList { > class DrawingContext { > WTF_MAKE_FAST_ALLOCATED; > public: >- WEBCORE_EXPORT DrawingContext(const FloatSize& logicalSize, const AffineTransform& initialCTM = { }, Recorder::Observer* = nullptr); >+ WEBCORE_EXPORT DrawingContext(const FloatSize& logicalSize, const AffineTransform& initialCTM = { }, Recorder::Delegate* = nullptr); > > GraphicsContext& context() const { return const_cast<DrawingContext&>(*this).m_context; } > WEBCORE_EXPORT Recorder& recorder(); >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h b/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h >index 6fd912dfb8fe11c098dd6126a8c878ac6ba7ae02..32599e062d7cf59d1dc2ead01e760d66e3f7ec3c 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h >@@ -32,7 +32,7 @@ namespace WebCore { > namespace DisplayList { > > template<typename BackendType> >-class ImageBuffer : public ConcreteImageBuffer<BackendType>, public Recorder::Observer { >+class ImageBuffer : public ConcreteImageBuffer<BackendType> { > using BaseConcreteImageBuffer = ConcreteImageBuffer<BackendType>; > > public: >@@ -48,12 +48,12 @@ public: > > ImageBuffer(std::unique_ptr<BackendType>&& dataBackend, const FloatSize& size) > : BaseConcreteImageBuffer(WTFMove(dataBackend)) >- , m_drawingContext(size, initialDrawingContextCTM(size), this) >+ , m_drawingContext(size, initialDrawingContextCTM(size)) > { > } > >- ImageBuffer(const FloatSize& size) >- : m_drawingContext(size, initialDrawingContextCTM(size), this) >+ ImageBuffer(const FloatSize& size, Recorder::Delegate* delegate = nullptr) >+ : m_drawingContext(size, initialDrawingContextCTM(size), delegate) > { > } > >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >index 1c54ae822939420dd40b7b70ba7e39dbba65fe9b..b90be276b6639a4249329cbe2f6b90479c0623e3 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >@@ -37,10 +37,10 @@ > namespace WebCore { > namespace DisplayList { > >-Recorder::Recorder(GraphicsContext& context, DisplayList& displayList, const GraphicsContextState& state, const FloatRect& initialClip, const AffineTransform& initialCTM, Observer* observer) >+Recorder::Recorder(GraphicsContext& context, DisplayList& displayList, const GraphicsContextState& state, const FloatRect& initialClip, const AffineTransform& initialCTM, Delegate* delegate) > : GraphicsContextImpl(context, initialClip, AffineTransform()) > , m_displayList(displayList) >- , m_observer(observer) >+ , m_delegate(delegate) > { > LOG_WITH_STREAM(DisplayLists, stream << "\nRecording with clip " << initialClip); > m_stateStack.append({ state, initialCTM, initialClip }); >@@ -59,8 +59,8 @@ void Recorder::putImageData(WebCore::AlphaPremultiplication inputFormat, const W > > void Recorder::willAppendItem(const Item& item) > { >- if (m_observer) >- m_observer->willAppendItem(item); >+ if (m_delegate) >+ m_delegate->willAppendItem(item); > > if (item.isDrawingItem() > #if USE(CG) >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >index 9ee1d3938f232f3f18d978af718701d8be463072..6f36707e0b761bf62c5423413c941250338a548c 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >@@ -53,8 +53,8 @@ class Recorder : public GraphicsContextImpl { > WTF_MAKE_FAST_ALLOCATED; > WTF_MAKE_NONCOPYABLE(Recorder); > public: >- class Observer; >- WEBCORE_EXPORT Recorder(GraphicsContext&, DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&, Observer* = nullptr); >+ class Delegate; >+ WEBCORE_EXPORT Recorder(GraphicsContext&, DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&, Delegate* = nullptr); > WEBCORE_EXPORT virtual ~Recorder(); > > WEBCORE_EXPORT void putImageData(AlphaPremultiplication inputFormat, const ImageData&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat); >@@ -63,9 +63,9 @@ public: > > void appendItemAndUpdateExtent(Ref<DrawingItem>&&); > >- class Observer { >+ class Delegate { > public: >- virtual ~Observer() { } >+ virtual ~Delegate() { } > virtual void willAppendItem(const Item&) { }; > }; > >@@ -188,7 +188,7 @@ private: > ContextState& currentState(); > > DisplayList& m_displayList; >- Observer* m_observer; >+ Delegate* m_delegate; > > Vector<ContextState, 32> m_stateStack; > }; >diff --git a/Source/WebKit/Sources.txt b/Source/WebKit/Sources.txt >index 796db6996eedfe5b7e928001372054cf69c38046..7a3b2300b7c36890ffc253bba0554af20362f5d5 100644 >--- a/Source/WebKit/Sources.txt >+++ b/Source/WebKit/Sources.txt >@@ -557,8 +557,8 @@ WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp > > WebProcess/GPU/GPUProcessConnection.cpp > WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp >-WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp > WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp >+WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp > WebProcess/GPU/media/AudioTrackPrivateRemote.cpp > WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp > WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 6bd9ac45f31ac43c2fc0964af5fdde4a78e68487..7486903488ca63a154a1e9c016e58fcc8e8bea89 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -4224,8 +4224,6 @@ > 71A676A522C62318007D6295 /* WKTouchActionGestureRecognizer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKTouchActionGestureRecognizer.mm; path = ios/WKTouchActionGestureRecognizer.mm; sourceTree = "<group>"; }; > 71FB810A2260627A00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteSimulatedMouseEventsDispatchPolicy.h; sourceTree = "<group>"; }; > 7227800B2408BD7D007D376B /* PlatformRemoteImageBufferProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformRemoteImageBufferProxy.h; sourceTree = "<group>"; }; >- 7227800C24097A02007D376B /* RemoteImageBufferMessageHandlerProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteImageBufferMessageHandlerProxy.cpp; sourceTree = "<group>"; }; >- 7227800D24097A02007D376B /* RemoteImageBufferMessageHandlerProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteImageBufferMessageHandlerProxy.h; sourceTree = "<group>"; }; > 726D56DD253A64810002EF90 /* RemoteResourceCache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteResourceCache.cpp; sourceTree = "<group>"; }; > 726D56DE253A64810002EF90 /* RemoteResourceCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteResourceCache.h; sourceTree = "<group>"; }; > 727A7F342407857D004D2931 /* ImageBufferShareableIOSurfaceBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBufferShareableIOSurfaceBackend.cpp; sourceTree = "<group>"; }; >@@ -4237,6 +4235,8 @@ > 727A7F492408AEE6004D2931 /* RemoteImageBufferProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteImageBufferProxy.h; sourceTree = "<group>"; }; > 728E86EF1795188C0087879E /* WebColorPickerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebColorPickerMac.h; sourceTree = "<group>"; }; > 728E86F01795188C0087879E /* WebColorPickerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebColorPickerMac.mm; sourceTree = "<group>"; }; >+ 72B53157253C1E4D0049295A /* RemoteResourceCacheProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteResourceCacheProxy.cpp; sourceTree = "<group>"; }; >+ 72B53158253C1E4D0049295A /* RemoteResourceCacheProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteResourceCacheProxy.h; sourceTree = "<group>"; }; > 75A8D2C4187CCF9F00C39C9E /* WKWebsiteDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsiteDataStore.h; sourceTree = "<group>"; }; > 75A8D2C5187CCF9F00C39C9E /* WKWebsiteDataStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebsiteDataStore.mm; sourceTree = "<group>"; }; > 75A8D2D4187D1C0100C39C9E /* WKWebsiteDataStoreInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsiteDataStoreInternal.h; sourceTree = "<group>"; }; >@@ -8138,12 +8138,12 @@ > 727A7F36240788F0004D2931 /* ImageBufferShareableBitmapBackend.h */, > 727A7F38240788F0004D2931 /* PlatformImageBufferShareableBackend.h */, > 7227800B2408BD7D007D376B /* PlatformRemoteImageBufferProxy.h */, >- 7227800C24097A02007D376B /* RemoteImageBufferMessageHandlerProxy.cpp */, >- 7227800D24097A02007D376B /* RemoteImageBufferMessageHandlerProxy.h */, > 727A7F492408AEE6004D2931 /* RemoteImageBufferProxy.h */, > 5506409D2407160900AAE045 /* RemoteRenderingBackendProxy.cpp */, > 5506409E2407160900AAE045 /* RemoteRenderingBackendProxy.h */, > 550640A0240719E100AAE045 /* RemoteRenderingBackendProxy.messages.in */, >+ 72B53157253C1E4D0049295A /* RemoteResourceCacheProxy.cpp */, >+ 72B53158253C1E4D0049295A /* RemoteResourceCacheProxy.h */, > 5506409F2407196A00AAE045 /* RenderingBackendIdentifier.h */, > ); > path = graphics; >diff --git a/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h b/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h >index 9aff088e37ca76a7f864ae7e42bbb7004f1f1523..8e64f05a8a6e8f5ec58914d47064b1d0a596d0cd 100644 >--- a/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h >+++ b/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h >@@ -37,4 +37,12 @@ using AcceleratedRemoteImageBufferProxy = RemoteImageBufferProxy<AcceleratedImag > > } // namespace WebKit > >+SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::UnacceleratedRemoteImageBufferProxy) >+ static bool isType(const WebCore::ImageBuffer& imageBuffer) { return imageBuffer.remoteResourceIdentifier() && !imageBuffer.isAccelerated(); } >+SPECIALIZE_TYPE_TRAITS_END() >+ >+SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::AcceleratedRemoteImageBufferProxy) >+ static bool isType(const WebCore::ImageBuffer& imageBuffer) { return imageBuffer.remoteResourceIdentifier() && imageBuffer.isAccelerated(); } >+SPECIALIZE_TYPE_TRAITS_END() >+ > #endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp >deleted file mode 100644 >index e9562a368e69e4230e7262c2636df286d746eac5..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp >+++ /dev/null >@@ -1,103 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "RemoteImageBufferMessageHandlerProxy.h" >- >-#if ENABLE(GPU_PROCESS) >- >-#include "ImageDataReference.h" >-#include "RemoteRenderingBackendMessages.h" >-#include "RemoteRenderingBackendProxy.h" >-#include <WebCore/DisplayListItems.h> >-#include <wtf/SystemTracing.h> >- >-namespace WebKit { >-using namespace WebCore; >- >-RemoteImageBufferMessageHandlerProxy::RemoteImageBufferMessageHandlerProxy(const FloatSize& size, RenderingMode renderingMode, float resolutionScale, ColorSpace colorSpace, RemoteRenderingBackendProxy& remoteRenderingBackendProxy) >- : m_remoteRenderingBackendProxy(makeWeakPtr(remoteRenderingBackendProxy)) >-{ >- // Create the RemoteImageBufferProxy. >- m_remoteRenderingBackendProxy->send(Messages::RemoteRenderingBackend::CreateImageBuffer(size, renderingMode, resolutionScale, colorSpace, m_remoteResourceIdentifier), m_remoteRenderingBackendProxy->renderingBackendIdentifier()); >-} >- >-RemoteImageBufferMessageHandlerProxy::~RemoteImageBufferMessageHandlerProxy() >-{ >- // Release the RemoteImageBufferProxy. >- if (!m_remoteRenderingBackendProxy) >- return; >- m_remoteRenderingBackendProxy->send(Messages::RemoteRenderingBackend::ReleaseRemoteResource(m_remoteResourceIdentifier), m_remoteRenderingBackendProxy->renderingBackendIdentifier()); >-} >- >-RefPtr<ImageData> RemoteImageBufferMessageHandlerProxy::getImageData(AlphaPremultiplication outputFormat, const IntRect& srcRect) const >-{ >- IPC::ImageDataReference imageDataReference; >- m_remoteRenderingBackendProxy->sendSync(Messages::RemoteRenderingBackend::GetImageData(outputFormat, srcRect, m_remoteResourceIdentifier), Messages::RemoteRenderingBackend::GetImageData::Reply(imageDataReference), m_remoteRenderingBackendProxy->renderingBackendIdentifier(), 1_s); >- return imageDataReference.buffer(); >-} >- >-void RemoteImageBufferMessageHandlerProxy::waitForImageBufferBackendWasCreated() >-{ >- if (m_remoteRenderingBackendProxy && !isBackendCreated()) >- m_remoteRenderingBackendProxy->waitForImageBufferBackendWasCreated(); >-} >- >-void RemoteImageBufferMessageHandlerProxy::waitForFlushDisplayListWasCommitted() >-{ >- if (m_remoteRenderingBackendProxy && isPendingFlush()) >- m_remoteRenderingBackendProxy->waitForFlushDisplayListWasCommitted(); >-} >- >-void RemoteImageBufferMessageHandlerProxy::flushDisplayList(WebCore::DisplayList::DisplayList& displayList) >-{ >- if (!m_remoteRenderingBackendProxy) >- return; >- >- TraceScope tracingScope(FlushRemoteImageBufferStart, FlushRemoteImageBufferEnd); >- m_remoteRenderingBackendProxy->send(Messages::RemoteRenderingBackend::FlushDisplayList(displayList, m_remoteResourceIdentifier), m_remoteRenderingBackendProxy->renderingBackendIdentifier()); >- displayList.clear(); >-} >- >-void RemoteImageBufferMessageHandlerProxy::flushDisplayListAndWaitCommit(WebCore::DisplayList::DisplayList& displayList) >-{ >- if (!m_remoteRenderingBackendProxy) >- return; >- >- TraceScope tracingScope(FlushRemoteImageBufferStart, FlushRemoteImageBufferEnd, 1); >- m_sentFlushIdentifier = DisplayListFlushIdentifier::generate(); >- m_remoteRenderingBackendProxy->send(Messages::RemoteRenderingBackend::FlushDisplayListAndCommit(displayList, m_sentFlushIdentifier, m_remoteResourceIdentifier), m_remoteRenderingBackendProxy->renderingBackendIdentifier()); >- displayList.clear(); >- waitForFlushDisplayListWasCommitted(); >-} >- >-void RemoteImageBufferMessageHandlerProxy::commitFlushContext(DisplayListFlushIdentifier flushIdentifier) >-{ >- m_receivedFlushIdentifier = flushIdentifier; >-} >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h >deleted file mode 100644 >index b9a026a81298796e7bd35fa96eee904de4bfb5fd..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h >+++ /dev/null >@@ -1,83 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if ENABLE(GPU_PROCESS) >- >-#include "DisplayListFlushIdentifier.h" >-#include "ImageBufferBackendHandle.h" >-#include <WebCore/ColorSpace.h> >-#include <WebCore/DisplayList.h> >-#include <WebCore/FloatSize.h> >-#include <WebCore/RemoteResourceIdentifier.h> >-#include <WebCore/RenderingMode.h> >- >-namespace WebCore { >-class ImageData; >-enum class AlphaPremultiplication : uint8_t; >-} >- >-namespace WebKit { >- >-class RemoteRenderingBackendProxy; >- >-class RemoteImageBufferMessageHandlerProxy { >-public: >- virtual ~RemoteImageBufferMessageHandlerProxy(); >- >- WebCore::RemoteResourceIdentifier remoteResourceIdentifier() const { return m_remoteResourceIdentifier; } >- >- // Messages to be received. See RemoteRenderingBackend.messages.in. >- virtual void createBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle) = 0; >- >- void commitFlushContext(DisplayListFlushIdentifier); >- >-protected: >- RemoteImageBufferMessageHandlerProxy(const WebCore::FloatSize&, WebCore::RenderingMode, float resolutionScale, WebCore::ColorSpace, RemoteRenderingBackendProxy&); >- >- virtual bool isBackendCreated() const = 0; >- bool isPendingFlush() const { return m_sentFlushIdentifier != m_receivedFlushIdentifier; } >- >- RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const; >- >- void waitForImageBufferBackendWasCreated(); >- void waitForFlushDisplayListWasCommitted(); >- >- // Messages to be sent. See RemoteRenderingBackendProxy.messages.in. >- void flushDisplayList(WebCore::DisplayList::DisplayList&); >- void flushDisplayListAndWaitCommit(WebCore::DisplayList::DisplayList&); >- >-private: >- WeakPtr<RemoteRenderingBackendProxy> m_remoteRenderingBackendProxy; >- WebCore::RemoteResourceIdentifier m_remoteResourceIdentifier { WebCore::RemoteResourceIdentifier::generate() }; >- >- DisplayListFlushIdentifier m_sentFlushIdentifier; >- DisplayListFlushIdentifier m_receivedFlushIdentifier; >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h >index 20fbf81c982552ef76bb6cd15dc3a1e9d3880ec3..279a792a02dc0e717d28b378fc1df10aa853478c 100644 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h >@@ -27,7 +27,6 @@ > > #if ENABLE(GPU_PROCESS) > >-#include "RemoteImageBufferMessageHandlerProxy.h" > #include <WebCore/DisplayListImageBuffer.h> > #include <WebCore/DisplayListItems.h> > #include <WebCore/DisplayListRecorder.h> >@@ -37,54 +36,71 @@ namespace WebKit { > class RemoteRenderingBackend; > > template<typename BackendType> >-class RemoteImageBufferProxy : public WebCore::DisplayList::ImageBuffer<BackendType>, public RemoteImageBufferMessageHandlerProxy { >+class RemoteImageBufferProxy : public WebCore::DisplayList::ImageBuffer<BackendType>, public WebCore::DisplayList::Recorder::Delegate { > using BaseDisplayListImageBuffer = WebCore::DisplayList::ImageBuffer<BackendType>; > using BaseDisplayListImageBuffer::m_backend; > using BaseDisplayListImageBuffer::m_drawingContext; > > public: >- static std::unique_ptr<RemoteImageBufferProxy> create(const WebCore::FloatSize& size, WebCore::RenderingMode renderingMode, float resolutionScale, WebCore::ColorSpace colorSpace, RemoteRenderingBackendProxy& remoteRenderingBackendProxy) >+ static std::unique_ptr<RemoteImageBufferProxy> create(const WebCore::FloatSize& size, float resolutionScale, RemoteRenderingBackendProxy& remoteRenderingBackendProxy) > { > if (BackendType::calculateBackendSize(size, resolutionScale).isEmpty()) > return nullptr; > >- return std::unique_ptr<RemoteImageBufferProxy>(new RemoteImageBufferProxy(size, renderingMode, resolutionScale, colorSpace, remoteRenderingBackendProxy)); >+ return std::unique_ptr<RemoteImageBufferProxy>(new RemoteImageBufferProxy(size, remoteRenderingBackendProxy)); > } > > ~RemoteImageBufferProxy() > { >+ if (!m_remoteRenderingBackendProxy) >+ return; > flushDrawingContext(); >+ m_remoteRenderingBackendProxy->remoteResourceCacheProxy().releaseImageBuffer(m_remoteResourceIdentifier); > } > >-protected: >- RemoteImageBufferProxy(const WebCore::FloatSize& size, WebCore::RenderingMode renderingMode, float resolutionScale, WebCore::ColorSpace colorSpace, RemoteRenderingBackendProxy& remoteRenderingBackendProxy) >- : BaseDisplayListImageBuffer(size) >- , RemoteImageBufferMessageHandlerProxy(size, renderingMode, resolutionScale, colorSpace, remoteRenderingBackendProxy) >- { >- } >+ WebCore::RemoteResourceIdentifier remoteResourceIdentifier() const override { return m_remoteResourceIdentifier; } > >- void createBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace colorSpace, ImageBufferBackendHandle handle) override >+ void createBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace colorSpace, ImageBufferBackendHandle handle) > { > ASSERT(!m_backend); > m_backend = BackendType::create(logicalSize, backendSize, resolutionScale, colorSpace, WTFMove(handle)); > } >- >- bool isBackendCreated() const override { return m_backend.get(); } >+ >+ void commitFlushDisplayList(DisplayListFlushIdentifier flushIdentifier) >+ { >+ m_receivedFlushIdentifier = flushIdentifier; >+ } >+ >+protected: >+ RemoteImageBufferProxy(const WebCore::FloatSize& size, RemoteRenderingBackendProxy& remoteRenderingBackendProxy) >+ : BaseDisplayListImageBuffer(size, this) >+ , m_remoteRenderingBackendProxy(makeWeakPtr(remoteRenderingBackendProxy)) >+ { >+ ASSERT(m_remoteRenderingBackendProxy); >+ } >+ >+ bool isPendingFlush() const { return m_sentFlushIdentifier != m_receivedFlushIdentifier; } > > BackendType* ensureBackendCreated() const override > { >- if (!m_backend) >- const_cast<RemoteImageBufferProxy&>(*this).RemoteImageBufferMessageHandlerProxy::waitForImageBufferBackendWasCreated(); >+ if (!m_backend && m_remoteRenderingBackendProxy) >+ m_remoteRenderingBackendProxy->waitForImageBufferBackendWasCreated(); > return m_backend.get(); > } > > RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const override > { >+ if (!m_remoteRenderingBackendProxy) >+ return nullptr; >+ > auto& displayList = const_cast<RemoteImageBufferProxy*>(this)->m_drawingContext.displayList(); >- const_cast<RemoteImageBufferProxy*>(this)->RemoteImageBufferMessageHandlerProxy::flushDisplayList(displayList); >- auto result = const_cast<RemoteImageBufferProxy*>(this)->RemoteImageBufferMessageHandlerProxy::getImageData(outputFormat, srcRect); >+ if (displayList.itemCount()) { >+ const_cast<RemoteImageBufferProxy&>(*this).flushDisplayList(displayList); >+ displayList.clear(); >+ } >+ > // getImageData is synchronous, which means we've already received the CommitImageBufferFlushContext message. >- return result; >+ return m_remoteRenderingBackendProxy->getImageData(outputFormat, srcRect, m_remoteResourceIdentifier); > } > > void putImageData(WebCore::AlphaPremultiplication inputFormat, const WebCore::ImageData& imageData, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint = { }, WebCore::AlphaPremultiplication destFormat = WebCore::AlphaPremultiplication::Premultiplied) override >@@ -104,17 +120,44 @@ protected: > void flushDrawingContext() override > { > auto& displayList = m_drawingContext.displayList(); >- if (displayList.itemCount()) >- RemoteImageBufferMessageHandlerProxy::flushDisplayListAndWaitCommit(displayList); >+ if (!displayList.itemCount() || !m_remoteRenderingBackendProxy) >+ return; >+ >+ TraceScope tracingScope(FlushRemoteImageBufferStart, FlushRemoteImageBufferEnd, 1); >+ m_sentFlushIdentifier = m_remoteRenderingBackendProxy->flushDisplayListAndCommit(displayList, m_remoteResourceIdentifier); >+ >+ // Wait for our DisplayList to be flushed but do not hang. >+ static constexpr unsigned maxWaitingFlush = 3; >+ for (unsigned numWaitingFlush = 0; numWaitingFlush < maxWaitingFlush && isPendingFlush(); ++numWaitingFlush) >+ m_remoteRenderingBackendProxy->waitForFlushDisplayListWasCommitted(); >+ >+ displayList.clear(); > } >- >+ >+ void flushDisplayList(const WebCore::DisplayList::DisplayList& displayList) override >+ { >+ if (!displayList.itemCount() || !m_remoteRenderingBackendProxy) >+ return; >+ >+ TraceScope tracingScope(FlushRemoteImageBufferStart, FlushRemoteImageBufferEnd); >+ m_remoteRenderingBackendProxy->flushDisplayList(displayList, m_remoteResourceIdentifier); >+ } >+ > void willAppendItem(const WebCore::DisplayList::Item&) override > { > constexpr size_t DisplayListBatchSize = 512; > auto& displayList = m_drawingContext.displayList(); >- if (displayList.itemCount() >= DisplayListBatchSize) >- RemoteImageBufferMessageHandlerProxy::flushDisplayList(displayList); >+ if (displayList.itemCount() < DisplayListBatchSize || !m_remoteRenderingBackendProxy) >+ return; >+ >+ flushDisplayList(displayList); >+ displayList.clear(); > } >+ >+ DisplayListFlushIdentifier m_sentFlushIdentifier; >+ DisplayListFlushIdentifier m_receivedFlushIdentifier; >+ WebCore::RemoteResourceIdentifier m_remoteResourceIdentifier { WebCore::RemoteResourceIdentifier::generate() }; >+ WeakPtr<RemoteRenderingBackendProxy> m_remoteRenderingBackendProxy; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp >index b1461b482148d2b75b40f098d940cde10ab4ffce..5d4e0820e09a514f9bfe538ea28aff2e89e82c73 100644 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp >@@ -30,6 +30,7 @@ > > #include "GPUConnectionToWebProcess.h" > #include "GPUProcessConnection.h" >+#include "ImageDataReference.h" > #include "PlatformRemoteImageBufferProxy.h" > #include "RemoteRenderingBackendMessages.h" > #include "RemoteRenderingBackendProxyMessages.h" >@@ -88,38 +89,75 @@ bool RemoteRenderingBackendProxy::waitForFlushDisplayListWasCommitted() > > std::unique_ptr<ImageBuffer> RemoteRenderingBackendProxy::createImageBuffer(const FloatSize& size, ShouldAccelerate shouldAccelerate, float resolutionScale, ColorSpace colorSpace) > { >+ RenderingMode renderingMode; >+ std::unique_ptr<WebCore::ImageBuffer> imageBuffer; >+ > if (shouldAccelerate == ShouldAccelerate::Yes) { >- if (auto imageBuffer = AcceleratedRemoteImageBufferProxy::create(size, RenderingMode::RemoteAccelerated, resolutionScale, colorSpace, *this)) { >- m_imageBufferMessageHandlerMap.add(imageBuffer->remoteResourceIdentifier(), imageBuffer.get()); >- return imageBuffer; >- } >+ renderingMode = RenderingMode::RemoteAccelerated; >+ imageBuffer = AcceleratedRemoteImageBufferProxy::create(size, resolutionScale, *this); >+ } >+ >+ if (!imageBuffer) { >+ renderingMode = RenderingMode::RemoteUnaccelerated; >+ imageBuffer = UnacceleratedRemoteImageBufferProxy::create(size, resolutionScale, *this); > } > >- if (auto imageBuffer = UnacceleratedRemoteImageBufferProxy::create(size, RenderingMode::RemoteUnaccelerated, resolutionScale, colorSpace, *this)) { >- m_imageBufferMessageHandlerMap.add(imageBuffer->remoteResourceIdentifier(), imageBuffer.get()); >+ if (imageBuffer) { >+ send(Messages::RemoteRenderingBackend::CreateImageBuffer(size, renderingMode, resolutionScale, colorSpace, imageBuffer->remoteResourceIdentifier()), m_renderingBackendIdentifier); >+ m_remoteResourceCacheProxy.cacheImageBuffer(imageBuffer->remoteResourceIdentifier(), imageBuffer.get()); > return imageBuffer; > } > >+ ASSERT_NOT_REACHED(); > return nullptr; > } > >+RefPtr<ImageData> RemoteRenderingBackendProxy::getImageData(AlphaPremultiplication outputFormat, const IntRect& srcRect, RemoteResourceIdentifier remoteResourceIdentifier) >+{ >+ IPC::ImageDataReference imageDataReference; >+ sendSync(Messages::RemoteRenderingBackend::GetImageData(outputFormat, srcRect, remoteResourceIdentifier), Messages::RemoteRenderingBackend::GetImageData::Reply(imageDataReference), m_renderingBackendIdentifier, 1_s); >+ return imageDataReference.buffer(); >+} >+ >+void RemoteRenderingBackendProxy::flushDisplayList(const DisplayList::DisplayList& displayList, RemoteResourceIdentifier remoteResourceIdentifier) >+{ >+ send(Messages::RemoteRenderingBackend::FlushDisplayList(displayList, remoteResourceIdentifier), m_renderingBackendIdentifier); >+} >+ >+DisplayListFlushIdentifier RemoteRenderingBackendProxy::flushDisplayListAndCommit(const DisplayList::DisplayList& displayList, RemoteResourceIdentifier remoteResourceIdentifier) >+{ >+ DisplayListFlushIdentifier sentFlushIdentifier = DisplayListFlushIdentifier::generate(); >+ send(Messages::RemoteRenderingBackend::FlushDisplayListAndCommit(displayList, sentFlushIdentifier, remoteResourceIdentifier), m_renderingBackendIdentifier); >+ return sentFlushIdentifier; >+} >+ > void RemoteRenderingBackendProxy::releaseRemoteResource(RemoteResourceIdentifier remoteResourceIdentifier) > { >- // CreateImageBuffer message should have been received before this one. >- bool found = m_imageBufferMessageHandlerMap.remove(remoteResourceIdentifier); >- ASSERT_UNUSED(found, found); >+ send(Messages::RemoteRenderingBackend::ReleaseRemoteResource(remoteResourceIdentifier), m_renderingBackendIdentifier); > } > > void RemoteRenderingBackendProxy::imageBufferBackendWasCreated(const FloatSize& logicalSize, const IntSize& backendSize, float resolutionScale, ColorSpace colorSpace, ImageBufferBackendHandle handle, RemoteResourceIdentifier remoteResourceIdentifier) > { >- if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) >- imageBuffer->createBackend(logicalSize, backendSize, resolutionScale, colorSpace, WTFMove(handle)); >+ auto imageBuffer = m_remoteResourceCacheProxy.cachedImageBuffer(remoteResourceIdentifier); >+ if (!imageBuffer) >+ return; >+ >+ if (imageBuffer->isAccelerated()) >+ downcast<AcceleratedRemoteImageBufferProxy>(*imageBuffer).createBackend(logicalSize, backendSize, resolutionScale, colorSpace, WTFMove(handle)); >+ else >+ downcast<UnacceleratedRemoteImageBufferProxy>(*imageBuffer).createBackend(logicalSize, backendSize, resolutionScale, colorSpace, WTFMove(handle)); > } > > void RemoteRenderingBackendProxy::flushDisplayListWasCommitted(DisplayListFlushIdentifier flushIdentifier, RemoteResourceIdentifier remoteResourceIdentifier) > { >- if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) >- imageBuffer->commitFlushContext(flushIdentifier); >+ auto imageBuffer = m_remoteResourceCacheProxy.cachedImageBuffer(remoteResourceIdentifier); >+ if (!imageBuffer) >+ return; >+ >+ if (imageBuffer->isAccelerated()) >+ downcast<AcceleratedRemoteImageBufferProxy>(*imageBuffer).commitFlushDisplayList(flushIdentifier); >+ else >+ downcast<UnacceleratedRemoteImageBufferProxy>(*imageBuffer).commitFlushDisplayList(flushIdentifier); > } > > } // namespace WebKit >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h >index 9d290023d49721ead6cb98799d26f5a8d0ed4dbe..3fe51c5da95e37503d7dbdb45eb8697cd4263f72 100644 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h >@@ -31,16 +31,24 @@ > #include "ImageBufferBackendHandle.h" > #include "MessageReceiver.h" > #include "MessageSender.h" >-#include "RemoteImageBufferMessageHandlerProxy.h" >+#include "RemoteResourceCacheProxy.h" > #include "RenderingBackendIdentifier.h" >-#include <WebCore/ColorSpace.h> >-#include <WebCore/DisplayList.h> >-#include <WebCore/FloatSize.h> > #include <WebCore/RemoteResourceIdentifier.h> >-#include <WebCore/RenderingMode.h> >-#include <wtf/HashMap.h> > #include <wtf/WeakPtr.h> > >+namespace WebCore { >+namespace DisplayList { >+class DisplayList; >+class Item; >+} >+class FloatSize; >+class ImageData; >+enum class AlphaPremultiplication : uint8_t; >+enum class ColorSpace : uint8_t; >+enum class RenderingMode : uint8_t; >+enum class ShouldAccelerate : bool; >+} >+ > namespace WebKit { > > class RemoteRenderingBackendProxy >@@ -52,7 +60,7 @@ public: > > ~RemoteRenderingBackendProxy(); > >- RenderingBackendIdentifier renderingBackendIdentifier() const { return m_renderingBackendIdentifier; } >+ RemoteResourceCacheProxy& remoteResourceCacheProxy() { return m_remoteResourceCacheProxy; } > > // IPC::MessageSender. > IPC::Connection* messageSenderConnection() const override; >@@ -61,7 +69,11 @@ public: > // IPC::MessageReceiver > void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; > >+ // Messages to be sent. > std::unique_ptr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, WebCore::ShouldAccelerate, float resolutionScale, WebCore::ColorSpace); >+ RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect, WebCore::RemoteResourceIdentifier); >+ void flushDisplayList(const WebCore::DisplayList::DisplayList&, WebCore::RemoteResourceIdentifier); >+ DisplayListFlushIdentifier flushDisplayListAndCommit(const WebCore::DisplayList::DisplayList&, WebCore::RemoteResourceIdentifier); > void releaseRemoteResource(WebCore::RemoteResourceIdentifier); > > bool waitForImageBufferBackendWasCreated(); >@@ -74,8 +86,7 @@ private: > void imageBufferBackendWasCreated(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle, WebCore::RemoteResourceIdentifier); > void flushDisplayListWasCommitted(DisplayListFlushIdentifier, WebCore::RemoteResourceIdentifier); > >- using ImageBufferMessageHandlerMap = HashMap<WebCore::RemoteResourceIdentifier, RemoteImageBufferMessageHandlerProxy*>; >- ImageBufferMessageHandlerMap m_imageBufferMessageHandlerMap; >+ RemoteResourceCacheProxy m_remoteResourceCacheProxy { *this }; > RenderingBackendIdentifier m_renderingBackendIdentifier { RenderingBackendIdentifier::generate() }; > }; > >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..8ea684bbb3e6b5fd381d96917857a0ab3d43d50f >--- /dev/null >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp >@@ -0,0 +1,61 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "RemoteResourceCacheProxy.h" >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "RemoteRenderingBackendProxy.h" >+ >+namespace WebKit { >+using namespace WebCore; >+ >+RemoteResourceCacheProxy::RemoteResourceCacheProxy(RemoteRenderingBackendProxy& remoteRenderingBackendProxy) >+ : m_remoteRenderingBackendProxy(remoteRenderingBackendProxy) >+{ >+} >+ >+void RemoteResourceCacheProxy::cacheImageBuffer(RemoteResourceIdentifier identifier, WebCore::ImageBuffer* imageBuffer) >+{ >+ auto addResult = m_imageBuffers.add(identifier, imageBuffer); >+ ASSERT_UNUSED(addResult, addResult.isNewEntry); >+} >+ >+ImageBuffer* RemoteResourceCacheProxy::cachedImageBuffer(RemoteResourceIdentifier identifier) >+{ >+ return m_imageBuffers.get(identifier); >+} >+ >+void RemoteResourceCacheProxy::releaseImageBuffer(RemoteResourceIdentifier identifier) >+{ >+ bool found = m_imageBuffers.remove(identifier); >+ ASSERT_UNUSED(found, found); >+ m_remoteRenderingBackendProxy.releaseRemoteResource(identifier); >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6a0815c8525aac2fbb17c5277bea7e05a44b801f >--- /dev/null >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include <WebCore/RemoteResourceIdentifier.h> >+#include <wtf/HashMap.h> >+ >+namespace WebCore { >+class ImageBuffer; >+} >+ >+namespace WebKit { >+ >+class RemoteRenderingBackendProxy; >+ >+class RemoteResourceCacheProxy { >+public: >+ RemoteResourceCacheProxy(RemoteRenderingBackendProxy&); >+ >+ void cacheImageBuffer(WebCore::RemoteResourceIdentifier, WebCore::ImageBuffer*); >+ WebCore::ImageBuffer* cachedImageBuffer(WebCore::RemoteResourceIdentifier); >+ void releaseImageBuffer(WebCore::RemoteResourceIdentifier); >+ >+private: >+ using RemoteImageBufferProxyHashMap = HashMap<WebCore::RemoteResourceIdentifier, WebCore::ImageBuffer*>; >+ >+ RemoteImageBufferProxyHashMap m_imageBuffers; >+ RemoteRenderingBackendProxy& m_remoteRenderingBackendProxy; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS)
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 217558
:
411007
|
411025
|
411784
|
411787
|
411797
|
411815
|
411819
|
411829
|
412367
|
412380
|
412382