[webkit-reviews] review granted: [Bug 231482] [WebXR] Replace the session reference in WebXRSpace subclasses with weak pointers : [Attachment 440718] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Oct 9 17:39:18 PDT 2021

Sam Weinig <sam at webkit.org> has granted Dean Jackson <dino at apple.com>'s request
for review:
Bug 231482: [WebXR] Replace the session reference in WebXRSpace subclasses with
weak pointers

Attachment 440718: Patch


--- Comment #3 from Sam Weinig <sam at webkit.org> ---
Comment on attachment 440718
  --> https://bugs.webkit.org/attachment.cgi?id=440718

View in context: https://bugs.webkit.org/attachment.cgi?id=440718&action=review

> Source/WebCore/ChangeLog:12
> +	   WebXRSpace had a pure virtual session() accessor that returned
> +	   a reference to a WebXRSession. This made subclasses hold strong
> +	   references to the WebXRSession, and would become problematic
> +	   for a WebXRSpace subclass that was (indirectly) owned by the
> +	   WebXRSession (found in the Hand Input module).

Pretty sure this was already causing leaks elsewhere for other XRSpaces, like
the targetRaySpace and gripSpace in WebXRInputSource.

> Source/WebCore/Modules/webxr/WebXRReferenceSpace.cpp:72
> +    if (!m_session)
> +	   return identity;

This feels a bit weird to me. It at least needs a comment explaining itself,
but I would assume this would propagate an Exception to the caller.

> Source/WebCore/Modules/webxr/WebXRReferenceSpace.cpp:120
> +    if (!m_session)
> +	   return { };

Same as above.

> Source/WebCore/Modules/webxr/WebXRSpace.cpp:61
> +    WebXRSession* xrSession = session();
> +    if (!xrSession)
> +	   return false;

Seems like this should be an exception rather than just returning false.

More information about the webkit-reviews mailing list