Changeset 145512 in webkit


Ignore:
Timestamp:
Mar 12, 2013 4:11:14 AM (11 years ago)
Author:
jocelyn.turcotte@digia.com
Message:

[Qt][WK2] Favor QUrl and QString over WTF::String in the Qt API layer
https://bugs.webkit.org/show_bug.cgi?id=109468

Reviewed by Allan Sandfeld Jensen.
Signed off for WebKit2 by Benjamin Poulain.

In preparation for patches using the C API types in some areas, remove the
usage of WTF::String on the affected line.

Use a QUrl for icon URL to avoid unnecessary conversion.
Use a QString for the page URL to keep it compatible with WebPageProxy and
WebIconDatabase and avoid QUrl parsing.

  • UIProcess/API/qt/qquickwebview.cpp:

(QQuickWebViewPrivate::_q_onIconChangedForPageURL):
(QQuickWebViewPrivate::updateIcon):
(QQuickWebView::emitUrlChangeIfNeeded):
(QQuickWebView::icon):

  • UIProcess/API/qt/qquickwebview_p_p.h:

(QQuickWebViewPrivate):

  • UIProcess/API/qt/qwebiconimageprovider.cpp:

(QWebIconImageProvider::iconURLForPageURLInContext):

  • UIProcess/API/qt/qwebiconimageprovider_p.h:
  • UIProcess/qt/QtWebIconDatabaseClient.cpp:

(WebKit::QtWebIconDatabaseClient::iconForPageURL):
(WebKit::QtWebIconDatabaseClient::iconImageForPageURL):
(WebKit::QtWebIconDatabaseClient::retainIconForPageURL):
(WebKit::QtWebIconDatabaseClient::releaseIconForPageURL):

  • UIProcess/qt/QtWebIconDatabaseClient.h:

(QtWebIconDatabaseClient):

