RESOLVED FIXED156766
REGRESSION(198782): ImageSource::subsamplingLevelForScale() does not cache the MaximumSubsamplingLevel for this ImageSource
https://bugs.webkit.org/show_bug.cgi?id=156766
Summary REGRESSION(198782): ImageSource::subsamplingLevelForScale() does not cache th...
Said Abou-Hallawa
Reported 2016-04-19 15:43:32 PDT
Calling ImageSource::calculateMaximumSubsamplingLevel() every time ImageSource::subsamplingLevelForScale() is called is expensive because it requires fetching the first frame for up to three subsampling level. Prior to r198782, ImageSource::calculateMaximumSubsamplingLevel() (which was named BitmapImage::determineMinimumSubsamplingLevel()) was called only once from BitmapImage::updateSize(). The fix should be to cache the maximumSubsamplingLevel when the image size is available.+
Attachments
Patch (4.45 KB, patch)
2016-04-19 15:58 PDT, Said Abou-Hallawa
no flags
Patch (4.33 KB, patch)
2016-04-19 17:57 PDT, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2016-04-19 15:51:17 PDT
The image subsampling is on by default only for iOS. So this bug currently affects the iOS port.
Said Abou-Hallawa
Comment 2 2016-04-19 15:58:51 PDT
Darin Adler
Comment 3 2016-04-19 16:11:14 PDT
Comment on attachment 276768 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=276768&action=review > Source/WebCore/platform/graphics/ImageSource.cpp:132 > + if (cacheMetadata(), !m_maximumSubsamplingLevel) > return 0; This use of the comma expression is not idiomatic for WebKit. The way we would write this in WebKit coding style is: cacheMetadata(); if (!m_maximumSubsamplingLevel) > Source/WebCore/platform/graphics/ImageSource.h:122 > + size_t frameCount() { return cacheMetadata(), m_frameCount; } Ditto. Please don't format it like this. Instead I suggest writing it after the class definition like this: inline size_t ImageSource::frameCount() { cacheMetadata(); return m_frameCount; }
Said Abou-Hallawa
Comment 4 2016-04-19 17:57:26 PDT
Said Abou-Hallawa
Comment 5 2016-04-19 18:25:38 PDT
Comment on attachment 276768 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=276768&action=review >> Source/WebCore/platform/graphics/ImageSource.cpp:132 >> return 0; > > This use of the comma expression is not idiomatic for WebKit. The way we would write this in WebKit coding style is: > > cacheMetadata(); > if (!m_maximumSubsamplingLevel) Done. The comma expression was split into two statements. >> Source/WebCore/platform/graphics/ImageSource.h:122 >> + size_t frameCount() { return cacheMetadata(), m_frameCount; } > > Ditto. Please don't format it like this. Instead I suggest writing it after the class definition like this: > > inline size_t ImageSource::frameCount() > { > cacheMetadata(); > return m_frameCount; > } Done. The comma expression was split into two statements.
Chris Dumez
Comment 6 2016-04-20 09:57:20 PDT
Did you mean to land this?
Said Abou-Hallawa
Comment 7 2016-04-20 11:18:09 PDT
(In reply to comment #6) > Did you mean to land this? Running tests to ensure the patch really fixes an iOS regression performance.
WebKit Commit Bot
Comment 8 2016-04-21 10:02:38 PDT
Comment on attachment 276785 [details] Patch Clearing flags on attachment: 276785 Committed r199821: <http://trac.webkit.org/changeset/199821>
WebKit Commit Bot
Comment 9 2016-04-21 10:02:42 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.