RESOLVED FIXED 183162
[WebVR] Convert VRPlatformDisplayInfo into a class
https://bugs.webkit.org/show_bug.cgi?id=183162
Summary [WebVR] Convert VRPlatformDisplayInfo into a class
Sergio Villar Senin
Reported 2018-02-27 05:37:55 PST
[WebVR] Convert VRPlatformDisplayInfo into a class
Attachments
Patch (17.96 KB, patch)
2018-02-27 05:44 PST, Sergio Villar Senin
no flags
Patch (17.97 KB, patch)
2018-02-27 05:47 PST, Sergio Villar Senin
zan: review+
Patch (18.01 KB, patch)
2018-02-27 08:51 PST, Sergio Villar Senin
no flags
Sergio Villar Senin
Comment 1 2018-02-27 05:44:31 PST
Sergio Villar Senin
Comment 2 2018-02-27 05:47:10 PST
Zan Dobersek
Comment 3 2018-02-27 07:01:21 PST
Comment on attachment 334687 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=334687&action=review > Source/WebCore/platform/vr/VRPlatformDisplay.h:49 > + String displayName() const { return m_displayName; } [1]: Should return a const reference. > Source/WebCore/platform/vr/VRPlatformDisplay.h:50 > + void setDisplayName(String&& displayName) { m_displayName = WTFMove(displayName); } For later reference, this works as intended. > Source/WebCore/platform/vr/VRPlatformDisplay.h:65 > + FloatPoint3D eyeTranslation(Eye eye) const { return m_eyeTranslation[eye]; } Ditto [1]. > Source/WebCore/platform/vr/VRPlatformDisplay.h:66 > + void setEyeTranslation(Eye eye, FloatPoint3D&& translation) { m_eyeTranslation[eye] = translation; } [2]: Rvalue references are only useful in these cases for classes that support move semantics, i.e. have a move constructor and/or move assignment operator. This works with String, but is not the case for FloatPoint3D, so I'd recommend using a simple const reference to the FloatPoint3D object as the parameter. > Source/WebCore/platform/vr/VRPlatformDisplay.h:74 > + FieldOfView eyeFieldOfView(Eye eye) const { return m_eyeFieldOfView[eye]; } Ditto [1]. > Source/WebCore/platform/vr/VRPlatformDisplay.h:75 > + void setEyeFieldOfView(Eye eye, FieldOfView&& fieldOfView) { m_eyeFieldOfView[eye] = WTFMove(fieldOfView); } Ditto [2] for FieldOfView. WTFMove() doesn't help. > Source/WebCore/platform/vr/VRPlatformDisplay.h:81 > + RenderSize renderSize() const { return m_renderSize; } Ditto [1]. > Source/WebCore/platform/vr/VRPlatformDisplay.h:82 > + void setRenderSize(RenderSize&& renderSize) { m_renderSize = WTFMove(renderSize); } Ditto [2] for RenderSize. WTFMove() doesn't help. > Source/WebCore/platform/vr/VRPlatformDisplay.h:84 > + void setPlayAreaBounds(FloatSize&& playAreaBounds) { m_playAreaBounds = playAreaBounds; } Ditto [2] for FloatSize. > Source/WebCore/platform/vr/VRPlatformDisplay.h:85 > + std::optional<FloatSize> playAreaBounds() const { return m_playAreaBounds; } Ditto [1]. > Source/WebCore/platform/vr/VRPlatformDisplay.h:87 > + void setSittingToStandingTransform(TransformationMatrix&& transform) { m_sittingToStandingTransform = transform; } Ditto [2] for TransformationMatrix. > Source/WebCore/platform/vr/VRPlatformDisplay.h:88 > + std::optional<TransformationMatrix> sittingToStandingTransform() const { return m_sittingToStandingTransform; } Ditto [1].
Sergio Villar Senin
Comment 4 2018-02-27 07:48:28 PST
(In reply to Zan Dobersek from comment #3) > Comment on attachment 334687 [details] > > Source/WebCore/platform/vr/VRPlatformDisplay.h:66 > > + void setEyeTranslation(Eye eye, FloatPoint3D&& translation) { m_eyeTranslation[eye] = translation; } > > [2]: Rvalue references are only useful in these cases for classes that > support move semantics, i.e. have a move constructor and/or move assignment > operator. This works with String, but is not the case for FloatPoint3D, so > I'd recommend using a simple const reference to the FloatPoint3D object as > the parameter. For some reason I don't know I thought they all had them (the move constructor). Yeah I'll replace them all with const references.
Sergio Villar Senin
Comment 5 2018-02-27 08:51:45 PST
Created attachment 334691 [details] Patch Patch for landing
Sergio Villar Senin
Comment 6 2018-02-28 00:45:35 PST
Radar WebKit Bug Importer
Comment 7 2018-02-28 00:46:45 PST
Note You need to log in before you can comment on or make changes to this bug.