Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Issue 2630003002: Ensure navigator.getVRDisplays always resolves. (Closed)

Created:
3 years, 11 months ago by bajones
Modified:
3 years, 11 months ago
Reviewers:
haraken
CC:
chromium-reviews, creis+watch_chromium.org, nasko+codewatch_chromium.org, jam, feature-vr-reviews_chromium.org, darin-cc_chromium.org, blink-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Ensure navigator.getVRDisplays always resolves. Second attempt at landing. See https://codereview.chromium.org/2614873002/ In the case that the backing VR service is not available the call will now resolve to an empty array. BUG=678283 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation TBR=rockot@chromium.org, alexmos@chromium.org Review-Url: https://codereview.chromium.org/2630003002 Cr-Commit-Position: refs/heads/master@{#443791} Committed: https://chromium.googlesource.com/chromium/src/+/a74a47aec12401d3ea3643aea1d8b66d908c32cc

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -11 lines) Patch
M content/browser/BUILD.gn View 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/frame_host/render_frame_host_impl.cc View 3 chunks +9 lines, -2 lines 0 comments Download
A third_party/WebKit/LayoutTests/vr/getVRDisplays_always_resolves.html View 1 chunk +15 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/vr/VRController.cpp View 3 chunks +11 lines, -9 lines 3 comments Download

Messages

Total messages: 16 (9 generated)
bajones
TBRed because this is practically identical to previous version of patch with one minor dependency ...
3 years, 11 months ago (2017-01-14 05:52:54 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2630003002/1
3 years, 11 months ago (2017-01-14 05:53:14 UTC) #8
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/chromium/src/+/a74a47aec12401d3ea3643aea1d8b66d908c32cc
3 years, 11 months ago (2017-01-14 05:58:08 UTC) #11
haraken
https://codereview.chromium.org/2630003002/diff/1/third_party/WebKit/Source/modules/vr/VRController.cpp File third_party/WebKit/Source/modules/vr/VRController.cpp (right): https://codereview.chromium.org/2630003002/diff/1/third_party/WebKit/Source/modules/vr/VRController.cpp#newcode110 third_party/WebKit/Source/modules/vr/VRController.cpp:110: onGetDisplays(); This doesn't really seem right to me. If ...
3 years, 11 months ago (2017-01-16 01:17:43 UTC) #13
haraken
On 2017/01/16 01:17:43, haraken wrote: > https://codereview.chromium.org/2630003002/diff/1/third_party/WebKit/Source/modules/vr/VRController.cpp > File third_party/WebKit/Source/modules/vr/VRController.cpp (right): > > https://codereview.chromium.org/2630003002/diff/1/third_party/WebKit/Source/modules/vr/VRController.cpp#newcode110 > ...
3 years, 11 months ago (2017-01-19 00:55:42 UTC) #14
bajones
https://codereview.chromium.org/2630003002/diff/1/third_party/WebKit/Source/modules/vr/VRController.cpp File third_party/WebKit/Source/modules/vr/VRController.cpp (right): https://codereview.chromium.org/2630003002/diff/1/third_party/WebKit/Source/modules/vr/VRController.cpp#newcode110 third_party/WebKit/Source/modules/vr/VRController.cpp:110: onGetDisplays(); On 2017/01/16 01:17:43, haraken wrote: > > This ...
3 years, 11 months ago (2017-01-19 19:49:00 UTC) #15
haraken
3 years, 11 months ago (2017-01-20 06:28:02 UTC) #16
Message was sent while issue was closed.
https://codereview.chromium.org/2630003002/diff/1/third_party/WebKit/Source/m...
File third_party/WebKit/Source/modules/vr/VRController.cpp (right):

https://codereview.chromium.org/2630003002/diff/1/third_party/WebKit/Source/m...
third_party/WebKit/Source/modules/vr/VRController.cpp:110: onGetDisplays();
On 2017/01/19 19:49:00, bajones wrote:
> On 2017/01/16 01:17:43, haraken wrote:
> > 
> > This doesn't really seem right to me. If we resolve/reject promises in a
> > pre-finalizer or a destructor:
> > 
> > - It will expose a GC-behavior to the web; i.e., a web-exposed behavior will
> > change depending on when a GC is triggered. This should be avoided; i.e., GC
> > should not be observable.
> > 
> > - There's no guarantee about when a GC is triggered (although a GC will be
> > eventually triggered in practice). The resolve/reject may not be called.
> > 
> > For the above reasons, resolve/reject should be called at a deterministic
> timing
> > in a way that doesn't rely on GCs.
> > 
> > (In more general, it's not a good idea to do something complicated in a
> > pre-finalizer.)
> 
> Good points, thanks for bringing them up! I'm at a bit of a loss about how to
> handle this otherwise, though. If we find that we have outstanding promises
when
> the object tracking them is GCed, are we supposed to just never resolve them?
> 
> Though, now that I think about it, if the page has a reference to the
> outstanding promise then that would prevent this object from GCing anyway. In
> which case the only occasion that we would hit this code is when the document
> itself is being destroyed, at which point any outstanding promises are
probably
> moot?

If that is the case, you can move onGetDisplays() to contextDestroyed()? Then
you can assert that all promises are resolved when you reach dispose().

Powered by Google App Engine
This is Rietveld 408576698