Changeset 280987 in webkit
- Timestamp:
- Aug 12, 2021, 3:24:55 PM (5 years ago)
- Location:
- branches/safari-612.1.27.0-branch/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
-
branches/safari-612.1.27.0-branch/Source/WebKit/ChangeLog
r280975 r280987 1 2021-08-12 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r280981. rdar://problem/81870941 4 5 [GPU Process] REGRESSION: WebContent often crashes when using iCloud photos 6 https://bugs.webkit.org/show_bug.cgi?id=228969 7 <rdar://81761078> 8 9 Reviewed by Simon Fraser. 10 11 Terminating the GPUProcess is very stressful situation which has to be 12 handled carefully. The side effect of each function which is called through 13 gpuProcessConnectionDidClose() has to be understood to get the right 14 sequence of calls. There are problems in releasing all kinds of resources. 15 16 - Releasing NativeImage: Calling clearNativeImageMap() after clearing the 17 backend of the ImageBuffers was causing a problem. When clearing the 18 backend of an ImageBuffer, it will clear its DisplayList which may have 19 the last reference to a NativeImage. The destructor of NativeImage calls 20 releaseRemoteResource() before it is removed from the the NativeImageMap. 21 This will send a message to the relaunched GPUP to release a NativeImage 22 which is not in its cache. 23 24 - Releasing Font: clearFontMap() was always calling releaseRemoteResource() 25 even if it is called form remoteResourceCacheWasDestroyed(). This should 26 not happen because the connection with GPUProcess has been closed. 27 28 - Releasing ImageBuffer: This happen when a DisplayList of an ImageBuffer 29 'A' holds the last reference to another ImageBuffer 'B' and we call 30 clearBackend() for 'A'. clearBackend() will clear the DisplayList of 'A' 31 and causes the deletion of 'B'. In this case we should not call 32 releaseImageBuffer() for 'B' because the GPUPProcess is closed. 33 34 * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 35 (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): 36 If the ImageBuffer is being released because of the clean-up we do when 37 the GPUProcess is terminated, we should not release the corresponding 38 RemoteImageBuffer since it is already gone. 39 40 * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 41 (WebKit::RemoteRenderingBackendProxy::isGPUProcessConnectionClosed const): 42 This will return true if we are deleting a RemoteImageBufferProxy through 43 RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed(). 44 45 * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: 46 (WebKit::RemoteResourceCacheProxy::releaseAllRemoteFonts): 47 This function will be used to release the remote fonts. It should be called 48 from RemoteResourceCacheProxy::releaseMemory() where we sure the GPUP is 49 alive and all the fonts are cached there. 50 51 (WebKit::RemoteResourceCacheProxy::clearFontMap): 52 The part of releasing the remote fonts was moved from this function to 53 releaseAllRemoteFonts(). 54 55 (WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed): 56 1. Clearing the NativeImages and the Fonts has to come before clearing 57 the backends of the ImageBuffers. The reason is clearBackend() clears the 58 DisplayList which may release the last reference of a NativeImage or Font. 59 We want to detach the NativeImages and the Fonts from the cache before then. 60 2. We should have two different loops: one for clearing the backends of 61 the ImageBuffers and another one for recreating these backends. The reason 62 for this is clearBackend() clears the DisplayList which may release the 63 last reference of a another source RemoteImageBufferProxy used by a 64 DrawImageBuffer item for example. 65 66 (WebKit::RemoteResourceCacheProxy::releaseMemory): 67 * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 68 69 70 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280981 268f45cc-cd09-0410-ab3c-d52691b4dbfc 71 72 2021-08-12 Said Abou-Hallawa <said@apple.com> 73 74 [GPU Process] REGRESSION: WebContent often crashes when using iCloud photos 75 https://bugs.webkit.org/show_bug.cgi?id=228969 76 <rdar://81761078> 77 78 Reviewed by Simon Fraser. 79 80 Terminating the GPUProcess is very stressful situation which has to be 81 handled carefully. The side effect of each function which is called through 82 gpuProcessConnectionDidClose() has to be understood to get the right 83 sequence of calls. There are problems in releasing all kinds of resources. 84 85 - Releasing NativeImage: Calling clearNativeImageMap() after clearing the 86 backend of the ImageBuffers was causing a problem. When clearing the 87 backend of an ImageBuffer, it will clear its DisplayList which may have 88 the last reference to a NativeImage. The destructor of NativeImage calls 89 releaseRemoteResource() before it is removed from the the NativeImageMap. 90 This will send a message to the relaunched GPUP to release a NativeImage 91 which is not in its cache. 92 93 - Releasing Font: clearFontMap() was always calling releaseRemoteResource() 94 even if it is called form remoteResourceCacheWasDestroyed(). This should 95 not happen because the connection with GPUProcess has been closed. 96 97 - Releasing ImageBuffer: This happen when a DisplayList of an ImageBuffer 98 'A' holds the last reference to another ImageBuffer 'B' and we call 99 clearBackend() for 'A'. clearBackend() will clear the DisplayList of 'A' 100 and causes the deletion of 'B'. In this case we should not call 101 releaseImageBuffer() for 'B' because the GPUPProcess is closed. 102 103 * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 104 (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): 105 If the ImageBuffer is being released because of the clean-up we do when 106 the GPUProcess is terminated, we should not release the corresponding 107 RemoteImageBuffer since it is already gone. 108 109 * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 110 (WebKit::RemoteRenderingBackendProxy::isGPUProcessConnectionClosed const): 111 This will return true if we are deleting a RemoteImageBufferProxy through 112 RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed(). 113 114 * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: 115 (WebKit::RemoteResourceCacheProxy::releaseAllRemoteFonts): 116 This function will be used to release the remote fonts. It should be called 117 from RemoteResourceCacheProxy::releaseMemory() where we sure the GPUP is 118 alive and all the fonts are cached there. 119 120 (WebKit::RemoteResourceCacheProxy::clearFontMap): 121 The part of releasing the remote fonts was moved from this function to 122 releaseAllRemoteFonts(). 123 124 (WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed): 125 1. Clearing the NativeImages and the Fonts has to come before clearing 126 the backends of the ImageBuffers. The reason is clearBackend() clears the 127 DisplayList which may release the last reference of a NativeImage or Font. 128 We want to detach the NativeImages and the Fonts from the cache before then. 129 2. We should have two different loops: one for clearing the backends of 130 the ImageBuffers and another one for recreating these backends. The reason 131 for this is clearBackend() clears the DisplayList which may release the 132 last reference of a another source RemoteImageBufferProxy used by a 133 DrawImageBuffer item for example. 134 135 (WebKit::RemoteResourceCacheProxy::releaseMemory): 136 * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 137 1 138 2021-08-12 Alan Coon <alancoon@apple.com> 2 139 -
branches/safari-612.1.27.0-branch/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h
r280696 r280987 66 66 ~RemoteImageBufferProxy() 67 67 { 68 if (!m_remoteRenderingBackendProxy ) {68 if (!m_remoteRenderingBackendProxy || m_remoteRenderingBackendProxy->isGPUProcessConnectionClosed()) { 69 69 clearDisplayList(); 70 70 return; -
branches/safari-612.1.27.0-branch/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h
r280337 r280987 123 123 RenderingBackendIdentifier ensureBackendCreated(); 124 124 125 bool isGPUProcessConnectionClosed() const { return !m_gpuProcessConnection; } 126 125 127 private: 126 128 explicit RemoteRenderingBackendProxy(WebPage&); -
branches/safari-612.1.27.0-branch/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp
r280694 r280987 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(); -
branches/safari-612.1.27.0-branch/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h
r280694 r280987 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.