RESOLVED FIXED 75010
[Qt] Avoid string operations in mobile theme's caching mechanism
https://bugs.webkit.org/show_bug.cgi?id=75010
Summary [Qt] Avoid string operations in mobile theme's caching mechanism
Pierre Rossi
Reported 2011-12-21 08:38:29 PST
[Qt] Avoid string operations in mobile theme's caching mechanism
Attachments
Patch (14.42 KB, patch)
2011-12-21 08:49 PST, Pierre Rossi
no flags
Patch (21.09 KB, patch)
2012-01-03 15:53 PST, Pierre Rossi
no flags
Patch (21.07 KB, patch)
2012-01-04 04:42 PST, Pierre Rossi
no flags
Patch (21.11 KB, patch)
2012-01-12 03:31 PST, Pierre Rossi
no flags
Pierre Rossi
Comment 1 2011-12-21 08:49:11 PST
Kenneth Rohde Christiansen
Comment 2 2011-12-21 09:02:47 PST
Comment on attachment 120181 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=120181&action=review We talked on irc... so here are only a few style comments > Source/WebCore/platform/qt/RenderThemeQtMobile.cpp:175 > +void StylePainterMobile::insertInCache(const KeyIdentifier& keyId, const QPixmap& pixmap) into? > Source/WebCore/platform/qt/RenderThemeQtMobile.cpp:468 > + id.width =imageSize.width(); missing space > Source/WebCore/platform/qt/RenderThemeQtMobile.h:96 > + , trait1(false) > + , trait2(false) why not just 0 :-)
Alexis Menard (darktears)
Comment 3 2012-01-02 12:51:07 PST
Comment on attachment 120181 [details] Patch I like it. It is assured to be faster than string manipulation.
Pierre Rossi
Comment 4 2012-01-03 15:53:46 PST
Simon Hausmann
Comment 5 2012-01-04 00:49:48 PST
Comment on attachment 121011 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=121011&action=review > Source/WebCore/platform/qt/RenderThemeQtMobile.cpp:175 > + static CacheKey emptyKey; > + CacheKey key = cacheKeys.value(keyId, emptyKey); > + if (key == emptyKey) > + return false; > + const bool ret = QPixmapCache::find(key, result); > + if (!ret) > + cacheKeys.remove(keyId); > + return ret; I would prefer something along these lines: QHash<KeyIdentifier, CacheKey>::Iterator it = cacheKeys.find(keyId); if (it == cacheKeys.end()) return false; bool ret = QPixmapCache::find(*it, result); if (!ret) cacheKeys.erase(it); instead of the empty key "hack".
Pierre Rossi
Comment 6 2012-01-04 04:42:48 PST
Kenneth Rohde Christiansen
Comment 7 2012-01-05 08:45:01 PST
Comment on attachment 121100 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=121100&action=review > Source/WebCore/platform/qt/RenderThemeQtMobile.cpp:180 > + const int size = pixmap.width() * pixmap.height() * pixmap.depth() / 8192; 8192 seems magical.. comment?
Pierre Rossi
Comment 8 2012-01-09 07:14:57 PST
(In reply to comment #7) > (From update of attachment 121100 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=121100&action=review > > > Source/WebCore/platform/qt/RenderThemeQtMobile.cpp:180 > > + const int size = pixmap.width() * pixmap.height() * pixmap.depth() / 8192; > > 8192 seems magical.. comment? It's just to convert from bits to kilobytes. Does that really call for another comment ?
Pierre Rossi
Comment 9 2012-01-12 03:31:45 PST
Created attachment 122205 [details] Patch Made the KB conversion more explicit (hopefully).
WebKit Review Bot
Comment 10 2012-01-12 08:33:29 PST
Comment on attachment 122205 [details] Patch Clearing flags on attachment: 122205 Committed r104828: <http://trac.webkit.org/changeset/104828>
WebKit Review Bot
Comment 11 2012-01-12 08:33:35 PST
All reviewed patches have been landed. Closing bug.
Csaba Osztrogonác
Comment 12 2012-01-12 08:43:09 PST
Comment on attachment 122205 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=122205&action=review > Source/WebCore/platform/qt/RenderThemeQtMobile.cpp:341 > + ASSERT(innerSize > padding.toSize()); > + const QSizeF innerSize = size - padding; These lines should be changed. :) That's why it broke debug build. Fix landed in http://trac.webkit.org/changeset/104830
Csaba Osztrogonác
Comment 13 2012-01-12 08:50:13 PST
Build is still broken. :-/ ../../../../Source/WebCore/platform/qt/RenderThemeQtMobile.cpp: In member function ‘QPixmap WebCore::StylePainterMobile::findComboButton(const QSize&, bool, bool) const’: ../../../../Source/WebCore/platform/qt/RenderThemeQtMobile.cpp:341: error: no match for ‘operator>’ in ‘innerSize > padding.QSizeF::toSize()’ /usr/local/Trolltech/Qt-4.8.0/include/QtCore/qchar.h:393: note: candidates are: bool operator>(QChar, QChar) /usr/local/Trolltech/Qt-4.8.0/include/QtCore/qbytearray.h:551: note: bool operator>(const QByteArray&, const QByteArray&) /usr/local/Trolltech/Qt-4.8.0/include/QtCore/qbytearray.h:553: note: bool operator>(const QByteArray&, const char*) /usr/local/Trolltech/Qt-4.8.0/include/QtCore/qbytearray.h:555: note: bool operator>(const char*, const QByteArray&) /usr/local/Trolltech/Qt-4.8.0/include/QtCore/qstring.h:942: note: bool operator>(const char*, const QString&) /usr/local/Trolltech/Qt-4.8.0/include/QtCore/qstring.h:955: note: bool operator>(const char*, const QLatin1String&) /usr/local/Trolltech/Qt-4.8.0/include/QtCore/qstring.h:970: note: bool operator>(const QLatin1String&, const QLatin1String&) /usr/local/Trolltech/Qt-4.8.0/include/QtCore/qstring.h:1221: note: bool operator>(const QStringRef&, const QStringRef&) Guys, could you fix it?
Pierre Rossi
Comment 14 2012-03-02 07:37:52 PST
I Should have closed that when landing r104834.
Note You need to log in before you can comment on or make changes to this bug.