RESOLVED FIXED Bug 66597
[skia] BitmapImageSingleFrameSkia returns true to isBitmapImage() but does not inherit from BitmapImage
https://bugs.webkit.org/show_bug.cgi?id=66597
Summary [skia] BitmapImageSingleFrameSkia returns true to isBitmapImage() but does no...
James Robinson
Reported 2011-08-19 14:52:12 PDT
This leads to bugs since code in WebKit typically assumes that if a function returns true to isFoo() it is safe to static_cast<Foo*> and call functions. See https://bugs.webkit.org/show_bug.cgi?id=65063 for an example of where this bug caused real crashes.
Attachments
Patch (11.91 KB, patch)
2012-05-03 14:05 PDT, Tom Hudson
no flags
Patch (13.52 KB, patch)
2012-05-04 08:48 PDT, Tom Hudson
no flags
Patch (14.82 KB, patch)
2012-05-04 14:21 PDT, Tom Hudson
no flags
Patch (18.48 KB, patch)
2012-05-18 13:14 PDT, Tom Hudson
webkit-ews: commit-queue-
Simon Fraser (smfr)
Comment 1 2011-08-19 15:09:26 PDT
I don't like the changes made for bug 65063, so I welcome cleanup here.
James Robinson
Comment 2 2011-08-19 15:25:04 PDT
For the record, I don't either. It was either that or turn off your optimization for all skia ports, though :/.
James Robinson
Comment 3 2011-08-19 17:30:52 PDT
The original motivation for BitmapImageSingleFrameSkia is to avoid having all of the animation overhead for simple 1-frame images, which seems like a useful optimization for all ports. I think the option 3 from https://bugs.webkit.org/show_bug.cgi?id=65063#c18 is the best way to go here - we should turn BitmapImage into a simple class that doesn't handle animation concerns, and use an AnimatedBitmapImage subclass to handle the animation case. This should have the nice benefit of reducing the memory use for non-animated images for all platforms and clean up the class hierarchy a lot for the skia case.
Tom Hudson
Comment 4 2012-05-01 12:56:46 PDT
It feels like a stretch for me, but it looks like the original class of bug may be triggering again in the Chromium port, so I'm going to try to do the refactoring James endorsed this week.
Tom Hudson
Comment 5 2012-05-03 14:05:52 PDT
Tom Hudson
Comment 6 2012-05-03 14:08:55 PDT
In the discussions around https://bugs.webkit.org/show_bug.cgi?id=65063#c18, one thing we didn't realize is not only does the Skia-specific single-frame class avoid all the implementation for multiple frames, it *also* uses a different type to store the image, so there doesn't seem to be any implementation that can be shared between the two classes. This patch introduces a lightweight class SimpleBitmapImage that does nothing more than mark that an object is some sort of Bitmap (rather than SVG). I've gone through the WebCore fixing up call sites that were using isBitmapImage() to use isSimpleBitmapImage() where that seems reasonable. If we're going to do something more comprehensive, I'll need pointers from people familiar with this part of the code.
Build Bot
Comment 7 2012-05-03 14:24:41 PDT
Philippe Normand
Comment 8 2012-05-03 14:30:07 PDT
Build Bot
Comment 9 2012-05-03 14:36:34 PDT
Early Warning System Bot
Comment 10 2012-05-03 14:42:29 PDT
Early Warning System Bot
Comment 11 2012-05-03 14:46:29 PDT
Gyuyoung Kim
Comment 12 2012-05-03 14:55:25 PDT
Tom Hudson
Comment 13 2012-05-04 08:48:27 PDT
Build Bot
Comment 14 2012-05-04 09:11:14 PDT
Build Bot
Comment 15 2012-05-04 09:13:37 PDT
Early Warning System Bot
Comment 16 2012-05-04 09:24:11 PDT
Gyuyoung Kim
Comment 17 2012-05-04 09:41:21 PDT
Early Warning System Bot
Comment 18 2012-05-04 10:15:30 PDT
Gustavo Noronha (kov)
Comment 19 2012-05-04 11:05:34 PDT
Tom Hudson
Comment 20 2012-05-04 14:21:29 PDT
Build Bot
Comment 21 2012-05-04 14:36:18 PDT
Early Warning System Bot
Comment 22 2012-05-04 14:39:45 PDT
Early Warning System Bot
Comment 23 2012-05-04 14:42:55 PDT
Build Bot
Comment 24 2012-05-04 15:02:50 PDT
Tom Hudson
Comment 25 2012-05-18 13:14:27 PDT
Early Warning System Bot
Comment 26 2012-05-18 13:26:11 PDT
Build Bot
Comment 27 2012-05-18 13:33:09 PDT
Early Warning System Bot
Comment 28 2012-05-18 13:34:02 PDT
Build Bot
Comment 29 2012-05-18 14:07:04 PDT
Note You need to log in before you can comment on or make changes to this bug.