Bug 62742 - Add ShareableBitmap::createImage and get rid of WebCoreArgumentCodersCG.cpp
Summary: Add ShareableBitmap::createImage and get rid of WebCoreArgumentCodersCG.cpp
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-15 11:55 PDT by Anders Carlsson
Modified: 2011-06-15 12:50 PDT (History)
2 users (show)

See Also:


Attachments
Patch (12.67 KB, patch)
2011-06-15 11:57 PDT, Anders Carlsson
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Carlsson 2011-06-15 11:55:28 PDT
Add ShareableBitmap::createImage and get rid of WebCoreArgumentCodersCG.cpp
Comment 1 Anders Carlsson 2011-06-15 11:57:29 PDT
Created attachment 97340 [details]
Patch
Comment 2 WebKit Review Bot 2011-06-15 12:00:06 PDT
Attachment 97340 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1

Source/WebKit2/Shared/ShareableBitmap.h:49:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Darin Adler 2011-06-15 12:34:24 PDT
Comment on attachment 97340 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=97340&action=review

> Source/WebKit2/Shared/ShareableBitmap.h:110
> +    // This create a bitmap image that directly references the shared bitmap data.

Should be "This creates".

> Source/WebKit2/Shared/ShareableBitmap.h:112
> +    // This is only safe to use when we know that the contents of the shareable bitmap won't change.
> +    PassRefPtr<WebCore::Image> createImage();

Would be nice if that “this is only safe” information was reflected in the function name.

> Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp:115
> +    // BitmapImage::create adopts the CGImageRef that's passed in, which is why we need to leakRef here.

Could that be fixed by changing BitmapImage::create to take a RetainPtr?
Comment 4 Anders Carlsson 2011-06-15 12:38:25 PDT
(In reply to comment #3)
> (From update of attachment 97340 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=97340&action=review
> 
> > Source/WebKit2/Shared/ShareableBitmap.h:110
> > +    // This create a bitmap image that directly references the shared bitmap data.
> 
> Should be "This creates".
> 

Fixed.

> > Source/WebKit2/Shared/ShareableBitmap.h:112
> > +    // This is only safe to use when we know that the contents of the shareable bitmap won't change.
> > +    PassRefPtr<WebCore::Image> createImage();
> 
> Would be nice if that “this is only safe” information was reflected in the function name.
> 

Agreed. For the two functions we have that return CGImageRefs we indicate when the image is copied. (makeCGImage vs makeCGImageCopy).

> > Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp:115
> > +    // BitmapImage::create adopts the CGImageRef that's passed in, which is why we need to leakRef here.
> 
> Could that be fixed by changing BitmapImage::create to take a RetainPtr?

It could. That's a bit more involved though since BitmapImage::create takes a NativeImagePtr typedef which is currently a CGImageRef typedef. Changing it to RetainPtr<CGImageRef> would introduce ref-churn. Ideally we'd have a more cross-platform solution.
Comment 5 Anders Carlsson 2011-06-15 12:50:37 PDT
Committed r88967: <http://trac.webkit.org/changeset/88967>