Created attachment 49638 [details] Here's the changes inplace in HTMLCanvasElement (to make the diff clearer). This is step 2a from https://bugs.webkit.org/show_bug.cgi?id=34909#c2.
Created attachment 49646 [details] Proposed fix. See the previous patch for the same changes but in an easier to diff format.
Comment on attachment 49646 [details] Proposed fix. > + // FIXME: Make isSupportedImageMIMETypeForEncoding threadsafe (to allow this method to be used on a worker thread). > + if (mimeType.isNull() || !MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)) It may be worth (for now) adding an isOnMainThread() assertion to this code path so that we can't accidentally forget to fix this. > + return buffer()->toDataURL("image/png"); > + > + return buffer()->toDataURL(mimeType); I wonder how thread safe the image _encoders_ are. i wonder what the DPI of an offscreen canvas should be... > +IntRect CanvasSurface::convertLogicalToDevice(const FloatRect& logicalRect) const > +{ I'm okay r+ing this, but i thought i'd see if you have any comments on these before i do.
Comment on attachment 49646 [details] Proposed fix. I'll do something for Oliver's comments and upload a new patch.
Created attachment 49859 [details] Proposed fix. The only difference between this patch and the last one is adding a few isMainThread() asserts (and corresponding changelog entries).
(In reply to comment #2) > (From update of attachment 49646 [details]) > > + // FIXME: Make isSupportedImageMIMETypeForEncoding threadsafe (to allow this method to be used on a worker thread). > > + if (mimeType.isNull() || !MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)) > > It may be worth (for now) adding an isOnMainThread() assertion to this code > path so that we can't accidentally forget to fix this. done. I also added bug https://bugs.webkit.org/show_bug.cgi?id=35616 for this. > I wonder how thread safe the image _encoders_ are. I looked at the code (for a while and for several different platforms) and it appeared pretty safe. I added a few asserts in some places that may need fixes. I also added bug https://bugs.webkit.org/show_bug.cgi?id=35615 and made it block the "master" bug. > i wonder what the DPI of an offscreen canvas should be... Me too :) Something I'll have to figure out as I get there but my instinct is to make it match the document that the worker came from.
Created attachment 49864 [details] Proposed fix (added the modified changelog).
Comment on attachment 49864 [details] Proposed fix (added the modified changelog). r=me
Committed as http://trac.webkit.org/changeset/56447