Commit d92705e5 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[profview] Use requestAnimationFrame to schedule a render

This is more idiomatic than using a Promise.

Change-Id: I61443e90ef1c0c589284851ea9be410153919eb5
Reviewed-on: https://chromium-review.googlesource.com/c/456278Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58828}
parent 57fa8f5b
......@@ -55,6 +55,7 @@ function setCallTreeState(state, callTreeState) {
let main = {
currentState : emptyState(),
renderPending : false,
setMode(mode) {
if (mode !== main.currentState.mode) {
......@@ -197,7 +198,11 @@ let main = {
},
delayRender() {
Promise.resolve().then(() => {
if (main.renderPending) return;
main.renderPending = true;
window.requestAnimationFrame(() => {
main.renderPending = false;
for (let c of components) {
c.render(main.currentState);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment