Bug 187337 - [WebVR] Fix VRDisplayEvent implementation
Summary: [WebVR] Fix VRDisplayEvent implementation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sergio Villar Senin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-07-05 01:39 PDT by Sergio Villar Senin
Modified: 2018-07-05 04:43 PDT (History)
5 users (show)

See Also:


Attachments
Patch (3.78 KB, patch)
2018-07-05 01:42 PDT, Sergio Villar Senin
no flags Details | Formatted Diff | Diff
Patch for landing (3.78 KB, patch)
2018-07-05 03:32 PDT, Sergio Villar Senin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergio Villar Senin 2018-07-05 01:39:19 PDT
[WebVR] Fix VRDisplayEvent implementation
Comment 1 Sergio Villar Senin 2018-07-05 01:42:11 PDT
Created attachment 344313 [details]
Patch
Comment 2 Zan Dobersek 2018-07-05 02:56:14 PDT
Comment on attachment 344313 [details]
Patch

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

> Source/WebCore/Modules/webvr/VRDisplayEvent.h:36
> +    static Ref<VRDisplayEvent> create(const AtomicString& type, const RefPtr<VRDisplay>& display, const std::optional<VRDisplayEventReason>& reason)

Can display and reason arguments be rvalue references, enabling moving them down to the constructor and there into the member variables?

> Source/WebCore/Modules/webvr/VRDisplayEvent.h:54
> +    std::optional<VRDisplayEventReason> reason() const { return m_reason; }

Can this return a const reference to the std::optional<>? It would then be up to the caller to copy it if necessary.
Comment 3 Sergio Villar Senin 2018-07-05 02:58:34 PDT
(In reply to Zan Dobersek from comment #2)
> Comment on attachment 344313 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=344313&action=review
> 
> > Source/WebCore/Modules/webvr/VRDisplayEvent.h:36
> > +    static Ref<VRDisplayEvent> create(const AtomicString& type, const RefPtr<VRDisplay>& display, const std::optional<VRDisplayEventReason>& reason)
> 
> Can display and reason arguments be rvalue references, enabling moving them
> down to the constructor and there into the member variables?

The reason can, but the VRDisplay cannot as they belong to somewhere else

> > Source/WebCore/Modules/webvr/VRDisplayEvent.h:54
> > +    std::optional<VRDisplayEventReason> reason() const { return m_reason; }
> 
> Can this return a const reference to the std::optional<>? It would then be
> up to the caller to copy it if necessary.

OK
Comment 4 Sergio Villar Senin 2018-07-05 03:32:23 PDT
Created attachment 344316 [details]
Patch for landing
Comment 5 Sergio Villar Senin 2018-07-05 03:40:46 PDT
(In reply to Zan Dobersek from comment #2)
> Comment on attachment 344313 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=344313&action=review
> 
> > Source/WebCore/Modules/webvr/VRDisplayEvent.h:36
> > +    static Ref<VRDisplayEvent> create(const AtomicString& type, const RefPtr<VRDisplay>& display, const std::optional<VRDisplayEventReason>& reason)
> 
> Can display and reason arguments be rvalue references, enabling moving them
> down to the constructor and there into the member variables?
> 
> > Source/WebCore/Modules/webvr/VRDisplayEvent.h:54
> > +    std::optional<VRDisplayEventReason> reason() const { return m_reason; }
> 
> Can this return a const reference to the std::optional<>? It would then be
> up to the caller to copy it if necessary.

I forgot to add this last change, I'll add it to a follow-up patch
Comment 6 Sergio Villar Senin 2018-07-05 04:42:07 PDT
Committed r233515: <https://trac.webkit.org/changeset/233515>
Comment 7 Radar WebKit Bug Importer 2018-07-05 04:43:20 PDT
<rdar://problem/41843918>