Location:
trunk/Source/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r145508 r145512  
     12013-02-14  Jocelyn Turcotte  <jocelyn.turcotte@digia.com>
     2
     3        [Qt][WK2] Favor QUrl and QString over WTF::String in the Qt API layer
     4        https://bugs.webkit.org/show_bug.cgi?id=109468
     5
     6        Reviewed by Allan Sandfeld Jensen.
     7        Signed off for WebKit2 by Benjamin Poulain.
     8
     9        In preparation for patches using the C API types in some areas, remove the
     10        usage of WTF::String on the affected line.
     11
     12        Use a QUrl for icon URL to avoid unnecessary conversion.
     13        Use a QString for the page URL to keep it compatible with WebPageProxy and
     14        WebIconDatabase and avoid QUrl parsing.
     15
     16        * UIProcess/API/qt/qquickwebview.cpp:
     17        (QQuickWebViewPrivate::_q_onIconChangedForPageURL):
     18        (QQuickWebViewPrivate::updateIcon):
     19        (QQuickWebView::emitUrlChangeIfNeeded):
     20        (QQuickWebView::icon):
     21        * UIProcess/API/qt/qquickwebview_p_p.h:
     22        (QQuickWebViewPrivate):
     23        * UIProcess/API/qt/qwebiconimageprovider.cpp:
     24        (QWebIconImageProvider::iconURLForPageURLInContext):
     25        * UIProcess/API/qt/qwebiconimageprovider_p.h:
     26        * UIProcess/qt/QtWebIconDatabaseClient.cpp:
     27        (WebKit::QtWebIconDatabaseClient::iconForPageURL):
     28        (WebKit::QtWebIconDatabaseClient::iconImageForPageURL):
     29        (WebKit::QtWebIconDatabaseClient::retainIconForPageURL):
     30        (WebKit::QtWebIconDatabaseClient::releaseIconForPageURL):
     31        * UIProcess/qt/QtWebIconDatabaseClient.h:
     32        (QtWebIconDatabaseClient):
     33
    1342013-03-12  Manuel Rego Casasnovas  <rego@igalia.com>
    235
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp

    r144165 r145512  
    628628void QQuickWebViewPrivate::_q_onIconChangedForPageURL(const QString& pageUrl)
    629629{
    630     if (pageUrl != QString(m_currentUrl))
     630    if (pageUrl != m_currentUrl)
    631631        return;
    632632
     
    648648        return;
    649649
    650     WTF::String iconUrl = provider->iconURLForPageURLInContext(m_currentUrl, context.get());
     650    QUrl iconUrl = provider->iconURLForPageURLInContext(m_currentUrl, context.get());
    651651
    652652    if (iconUrl == m_iconUrl)
     
    17011701    Q_D(QQuickWebView);
    17021702
    1703     WTF::String activeUrl = d->webPageProxy->activeURL();
     1703    QString activeUrl = d->webPageProxy->activeURL();
    17041704    if (activeUrl != d->m_currentUrl) {
    17051705        d->m_currentUrl = activeUrl;
     
    17291729{
    17301730    Q_D(const QQuickWebView);
    1731     return QUrl(d->m_iconUrl);
     1731    return d->m_iconUrl;
    17321732}
    17331733
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h

    r142997 r145512  
    203203    bool m_renderToOffscreenBuffer;
    204204    bool m_allowAnyHTTPSCertificateForLocalHost;
    205     WTF::String m_iconUrl;
     205    QUrl m_iconUrl;
    206206    int m_loadProgress;
    207     WTF::String m_currentUrl;
     207    QString m_currentUrl;
    208208};
    209209
  • trunk/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp

    r132467 r145512  
    3939}
    4040
    41 WTF::String QWebIconImageProvider::iconURLForPageURLInContext(const WTF::String &pageURL, QtWebContext* context)
     41QUrl QWebIconImageProvider::iconURLForPageURLInContext(const QString &pageURL, QtWebContext* context)
    4242{
    4343    QtWebIconDatabaseClient* iconDatabase = context->iconDatabase();
    44     WTF::String iconURL = iconDatabase->iconForPageURL(pageURL);
     44    QUrl iconURL = iconDatabase->iconForPageURL(pageURL);
    4545
    4646    if (iconURL.isEmpty())
    47         return String();
     47        return QUrl();
    4848
    4949    QUrl url;
     
    5151    url.setHost(QWebIconImageProvider::identifier());
    5252    // Make sure that QML doesn't show cached versions of the previous icon if the icon location changed.
    53     url.setPath(QLatin1Char('/') + QString::number(WTF::StringHash::hash(iconURL)));
     53    url.setPath(QLatin1Char('/') + QString::number(WTF::StringHash::hash(iconURL.toString())));
    5454
    5555    // FIXME: Use QUrl::DecodedMode when landed in Qt
    56     url.setFragment(QString::fromLatin1(QByteArray(QString(pageURL).toUtf8()).toBase64()));
     56    url.setFragment(QString::fromLatin1(pageURL.toUtf8().toBase64()));
    5757
    5858    // FIXME: We can't know when the icon url is no longer in use,
     
    6161    iconDatabase->retainIconForPageURL(pageURL);
    6262
    63     return url.toString(QUrl::FullyEncoded);
     63    return url;
    6464}
    6565
  • trunk/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h

    r118762 r145512  
    3737    static QString identifier() { return QStringLiteral("webicon"); }
    3838
    39     WTF::String iconURLForPageURLInContext(const WTF::String& pageURL, WebKit::QtWebContext* context);
     39    QUrl iconURLForPageURLInContext(const QString& pageURL, WebKit::QtWebContext* context);
    4040    virtual QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize);
    4141};
  • trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp

    r132534 r145512  
    6666}
    6767
    68 WTF::String QtWebIconDatabaseClient::iconForPageURL(const WTF::String& pageURL)
     68QUrl QtWebIconDatabaseClient::iconForPageURL(const QString& pageURL)
    6969{
    7070    String iconURL;
     
    7272
    7373    if (iconURL.isEmpty())
    74         return String();
     74        return QUrl();
    7575
    7676    // Verify that the image data is actually available before reporting back
     
    7878    WebCore::Image* iconImage = m_iconDatabase->imageForPageURL(pageURL);
    7979    if (!iconImage || iconImage->isNull())
    80         return String();
     80        return QUrl();
    8181
    82     return iconURL;
     82    return QUrl(iconURL);
    8383}
    8484
    85 QImage QtWebIconDatabaseClient::iconImageForPageURL(const WTF::String& pageURL, const QSize& iconSize)
     85QImage QtWebIconDatabaseClient::iconImageForPageURL(const QString& pageURL, const QSize& iconSize)
    8686{
    8787    MutexLocker locker(m_imageLock);
     
    9696}
    9797
    98 void QtWebIconDatabaseClient::retainIconForPageURL(const String& pageURL)
     98void QtWebIconDatabaseClient::retainIconForPageURL(const QString& pageURL)
    9999{
    100100    m_iconDatabase->retainIconForPageURL(pageURL);
    101101}
    102102
    103 void QtWebIconDatabaseClient::releaseIconForPageURL(const String& pageURL)
     103void QtWebIconDatabaseClient::releaseIconForPageURL(const QString& pageURL)
    104104{
    105105    m_iconDatabase->releaseIconForPageURL(pageURL);
  • trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h

    r132467 r145512  
    3434QT_END_NAMESPACE
    3535
    36 namespace WTF {
    37 class String;
    38 }
    39 
    4036namespace WebKit {
    4137
     
    5046    ~QtWebIconDatabaseClient();
    5147
    52     WTF::String iconForPageURL(const WTF::String& pageURL);
    53     QImage iconImageForPageURL(const WTF::String& pageURL, const QSize& iconSize = QSize(32, 32));
     48    QUrl iconForPageURL(const QString& pageURL);
     49    QImage iconImageForPageURL(const QString& pageURL, const QSize& iconSize = QSize(32, 32));
    5450
    55     void retainIconForPageURL(const WTF::String&);
    56     void releaseIconForPageURL(const WTF::String&);
     51    void retainIconForPageURL(const QString&);
     52    void releaseIconForPageURL(const QString&);
    5753
    5854public:
Note: See TracChangeset for help on using the changeset viewer.