Bug 35453 - Need to move items that CanvasRenderingContext2D depends on into CanvasSurface.
Summary: Need to move items that CanvasRenderingContext2D depends on into CanvasSurface.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: David Levin
URL:
Keywords:
Depends on:
Blocks: 34909
  Show dependency treegraph
 
Reported: 2010-02-26 14:13 PST by David Levin
Modified: 2010-03-24 10:51 PDT (History)
1 user (show)

See Also:


Attachments
Here's the changes inplace in HTMLCanvasElement (to make the diff clearer). (13.66 KB, patch)
2010-02-26 14:13 PST, David Levin
no flags Details | Formatted Diff | Diff
Proposed fix. (16.68 KB, patch)
2010-02-26 14:27 PST, David Levin
levin: review-
Details | Formatted Diff | Diff
Proposed fix. (21.40 KB, patch)
2010-03-02 15:50 PST, David Levin
no flags Details | Formatted Diff | Diff
Proposed fix (added the modified changelog). (21.76 KB, patch)
2010-03-02 16:26 PST, David Levin
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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