Re: [whatwg] Synchronizing Canvas updates in a worker to DOM changes in the UI thread

On Mon, Oct 21, 2013 at 4:46 AM, Glenn Maynard <glenn@zewt.org> wrote:

> On Sun, Oct 20, 2013 at 9:26 PM, Kyle Huey <me@kylehuey.com> wrote:
>
> > On Sun, Oct 20, 2013 at 11:33 PM, Glenn Maynard <glenn@bluegoji.com
> >wrote:
> >
> >> It must not be possible for the UI thread to detect whether present()
> did
> >> anything--if there's no frame in the ready buffer, nothing changes and
> the
> >> UI thread can't detect this.  Similarly, it must not be possible for the
> >> rendering thread to detect if the ready frame has been presented.  These
> >> rules are to prevent exposing asynchronous behavior.
> >>
> >
> > Well you can readback from <canvas>es, so how is that going to work?
>
> However it works today, since CanvasProxy needs the same thing.  If a
> CanvasProxy/WorkerCanvas exists for a canvas, you should have to use a
> toBlob method on that, and calls to that (and earlier calls in progress) on
> the Canvas itself should fail.  (If CanvasProxy isn't doing that it seems
> like a bug.)
>

With all these proposals I think it's OK to allow the main thread to do
(e.g.) a toDataURL and read what the current contents of the canvas is, and
possibly observe that they have changed. This is already possible today
with drawing video elements to a canvas; you can observe that the current
video frame sometimes changes. (It is of course essential that you don't
read a partially updated frame.)

If we don't want that, one way to fix it is to lock the frame used by a
particular script execution. So the first time you do a drawImage(video),
or a toDataURL within a particular script execution, we lock the current
contents of the video element or the canvas element for the purposes of
that script execution and ensure that any further usage of that element
within this script execution returns the same data.

Rob
-- 
Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni
le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa
stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr,
'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp
waanndt  wyeonut  thoo mken.o w  *
*

Received on Monday, 21 October 2013 04:17:17 UTC