Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(core): ensure that multiple requests to requestAnimationFrame are buffered #11800

Closed
wants to merge 1 commit into from

Conversation

matsko
Copy link
Contributor

@matsko matsko commented May 4, 2015

IE11 (and maybe some other browsers) do not optimize multiple calls to
rAF. This code makes that happen internally within the $$rAF service
before the next frame kicks in.

Closes #11791

@matsko matsko force-pushed the raf_perf branch 2 times, most recently from 297b3fc to c5392a4 Compare May 4, 2015 18:05
var task = taskQueue[i];
if (task) {
taskQueue[i] = null;
taskCount--;
Copy link
Member

Choose a reason for hiding this comment

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

This seems redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The taskCount variable is essential to know when to cancel the underlying RAF request when there are no more queued rAF functions.

Copy link
Member

Choose a reason for hiding this comment

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

But here you are running a loop that decreases taskCount and right after that you srt it to 0.
So, decrementing it is redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes. Good call.

@petebacondarwin petebacondarwin modified the milestone: 1.4.0-rc.2 May 4, 2015
@matsko matsko force-pushed the raf_perf branch 2 times, most recently from a882a93 to 0aeabd5 Compare May 5, 2015 18:56
… buffered

IE11 (and maybe some other browsers) do not optimize multiple calls to
rAF. This code makes that happen internally within the $$rAF service
before the next frame kicks in.

Closes angular#11791
@matsko
Copy link
Contributor Author

matsko commented May 5, 2015

LGTM (from Igor in person).

@matsko
Copy link
Contributor Author

matsko commented May 5, 2015

Merged in as db20b83

@matsko matsko closed this May 5, 2015
@matsko matsko deleted the raf_perf branch May 5, 2015 21:20
@gkalpak
Copy link
Member

gkalpak commented May 6, 2015

What does Igor in person think about cancelQueueFn being called at a later time and cancelling a titally unrelated animation (just because the index is the same) ?

Did I miss something ?

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

Successfully merging this pull request may close these issues.

ngAnimate makes IE11 grind to a halt
4 participants