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-227376-20210707151903.patch (text/plain), 5.37 KB, created by
Myles C. Maxfield
on 2021-07-07 15:19:04 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2021-07-07 15:19:04 PDT
Size:
5.37 KB
patch
obsolete
>Subversion Revision: 279678 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 7f42b4f5c4053b5dca4f268358232e3f8b7ca3d5..b75483a6fd5e68fa5e88edeb6ab3d5f5190892da 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,27 @@ >+2021-07-07 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [GPU Process] Canvas drawing never releases any fonts >+ https://bugs.webkit.org/show_bug.cgi?id=227376 >+ <rdar://problem/79741186> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We have a frame counter which makes sure that fonts which haven't been used in n frames get released. >+ However, we currently only update the frame counter when we release fonts. >+ This means that the frame counter stays 0 forever. And we never release any fonts. >+ >+ The fix is just to increment the frame counter even if we don't release any fonts. >+ >+ No new tests because there is no architectural behavior change. >+ >+ * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: >+ (WebKit::RemoteResourceCacheProxy::prepareForNextRenderingUpdate): >+ (WebKit::RemoteResourceCacheProxy::clearFontMap): >+ (WebKit::RemoteResourceCacheProxy::didFinalizeRenderingUpdate): >+ (WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed): >+ (WebKit::RemoteResourceCacheProxy::releaseMemory): >+ * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: >+ > 2021-07-07 Chris Dumez <cdumez@apple.com> > > [ITP] Potential assertion hit in ResourceLoadStatisticsDatabaseStore::clearUserInteraction() >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp >index 8487ba6e9a869bfce72981d8aa9eb69e41d6b7d8..56d886f0315ad9da126f81062c3703467f0c57b3 100644 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp >@@ -125,7 +125,21 @@ void RemoteResourceCacheProxy::releaseNativeImage(RenderingResourceIdentifier re > m_remoteRenderingBackendProxy.releaseRemoteResource(renderingResourceIdentifier); > } > >-void RemoteResourceCacheProxy::didFinalizeRenderingUpdate() >+void RemoteResourceCacheProxy::prepareForNextRenderingUpdate() >+{ >+ ++m_currentRenderingUpdateVersion; >+ m_numberOfFontsUsedInCurrentRenderingUpdate = 0; >+} >+ >+void RemoteResourceCacheProxy::clearFontMap() >+{ >+ for (auto& item : m_fontIdentifierToLastRenderingUpdateVersionMap) >+ m_remoteRenderingBackendProxy.releaseRemoteResource(item.key); >+ m_fontIdentifierToLastRenderingUpdateVersionMap.clear(); >+ m_numberOfFontsUsedInCurrentRenderingUpdate = 0; >+} >+ >+void RemoteResourceCacheProxy::finalizeRenderingUpdateForFonts() > { > static constexpr unsigned minimumRenderingUpdateCountToKeepFontAlive = 4; > static constexpr double minimumFractionOfUnusedFontCountToTriggerRemoval = 0.25; >@@ -137,13 +151,23 @@ void RemoteResourceCacheProxy::didFinalizeRenderingUpdate() > if (unusedFontCount < minimumFractionOfUnusedFontCountToTriggerRemoval * totalFontCount && unusedFontCount <= maximumUnusedFontCountToSkipRemoval) > return; > >+ HashSet<WebCore::RenderingResourceIdentifier> toRemove; > for (auto& item : m_fontIdentifierToLastRenderingUpdateVersionMap) { >- if (m_currentRenderingUpdateVersion - item.value >= minimumRenderingUpdateCountToKeepFontAlive) >+ if (m_currentRenderingUpdateVersion - item.value >= minimumRenderingUpdateCountToKeepFontAlive) { >+ toRemove.add(item.key); > m_remoteRenderingBackendProxy.releaseRemoteResource(item.key); >+ } > } > >- ++m_currentRenderingUpdateVersion; >- m_numberOfFontsUsedInCurrentRenderingUpdate = 0; >+ m_fontIdentifierToLastRenderingUpdateVersionMap.removeIf([&](const auto& bucket) { >+ return toRemove.contains(bucket.key); >+ }); >+} >+ >+void RemoteResourceCacheProxy::didFinalizeRenderingUpdate() >+{ >+ finalizeRenderingUpdateForFonts(); >+ prepareForNextRenderingUpdate(); > } > > void RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed() >@@ -155,14 +179,12 @@ void RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed() > imageBuffer->clearBackend(); > } > m_nativeImages.clear(); >- m_fontIdentifierToLastRenderingUpdateVersionMap.clear(); >- m_numberOfFontsUsedInCurrentRenderingUpdate = 0; >+ clearFontMap(); > } > > void RemoteResourceCacheProxy::releaseMemory() > { >- m_fontIdentifierToLastRenderingUpdateVersionMap.clear(); >- m_numberOfFontsUsedInCurrentRenderingUpdate = 0; >+ clearFontMap(); > m_remoteRenderingBackendProxy.deleteAllFonts(); > } > >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h >index f6b5fb7818176eb6915c5769bd93acf78b24be9f..6d731c4cc5ef6ef32c28029a5b032413a15a5890 100644 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h >@@ -62,6 +62,9 @@ private: > using NativeImageHashMap = HashMap<WebCore::RenderingResourceIdentifier, WeakPtr<WebCore::NativeImage>>; > > void releaseNativeImage(WebCore::RenderingResourceIdentifier) override; >+ void finalizeRenderingUpdateForFonts(); >+ void prepareForNextRenderingUpdate(); >+ void clearFontMap(); > > ImageBufferHashMap m_imageBuffers; > NativeImageHashMap m_nativeImages;
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 227376
:
432314
|
433007
|
433083
|
433236