-
Notifications
You must be signed in to change notification settings - Fork 369
AF Manager class for dynamic animation frame request/cancel #1407
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
base: master
Are you sure you want to change the base?
Conversation
gkjohnson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks! A couple comments but I think this is the right direction
| @@ -0,0 +1,43 @@ | |||
| class AFManager { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets call this FrameScheduler for now.
| setXRSession( xrsession ) { | ||
|
|
||
| this.xrsession = xrsession; | ||
|
|
||
| } | ||
|
|
||
| removeXRSession() { | ||
|
|
||
| this.xrsession = null; | ||
|
|
||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When changing the system being used for callbacks we will have to cancel all previous callbacks and reregister them with the new function. Eg if the "LRUCache" schedules an unload event it will be waiting until that event fires before scheduling another one. So if the last event is scheduled using the "xrSession" callback and then the session closes, the scheduled callback will never be fired.
So we'll need to keep track of all scheduled callbacks and rAF handles to swap over the scheduled events.
|
@phoenixbf - just wanted to check in to see if you had any more questions on the changes needed here. |
Hi, performing some local testing in order to have a clean rAF tracking system and handling swaps |
|
I've added management of pending AF. So far I tried the above logic in both local and online setups without any evident issues, also with mutiple tsets. If this is the right direction, it should be probably instantiated in |
|
Thanks the direction of this looks great. I think we can cut down on some code redundancy in the implementation but we can deal with that once everything is working.
This sounds good to me. Looks like the "LRUCache", "PriorityQueue", the "throttle" function, and "QueryManager" are all places where rAF is used (though the throttle function can maybe be changed to "queueMicrotask") |
See #1342