[webkit-changes] [WebKit/WebKit] 69417c: [WebXR] Break reference cycle between WebXRSession...
Dan Glastonbury
noreply at github.com
Fri Jun 28 18:08:42 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 69417c74f50df92ca17087e97ef3780abcfc378f
https://github.com/WebKit/WebKit/commit/69417c74f50df92ca17087e97ef3780abcfc378f
Author: Dan Glastonbury <djg at apple.com>
Date: 2024-06-28 (Fri, 28 Jun 2024)
Changed paths:
M Source/WebCore/Modules/webxr/WebXRSession.cpp
M Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp
M Source/WebCore/Modules/webxr/WebXRWebGLLayer.h
Log Message:
-----------
[WebXR] Break reference cycle between WebXRSession and WebXRWebGLLayer
https://bugs.webkit.org/show_bug.cgi?id=276008
rdar://130776295
Reviewed by Mike Wyrzykowski.
There is a strong refptr loop between WebXRSession and WebXRWebGLLayer (via
WebXRRenderState), that causes the this 3 objects to never be freed when exiting
a VR immersive session. Since graphics resources related to
WebXROpaqueFramebuffer were being released into it's destructor, this was
resulting in accumulation of thousands of leaked textures in GPU process,
causing out of OOM.
This patch makes use of the sessionEnded() method to free use graphics resources
associated with WebXRWebGLayer an break the cycle between WebXRSession &
WebXRWebGLLayer, allowing the JS garbage collector to eventually free those
objects.
WebXRWebGLLayer::m_session has been changed from a Ref<> to RefPtr<>. The null
case is used to signal that the layer's session has ended and is no longer
viable.
* Source/WebCore/Modules/webxr/WebXRSession.cpp:
(WebCore::WebXRSession::updateRenderState):
* Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp:
(WebCore::WebXRWebGLLayer::~WebXRWebGLLayer):
(WebCore::WebXRWebGLLayer::getViewport):
(WebCore::WebXRWebGLLayer::sessionEnded):
(WebCore::WebXRWebGLLayer::computeViewports):
* Source/WebCore/Modules/webxr/WebXRWebGLLayer.h:
(WebCore::WebXRWebGLLayer::session):
Canonical link: https://commits.webkit.org/280486@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list