Changeset 280981 in webkit
- Timestamp:
- Aug 12, 2021, 1:28:00 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
WebProcess/GPU/graphics/RemoteImageBufferProxy.h (modified) (1 diff)
-
WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h (modified) (1 diff)
-
WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp (modified) (2 diffs)
-
WebProcess/GPU/graphics/RemoteResourceCacheProxy.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r280980 r280981 1 2021-08-12 Said Abou-Hallawa <said@apple.com> 2 3 [GPU Process] REGRESSION: WebContent often crashes when using iCloud photos 4 https://bugs.webkit.org/show_bug.cgi?id=228969 5 <rdar://81761078> 6 7 Reviewed by Simon Fraser. 8 9 Terminating the GPUProcess is very stressful situation which has to be 10 handled carefully. The side effect of each function which is called through 11 gpuProcessConnectionDidClose() has to be understood to get the right 12 sequence of calls. There are problems in releasing all kinds of resources. 13 14 - Releasing NativeImage: Calling clearNativeImageMap() after clearing the 15 backend of the ImageBuffers was causing a problem. When clearing the 16 backend of an ImageBuffer, it will clear its DisplayList which may have 17 the last reference to a NativeImage. The destructor of NativeImage calls 18 releaseRemoteResource() before it is removed from the the NativeImageMap. 19 This will send a message to the relaunched GPUP to release a NativeImage 20 which is not in its cache. 21 22 - Releasing Font: clearFontMap() was always calling releaseRemoteResource() 23 even if it is called form remoteResourceCacheWasDestroyed(). This should 24 not happen because the connection with GPUProcess has been closed. 25 26 - Releasing ImageBuffer: This happen when a DisplayList of an ImageBuffer 27 'A' holds the last reference to another ImageBuffer 'B' and we call 28 clearBackend() for 'A'. clearBackend() will clear the DisplayList of 'A' 29 and causes the deletion of 'B'. In this case we should not call 30 releaseImageBuffer() for 'B' because the GPUPProcess is closed. 31 32 * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 33 (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): 34 If the ImageBuffer is being released because of the clean-up we do when 35 the GPUProcess is terminated, we should not release the corresponding 36 RemoteImageBuffer since it is already gone. 37 38 * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 39 (WebKit::RemoteRenderingBackendProxy::isGPUProcessConnectionClosed const): 40 This will return true if we are deleting a RemoteImageBufferProxy through 41 RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed(). 42 43 * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: 44 (WebKit::RemoteResourceCacheProxy::releaseAllRemoteFonts): 45 This function will be used to release the remote fonts. It should be called 46 from RemoteResourceCacheProxy::releaseMemory() where we sure the GPUP is 47 alive and all the fonts are cached there. 48 49 (WebKit::RemoteResourceCacheProxy::clearFontMap): 50 The part of releasing the remote fonts was moved from this function to 51 releaseAllRemoteFonts(). 52 53 (WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed): 54 1. Clearing the NativeImages and the Fonts has to come before clearing 55 the backends of the ImageBuffers. The reason is clearBackend() clears the 56 DisplayList which may release the last reference of a NativeImage or Font. 57 We want to detach the NativeImages and the Fonts from the cache before then. 58 2. We should have two different loops: one for clearing the backends of 59 the ImageBuffers and another one for recreating these backends. The reason 60 for this is clearBackend() clears the DisplayList which may release the 61 last reference of a another source RemoteImageBufferProxy used by a 62 DrawImageBuffer item for example. 63 64 (WebKit::RemoteResourceCacheProxy::releaseMemory): 65 * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 66 1 67 2021-08-12 Sam Weinig <weinig@apple.com> 2 68 -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h
r280652 r280981 66 66 ~RemoteImageBufferProxy() 67 67 { 68 if (!m_remoteRenderingBackendProxy ) {68 if (!m_remoteRenderingBackendProxy || m_remoteRenderingBackendProxy->isGPUProcessConnectionClosed()) { 69 69 clearDisplayList(); 70 70 return; -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h
r280337 r280981 123 123 RenderingBackendIdentifier ensureBackendCreated(); 124 124 125 bool isGPUProcessConnectionClosed() const { return !m_gpuProcessConnection; } 126 125 127 private: 126 128 explicit RemoteRenderingBackendProxy(WebPage&); -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp
r280639 r280981 165 165 } 166 166 167 void RemoteResourceCacheProxy:: clearFontMap()167 void RemoteResourceCacheProxy::releaseAllRemoteFonts() 168 168 { 169 169 for (auto& fontState : m_fonts) 170 170 m_remoteRenderingBackendProxy.releaseRemoteResource(fontState.key, fontState.value.useCount); 171 } 172 173 void RemoteResourceCacheProxy::clearFontMap() 174 { 171 175 m_fonts.clear(); 172 176 m_numberOfFontsUsedInCurrentRenderingUpdate = 0; … … 204 208 void RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed() 205 209 { 210 clearNativeImageMap(); 211 clearFontMap(); 212 213 // Get a copy of m_imageBuffers.values() because clearBackend() 214 // may release some of the cached ImageBuffers. 215 for (auto& item : copyToVector(m_imageBuffers.values())) { 216 if (!item.imageBuffer) 217 continue; 218 item.useCount = 0; 219 item.imageBuffer->clearBackend(); 220 } 221 206 222 for (auto& item : m_imageBuffers.values()) { 207 223 if (!item.imageBuffer) 208 224 continue; 209 225 m_remoteRenderingBackendProxy.createRemoteImageBuffer(*item.imageBuffer); 210 item.useCount = 0; 211 item.imageBuffer->clearBackend(); 212 } 213 clearNativeImageMap(); 214 clearFontMap(); 226 } 215 227 } 216 228 217 229 void RemoteResourceCacheProxy::releaseMemory() 218 230 { 231 releaseAllRemoteFonts(); 219 232 clearFontMap(); 220 233 m_remoteRenderingBackendProxy.deleteAllFonts(); -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h
r280639 r280981 58 58 59 59 void remoteResourceCacheWasDestroyed(); 60 void releaseAllRemoteFonts(); 60 61 void releaseMemory(); 61 62
Note:
See TracChangeset
for help on using the changeset viewer.