Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cancelling rAF callbacks from within rAF #1005

Merged
merged 2 commits into from
Apr 21, 2020

Conversation

Manishearth
Copy link
Contributor

Fixes #923

r? @toji

Copy link
Member

@toji toji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one nit and one question

index.bs Outdated
@@ -879,7 +879,7 @@ The <dfn method for="XRSession">cancelAnimationFrame(|handle|)</dfn> method canc
When this method is invoked, the user agent MUST run the following steps:

1. Let |session| be the target {{XRSession}} object.
1. Find the entry in |session|'s [=list of animation frame callbacks=] that is associated with the value |handle|.
1. Find the entry in |session|'s [=list of animation frame callbacks=] and |session|'s [=list of currently running animation frame callbacks=] that is associated with the value |handle|.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This could be an "or", since the value should not exist in both at once.

index.bs Outdated
@@ -892,15 +892,16 @@ When an {{XRSession}} |session| receives updated [=viewer=] state for timestamp
1. If |session|'s [=pending render state=] is not <code>null</code>, [=apply the pending render state=].
1. If |session|'s {{XRSession/renderState}}'s {{XRRenderState/baseLayer}} is <code>null</code>, abort these steps.
1. If |session|'s [=XRSession/mode=] is {{XRSessionMode/"inline"}} and |session|'s {{XRSession/renderState}}'s [=XRRenderState/output canvas=] is <code>null</code>, abort these steps.
1. Let |callbacks| be a list of the entries in |session|'s [=list of animation frame callback=], in the order in which they were added to the list.
1. Set |session|'s [=list of currently running animation frame callbacks=] to be a copy of the list of the entries in |session|'s [=list of animation frame callbacks=], in the order in which they were added to the list.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reasoning behind the new copy here? We should be able to just move the pointer around, so to speak, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to preserve the clause that that list is in order of append, but really that's how lists work anyway so i don't think this is necessary.

@Manishearth
Copy link
Contributor Author

Addressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cancelAnimationFrame: clarify behavior when called from a frame callback
2 participants