The display list items and the resource caching messages are both communicated from the WebProcess and the GPUProcess through the stream connection. The resources will be sent to the GPUProcess, consumed by the display items and then released in the right order. So there is no need anymore for the resource use counters. They were added in bug 228216 to synchronize properly the use and the release of the resources.
Created attachment 450010 [details] Patch
The reason for filing this bug is I found the following crash when running the layout tests with "--use-gpu-process". So instead of trying to investigate this crash, I think it is better to remove this unnecessary code. No crash log found for GPUProcess:51290. stdout: stderr: ASSERTION FAILED: iterator != m_resourceUseCounters.end() /Volumes/Data/WebKit/OpenSource/Source/WebKit/GPUProcess/graphics/RemoteResourceCache.cpp(165) : void WebKit::RemoteResourceCache::recordResourceUse(WebKit::QualifiedRenderingResourceIdentifier) 1 0x13b13ef59 WTFCrash 2 0x1277b8d1b WTFCrashWithInfo(int, char const*, char const*, int) 3 0x1284fa36e WebKit::RemoteResourceCache::recordResourceUse(WebCore::ProcessQualified<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType> >) 4 0x1284fbb86 WebKit::RemoteDisplayListRecorder::drawImageBufferWithQualifiedIdentifier(WebCore::ProcessQualified<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType> >, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&) 5 0x1284fba3a WebKit::RemoteDisplayListRecorder::drawImageBuffer(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&) 6 0x128273d75 void IPC::callMemberFunctionImpl<WebKit::RemoteDisplayListRecorder, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&), std::__1::tuple<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect, WebCore::FloatRect, WebCore::ImagePaintingOptions>, 0ul, 1ul, 2ul, 3ul>(WebKit::RemoteDisplayListRecorder*, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&), std::__1::tuple<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect, WebCore::FloatRect, WebCore::ImagePaintingOptions>&&, std::__1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul>) 7 0x12827188d void IPC::callMemberFunction<WebKit::RemoteDisplayListRecorder, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&), std::__1::tuple<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect, WebCore::FloatRect, WebCore::ImagePaintingOptions>, std::__1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul> >(std::__1::tuple<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect, WebCore::FloatRect, WebCore::ImagePaintingOptions>&&, WebKit::RemoteDisplayListRecorder*, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)) 8 0x12823549a void IPC::handleMessage<Messages::RemoteDisplayListRecorder::DrawImageBuffer, WebKit::RemoteDisplayListRecorder, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)>(IPC::Connection&, IPC::Decoder&, WebKit::RemoteDisplayListRecorder*, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)) 9 0x1282328cf WebKit::RemoteDisplayListRecorder::didReceiveStreamMessage(IPC::StreamServerConnectionBase&, IPC::Decoder&) 10 0x128ca73bb IPC::StreamServerConnection::dispatchStreamMessage(IPC::Decoder&&, IPC::StreamMessageReceiver&) 11 0x128ca6d60 IPC::StreamServerConnection::dispatchStreamMessages(unsigned long) 12 0x128ca56b8 IPC::StreamConnectionWorkQueue::processStreams() 13 0x128cad8b0 IPC::StreamConnectionWorkQueue::startProcessingThread()::$_0::operator()() 14 0x128cad869 WTF::Detail::CallableWrapper<IPC::StreamConnectionWorkQueue::startProcessingThread()::$_0, void>::call() 15 0x13b169942 WTF::Function<void ()>::operator()() const 16 0x13b231f18 WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) 17 0x13b23e375 WTF::wtfThreadEntryPoint(void*) 18 0x10c1d84bc _pthread_start 19 0x10c1d3ebf thread_start
(In reply to Said Abou-Hallawa from comment #2) > The reason for filing this bug is I found the following crash when running > the layout tests with "--use-gpu-process". So instead of trying to > investigate this crash, I think it is better to remove this unnecessary code. +1!
The above crash seems to happen because the m_resourceHeap of RemoteResourceCache got out of sync from its m_resourceUseCounters. When RemoteDisplayListRecorder::drawImageBufferWithQualifiedIdentifier() calls resourceCache().cachedImageBuffer() with the given imageBufferIdentifier, it finds an ImageBuffer in its m_resourceHeap but when it calls resourceCache().recordResourceUse() with the same imageBufferIdentifier, it does not find a counter in its m_resourceUseCounters.
I meant to say the "assertion" not the "crash".
rdar://86150540
Committed r288847 (246608@main): <https://commits.webkit.org/246608@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 450010 [details].