Bug 66597

Summary: [skia] BitmapImageSingleFrameSkia returns true to isBitmapImage() but does not inherit from BitmapImage
Product: WebKit Reporter: James Robinson <jamesr>
Component: New BugsAssignee: Tom Hudson <tomhudson>
Status: RESOLVED FIXED    
Severity: Normal CC: brettw, cdumez, eric, gustavo, jamesr, pnormand, rakuco, reed, schenney, senorblanco, tomhudson, webkit.review.bot, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch webkit-ews: commit-queue-

Description James Robinson 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.
Comment 1 Simon Fraser (smfr) 2011-08-19 15:09:26 PDT
I don't like the changes made for bug 65063, so I welcome cleanup here.
Comment 2 James Robinson 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 :/.
Comment 3 James Robinson 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.
Comment 4 Tom Hudson 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.
Comment 5 Tom Hudson 2012-05-03 14:05:52 PDT
Created attachment 140089 [details]
Patch
Comment 6 Tom Hudson 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.
Comment 7 Build Bot 2012-05-03 14:24:41 PDT
Comment on attachment 140089 [details]
Patch

Attachment 140089 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/12545388
Comment 8 Philippe Normand 2012-05-03 14:30:07 PDT
Comment on attachment 140089 [details]
Patch

Attachment 140089 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/12607303
Comment 9 Build Bot 2012-05-03 14:36:34 PDT
Comment on attachment 140089 [details]
Patch

Attachment 140089 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12545391
Comment 10 Early Warning System Bot 2012-05-03 14:42:29 PDT
Comment on attachment 140089 [details]
Patch

Attachment 140089 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12625094
Comment 11 Early Warning System Bot 2012-05-03 14:46:29 PDT
Comment on attachment 140089 [details]
Patch

Attachment 140089 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12612385
Comment 12 Gyuyoung Kim 2012-05-03 14:55:25 PDT
Comment on attachment 140089 [details]
Patch

Attachment 140089 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/12611334
Comment 13 Tom Hudson 2012-05-04 08:48:27 PDT
Created attachment 140244 [details]
Patch
Comment 14 Build Bot 2012-05-04 09:11:14 PDT
Comment on attachment 140244 [details]
Patch

Attachment 140244 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/12543344
Comment 15 Build Bot 2012-05-04 09:13:37 PDT
Comment on attachment 140244 [details]
Patch

Attachment 140244 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12632170
Comment 16 Early Warning System Bot 2012-05-04 09:24:11 PDT
Comment on attachment 140244 [details]
Patch

Attachment 140244 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12633176
Comment 17 Gyuyoung Kim 2012-05-04 09:41:21 PDT
Comment on attachment 140244 [details]
Patch

Attachment 140244 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/12631189
Comment 18 Early Warning System Bot 2012-05-04 10:15:30 PDT
Comment on attachment 140244 [details]
Patch

Attachment 140244 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12627184
Comment 19 Gustavo Noronha (kov) 2012-05-04 11:05:34 PDT
Comment on attachment 140244 [details]
Patch

Attachment 140244 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/12629213
Comment 20 Tom Hudson 2012-05-04 14:21:29 PDT
Created attachment 140324 [details]
Patch
Comment 21 Build Bot 2012-05-04 14:36:18 PDT
Comment on attachment 140324 [details]
Patch

Attachment 140324 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12631284
Comment 22 Early Warning System Bot 2012-05-04 14:39:45 PDT
Comment on attachment 140324 [details]
Patch

Attachment 140324 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12631286
Comment 23 Early Warning System Bot 2012-05-04 14:42:55 PDT
Comment on attachment 140324 [details]
Patch

Attachment 140324 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12627265
Comment 24 Build Bot 2012-05-04 15:02:50 PDT
Comment on attachment 140324 [details]
Patch

Attachment 140324 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/12531283
Comment 25 Tom Hudson 2012-05-18 13:14:27 PDT
Created attachment 142772 [details]
Patch
Comment 26 Early Warning System Bot 2012-05-18 13:26:11 PDT
Comment on attachment 142772 [details]
Patch

Attachment 142772 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12720968
Comment 27 Build Bot 2012-05-18 13:33:09 PDT
Comment on attachment 142772 [details]
Patch

Attachment 142772 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/12722888
Comment 28 Early Warning System Bot 2012-05-18 13:34:02 PDT
Comment on attachment 142772 [details]
Patch

Attachment 142772 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12728332
Comment 29 Build Bot 2012-05-18 14:07:04 PDT
Comment on attachment 142772 [details]
Patch

Attachment 142772 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12728344