Bug 35453

Summary: Need to move items that CanvasRenderingContext2D depends on into CanvasSurface.
Product: WebKit Reporter: David Levin <levin>
Component: DOMAssignee: David Levin <levin>
Status: RESOLVED FIXED    
Severity: Normal CC: oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 34909    
Attachments:
Description Flags
Here's the changes inplace in HTMLCanvasElement (to make the diff clearer).
none
Proposed fix.
levin: review-
Proposed fix.
none
Proposed fix (added the modified changelog). oliver: review+

Description David Levin 2010-02-26 14:13:37 PST
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.
Comment 1 David Levin 2010-02-26 14:27:58 PST
Created attachment 49646 [details]
Proposed fix.

See the previous patch for the same changes but in an easier to diff format.
Comment 2 Oliver Hunt 2010-03-01 17:02:47 PST
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 3 David Levin 2010-03-01 17:07:09 PST
Comment on attachment 49646 [details]
Proposed fix.

I'll do something for Oliver's comments and upload a new patch.
Comment 4 David Levin 2010-03-02 15:50:57 PST
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).
Comment 5 David Levin 2010-03-02 16:02:29 PST
(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.
Comment 6 David Levin 2010-03-02 16:26:27 PST
Created attachment 49864 [details]
Proposed fix (added the modified changelog).
Comment 7 Oliver Hunt 2010-03-10 10:42:56 PST
Comment on attachment 49864 [details]
Proposed fix (added the modified changelog).

r=me
Comment 8 David Levin 2010-03-24 10:51:27 PDT
Committed as http://trac.webkit.org/changeset/56447