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-228495-20210727160829.patch (text/plain), 18.18 KB, created by
Myles C. Maxfield
on 2021-07-27 16:08:30 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2021-07-27 16:08:30 PDT
Size:
18.18 KB
patch
obsolete
>Subversion Revision: 280356 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9ac6b30e01ea65c09462a2b66d124f2a96a0f107..793c29b4ca12a62cbfd19bdcdd62d8176d88dd19 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,33 @@ >+2021-07-27 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [GPU Process] Code cleanup after r280356 >+ https://bugs.webkit.org/show_bug.cgi?id=228495 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 3 things: >+ 1. Rename cacheNativeImage()/cacheFont() to recordNativeImageUse()/recordFontUse() since it does more >+ than caching now >+ 2. Mark overridden functions as final in RemoteImageBufferProxy because no class inherits from it >+ 3. Remove unnecessary WebCore:: where it isn't necessary >+ >+ No new tests because there is no behavior change. >+ >+ * platform/graphics/displaylists/DisplayListRecorder.cpp: >+ (WebCore::DisplayList::Recorder::putPixelBuffer): >+ (WebCore::DisplayList::Recorder::recordNativeImageUse): >+ (WebCore::DisplayList::Recorder::appendStateChangeItem): >+ (WebCore::DisplayList::Recorder::appendDrawGlyphsItemWithCachedFont): >+ (WebCore::DisplayList::Recorder::drawImageBuffer): >+ (WebCore::DisplayList::Recorder::drawNativeImage): >+ (WebCore::DisplayList::Recorder::drawPattern): >+ (WebCore::DisplayList::Recorder::cacheNativeImage): Deleted. >+ * platform/graphics/displaylists/DisplayListRecorder.h: >+ (WebCore::DisplayList::Recorder::Delegate::recordNativeImageUse): >+ (WebCore::DisplayList::Recorder::Delegate::recordFontUse): >+ (WebCore::DisplayList::Recorder::Delegate::cacheNativeImage): Deleted. >+ (WebCore::DisplayList::Recorder::Delegate::cacheFont): Deleted. >+ > 2021-07-27 Myles C. Maxfield <mmaxfield@apple.com> > > [GPU Process] Start tracking resource uses for NativeImages and Fonts >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index bc94468ab267cd07b0d0666ca0e975f5317b18ab..28cc9592075e9094a7b63cd56ac2c3cb694dbbd8 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,19 @@ >+2021-07-27 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [GPU Process] Code cleanup after r280356 >+ https://bugs.webkit.org/show_bug.cgi?id=228495 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: >+ (WebKit::RemoteImageBufferProxy::putPixelBuffer): >+ * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: >+ (WebKit::RemoteResourceCacheProxy::recordNativeImageUse): >+ (WebKit::RemoteResourceCacheProxy::recordFontUse): >+ (WebKit::RemoteResourceCacheProxy::cacheNativeImage): Deleted. >+ (WebKit::RemoteResourceCacheProxy::cacheFont): Deleted. >+ * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: >+ > 2021-07-27 Myles C. Maxfield <mmaxfield@apple.com> > > [GPU Process] Start tracking resource uses for NativeImages and Fonts >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >index b8a2db9ce0df1c992b5ec47ea0707c8fb5f858ba..fdd2186457d82773a734a2e57829c49394837d67 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >@@ -71,7 +71,7 @@ void Recorder::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRe > append<GetPixelBuffer>(outputFormat, sourceRect); > } > >-void Recorder::putPixelBuffer(const WebCore::PixelBuffer& pixelBuffer, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat) >+void Recorder::putPixelBuffer(const PixelBuffer& pixelBuffer, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) > { > append<PutPixelBuffer>(pixelBuffer, srcRect, destPoint, destFormat); > } >@@ -101,10 +101,10 @@ static bool containsOnlyInlineStateChanges(const GraphicsContextStateChange& cha > return true; > } > >-void Recorder::cacheNativeImage(NativeImage& image) >+void Recorder::recordNativeImageUse(NativeImage& image) > { > if (m_delegate) >- m_delegate->cacheNativeImage(image); >+ m_delegate->recordNativeImageUse(image); > m_displayList.cacheNativeImage(image); > } > >@@ -112,9 +112,9 @@ void Recorder::appendStateChangeItem(const GraphicsContextStateChange& changes, > { > if (!containsOnlyInlineStateChanges(changes, changeFlags)) { > if (auto pattern = changes.m_state.strokePattern) >- cacheNativeImage(pattern->tileImage()); >+ recordNativeImageUse(pattern->tileImage()); > if (auto pattern = changes.m_state.fillPattern) >- cacheNativeImage(pattern->tileImage()); >+ recordNativeImageUse(pattern->tileImage()); > append<SetState>(changes.m_state, changeFlags); > return; > } >@@ -193,12 +193,12 @@ void Recorder::drawGlyphs(const Font& font, const GlyphBufferGlyph* glyphs, cons > void Recorder::appendDrawGlyphsItemWithCachedFont(const Font& font, const GlyphBufferGlyph* glyphs, const GlyphBufferAdvance* advances, unsigned count, const FloatPoint& localAnchor, FontSmoothingMode smoothingMode) > { > if (m_delegate) >- m_delegate->cacheFont(const_cast<Font&>(font)); >+ m_delegate->recordFontUse(const_cast<Font&>(font)); > m_displayList.cacheFont(const_cast<Font&>(font)); > append<DrawGlyphs>(font, glyphs, advances, count, localAnchor, smoothingMode); > } > >-void Recorder::drawImageBuffer(WebCore::ImageBuffer& imageBuffer, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) >+void Recorder::drawImageBuffer(ImageBuffer& imageBuffer, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) > { > if (!canDrawImageBuffer(imageBuffer)) { > GraphicsContext::drawImageBuffer(imageBuffer, destRect, srcRect, options); >@@ -210,13 +210,13 @@ void Recorder::drawImageBuffer(WebCore::ImageBuffer& imageBuffer, const FloatRec > > void Recorder::drawNativeImage(NativeImage& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options) > { >- cacheNativeImage(image); >+ recordNativeImageUse(image); > append<DrawNativeImage>(image.renderingResourceIdentifier(), imageSize, destRect, srcRect, options); > } > > void Recorder::drawPattern(NativeImage& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options) > { >- cacheNativeImage(image); >+ recordNativeImageUse(image); > append<DrawPattern>(image.renderingResourceIdentifier(), imageSize, destRect, tileRect, patternTransform, phase, spacing, options); > } > >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >index 61bf79d4808da60cba95a430136005df6aa4f0c3..fe4e3f497738e4132d644c0201fff6be689a5595 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >@@ -67,9 +67,9 @@ public: > public: > virtual ~Delegate() { } > virtual bool canAppendItemOfType(ItemType) { return false; } >- virtual void cacheNativeImage(NativeImage&) { } >+ virtual void recordNativeImageUse(NativeImage&) { } > virtual bool isCachedImageBuffer(const ImageBuffer&) const { return false; } >- virtual void cacheFont(Font&) { } >+ virtual void recordFontUse(Font&) { } > virtual RenderingMode renderingMode() const { return RenderingMode::Unaccelerated; } > }; > >@@ -202,7 +202,7 @@ private: > template<typename T> > static constexpr bool itemNeedsState(); > >- void cacheNativeImage(NativeImage&); >+ void recordNativeImageUse(NativeImage&); > > void appendStateChangeItemIfNecessary(); > void appendStateChangeItem(const GraphicsContextStateChange&, GraphicsContextState::StateChangeFlags); >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h >index d4cbc2c0c9034305968f277b55361bb27482fea8..3320f25f8a63724913886f0e01841e9ce37da610 100644 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h >@@ -110,7 +110,7 @@ protected: > m_drawingContext.displayList().setTracksDrawingItemExtents(false); > } > >- WebCore::RenderingMode renderingMode() const override { return BaseDisplayListImageBuffer::renderingMode(); } >+ WebCore::RenderingMode renderingMode() const final { return BaseDisplayListImageBuffer::renderingMode(); } > > // It is safe to access m_receivedFlushIdentifier from the main thread without locking since it > // only gets modified on the main thread. >@@ -120,7 +120,7 @@ protected: > return m_sentFlushIdentifier != m_receivedFlushIdentifier; > } > >- void didFlush(WebCore::DisplayList::FlushIdentifier flushIdentifier) override >+ void didFlush(WebCore::DisplayList::FlushIdentifier flushIdentifier) final > { > ASSERT(isMainRunLoop()); > Locker locker { m_receivedFlushIdentifierLock }; >@@ -150,7 +150,7 @@ protected: > RELEASE_LOG_FAULT(SharedDisplayLists, "Exceeded timeout while waiting for flush in remote rendering backend: %" PRIu64 ".", m_remoteRenderingBackendProxy->renderingBackendIdentifier().toUInt64()); > } > >- WebCore::ImageBufferBackend* ensureBackendCreated() const override >+ WebCore::ImageBufferBackend* ensureBackendCreated() const final > { > if (!m_remoteRenderingBackendProxy) > return m_backend.get(); >@@ -164,7 +164,7 @@ protected: > return m_backend.get(); > } > >- String toDataURL(const String& mimeType, std::optional<double> quality, WebCore::PreserveResolution preserveResolution) const override >+ String toDataURL(const String& mimeType, std::optional<double> quality, WebCore::PreserveResolution preserveResolution) const final > { > if (UNLIKELY(!m_remoteRenderingBackendProxy)) > return { }; >@@ -173,7 +173,7 @@ protected: > return m_remoteRenderingBackendProxy->getDataURLForImageBuffer(mimeType, quality, preserveResolution, m_renderingResourceIdentifier); > } > >- Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality = std::nullopt) const override >+ Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality = std::nullopt) const final > { > if (UNLIKELY(!m_remoteRenderingBackendProxy)) > return { }; >@@ -182,7 +182,7 @@ protected: > return m_remoteRenderingBackendProxy->getDataForImageBuffer(mimeType, quality, m_renderingResourceIdentifier); > } > >- RefPtr<WebCore::NativeImage> copyNativeImage(WebCore::BackingStoreCopy = WebCore::BackingStoreCopy::CopyBackingStore) const override >+ RefPtr<WebCore::NativeImage> copyNativeImage(WebCore::BackingStoreCopy = WebCore::BackingStoreCopy::CopyBackingStore) const final > { > if (UNLIKELY(!m_remoteRenderingBackendProxy)) > return { }; >@@ -193,7 +193,7 @@ protected: > return WebCore::NativeImage::create(bitmap->createPlatformImage()); > } > >- RefPtr<WebCore::Image> copyImage(WebCore::BackingStoreCopy = WebCore::BackingStoreCopy::CopyBackingStore, WebCore::PreserveResolution preserveResolution = WebCore::PreserveResolution::No) const override >+ RefPtr<WebCore::Image> copyImage(WebCore::BackingStoreCopy = WebCore::BackingStoreCopy::CopyBackingStore, WebCore::PreserveResolution preserveResolution = WebCore::PreserveResolution::No) const final > { > if (UNLIKELY(!m_remoteRenderingBackendProxy)) > return { }; >@@ -204,7 +204,7 @@ protected: > return bitmap->createImage(); > } > >- std::optional<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& destinationFormat, const WebCore::IntRect& srcRect) const override >+ std::optional<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& destinationFormat, const WebCore::IntRect& srcRect) const final > { > if (UNLIKELY(!m_remoteRenderingBackendProxy)) > return std::nullopt; >@@ -230,7 +230,7 @@ protected: > return pixelBuffer; > } > >- void putPixelBuffer(const WebCore::PixelBuffer& pixelBuffer, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint = { }, WebCore::AlphaPremultiplication destFormat = WebCore::AlphaPremultiplication::Premultiplied) override >+ void putPixelBuffer(const WebCore::PixelBuffer& pixelBuffer, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint = { }, WebCore::AlphaPremultiplication destFormat = WebCore::AlphaPremultiplication::Premultiplied) final > { > // The math inside PixelBuffer::create() doesn't agree with the math inside ImageBufferBackend::putPixelBuffer() about how m_resolutionScale interacts with the data in the ImageBuffer. > // This means that putPixelBuffer() is only called when resolutionScale() == 1. >@@ -238,15 +238,15 @@ protected: > m_drawingContext.recorder().putPixelBuffer(pixelBuffer, srcRect, destPoint, destFormat); > } > >- bool prefersPreparationForDisplay() override { return true; } >+ bool prefersPreparationForDisplay() final { return true; } > >- void flushContext() override >+ void flushContext() final > { > flushDrawingContext(); > m_backend->flushContext(); > } > >- void flushDrawingContext() override >+ void flushDrawingContext() final > { > if (UNLIKELY(!m_remoteRenderingBackendProxy)) > return; >@@ -256,7 +256,7 @@ protected: > waitForDidFlushWithTimeout(); > } > >- void flushDrawingContextAsync() override >+ void flushDrawingContextAsync() final > { > if (UNLIKELY(!m_remoteRenderingBackendProxy)) > return; >@@ -270,13 +270,13 @@ protected: > clearDisplayList(); > } > >- void cacheNativeImage(WebCore::NativeImage& image) override >+ void recordNativeImageUse(WebCore::NativeImage& image) final > { > if (m_remoteRenderingBackendProxy) >- m_remoteRenderingBackendProxy->remoteResourceCacheProxy().cacheNativeImage(image); >+ m_remoteRenderingBackendProxy->remoteResourceCacheProxy().recordNativeImageUse(image); > } > >- bool isCachedImageBuffer(const WebCore::ImageBuffer& imageBuffer) const override >+ bool isCachedImageBuffer(const WebCore::ImageBuffer& imageBuffer) const final > { > if (!m_remoteRenderingBackendProxy) > return false; >@@ -303,7 +303,7 @@ protected: > m_drawingContext.displayList().clear(); > } > >- bool canAppendItemOfType(WebCore::DisplayList::ItemType) override >+ bool canAppendItemOfType(WebCore::DisplayList::ItemType) final > { > if (UNLIKELY(!m_remoteRenderingBackendProxy)) > return false; >@@ -311,16 +311,16 @@ protected: > return true; > } > >- void didAppendData(const WebCore::DisplayList::ItemBufferHandle& handle, size_t numberOfBytes, WebCore::DisplayList::DidChangeItemBuffer didChangeItemBuffer) override >+ void didAppendData(const WebCore::DisplayList::ItemBufferHandle& handle, size_t numberOfBytes, WebCore::DisplayList::DidChangeItemBuffer didChangeItemBuffer) final > { > if (LIKELY(m_remoteRenderingBackendProxy)) > m_remoteRenderingBackendProxy->didAppendData(handle, numberOfBytes, didChangeItemBuffer, m_renderingResourceIdentifier); > } > >- void cacheFont(WebCore::Font& font) override >+ void recordFontUse(WebCore::Font& font) final > { > if (m_remoteRenderingBackendProxy) >- m_remoteRenderingBackendProxy->remoteResourceCacheProxy().cacheFont(font); >+ m_remoteRenderingBackendProxy->remoteResourceCacheProxy().recordFontUse(font); > } > > WebCore::DisplayList::ItemBufferHandle createItemBuffer(size_t capacity) final >@@ -343,7 +343,7 @@ protected: > }, item); > } > >- std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher> createFlusher() override >+ std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher> createFlusher() final > { > return WTF::makeUnique<ThreadSafeRemoteImageBufferFlusher<BackendType>>(*this); > } >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp >index 0000bdfdb11e30cfff5155b04a398d5585ae4967..aae23691aadcb0f02d760659865ffb81e412e1fd 100644 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp >@@ -78,7 +78,7 @@ inline static RefPtr<ShareableBitmap> createShareableBitmapFromNativeImage(Nativ > return bitmap; > } > >-void RemoteResourceCacheProxy::cacheNativeImage(NativeImage& image) >+void RemoteResourceCacheProxy::recordNativeImageUse(NativeImage& image) > { > auto iterator = m_nativeImages.find(image.renderingResourceIdentifier()); > if (iterator != m_nativeImages.end()) { >@@ -105,7 +105,7 @@ void RemoteResourceCacheProxy::cacheNativeImage(NativeImage& image) > m_remoteRenderingBackendProxy.cacheNativeImage(handle, image.renderingResourceIdentifier()); > } > >-void RemoteResourceCacheProxy::cacheFont(Font& font) >+void RemoteResourceCacheProxy::recordFontUse(Font& font) > { > auto result = m_fonts.ensure(font.renderingResourceIdentifier(), [&] { > return FontState { m_remoteRenderingBackendProxy.renderingUpdateID(), 1 }; >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h >index 4a6e3a0f7b716415d2aa5a1e6eca5d9b5dfb108f..b627cc812d9198fc1b1234f394530e832581b40b 100644 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h >@@ -50,8 +50,8 @@ public: > WebCore::ImageBuffer* cachedImageBuffer(WebCore::RenderingResourceIdentifier); > void releaseImageBuffer(WebCore::RenderingResourceIdentifier); > >- void cacheNativeImage(WebCore::NativeImage&); >- void cacheFont(WebCore::Font&); >+ void recordNativeImageUse(WebCore::NativeImage&); >+ void recordFontUse(WebCore::Font&); > > void finalizeRenderingUpdate(); >
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
Flags:
wenson_hsieh
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 228495
: 434378