Limit placeholder canvas to hold at most 3 pending image frames on main thread


When main thread is blocked and worker thread keeps animating, there will be
many accumulated callbacks that post images from OffscreenCanvas to the
placeholder canvas. This CL stops posting more images when there has been 3
images sent to the placeholder and none has returned. Once the main thread
becomes unblocked, placeholder returns back with a ReclaimResource request,
which will then trigger OffscreenCanvas to post the latest unposted image to
placeholder.

Bug: 762647
Change-Id: I3145ef424b1d9b1f268e9b4dbe6c36177ecfa7a4
Reviewed-on: https://chromium-review.googlesource.com/690935
Reviewed-by: Justin Novosad <junov@chromium.org>
Commit-Queue: Olivia Lai <xlai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#507991}
6 files changed