[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

hausmann at webkit.org hausmann at webkit.org
Thu Apr 8 01:30:17 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 277a9193ced7f60b277ee908e0f224f3724c303f
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 29 14:33:13 2010 +0000

    [Qt] Speed up the WebCore::String -> QString conversion
    
    Patch by Oswald Buddenhagen <oswald.buddenhagen at nokia.com> on 2010-01-29
    Reviewed by Simon Hausmann.
    
    Use QString(const QChar *, int len) constructor instead of QString::fromUtf16 to
    avoid BOM checks and byteswapping.
    
    * bridge/qt/qt_class.cpp:
    (JSC::Bindings::QtClass::fieldNamed):
    * bridge/qt/qt_runtime.cpp:
    (JSC::Bindings::convertValueToQVariant):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54060 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c2bbc8b..881003f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-29  Oswald Buddenhagen <oswald.buddenhagen at nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] Speed up the WebCore::String -> QString conversion
+
+        Use QString(const QChar *, int len) constructor instead of QString::fromUtf16 to
+        avoid BOM checks and byteswapping.
+
+        * bridge/qt/qt_class.cpp:
+        (JSC::Bindings::QtClass::fieldNamed):
+        * bridge/qt/qt_runtime.cpp:
+        (JSC::Bindings::convertValueToQVariant):
+
 2010-01-29  Alexander Pavlov  <apavlov at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/bridge/qt/qt_class.cpp b/WebCore/bridge/qt/qt_class.cpp
index c39b3af..09a1544 100644
--- a/WebCore/bridge/qt/qt_class.cpp
+++ b/WebCore/bridge/qt/qt_class.cpp
@@ -127,7 +127,7 @@ Field* QtClass::fieldNamed(const Identifier& identifier, Instance* instance) con
 
     QObject* obj = qtinst->getObject();
     UString ustring = identifier.ustring();
-    QString objName(QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()));
+    QString objName((const QChar*)ustring.rep()->data(), ustring.size());
     QByteArray ba = objName.toAscii();
 
     // First check for a cached field
diff --git a/WebCore/bridge/qt/qt_runtime.cpp b/WebCore/bridge/qt/qt_runtime.cpp
index c933d6b..9601a4a 100644
--- a/WebCore/bridge/qt/qt_runtime.cpp
+++ b/WebCore/bridge/qt/qt_runtime.cpp
@@ -305,7 +305,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
                 return QString();
             } else {
                 UString ustring = value.toString(exec);
-                ret = QVariant(QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()));
+                ret = QVariant(QString((const QChar*)ustring.rep()->data(), ustring.size()));
                 if (type == String)
                     dist = 0;
                 else
@@ -329,7 +329,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
                         QVariant v = convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects);
                         if (objdist >= 0) {
                             UString ustring = (*it).ustring();
-                            QString id = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size());
+                            QString id = QString((const QChar*)ustring.rep()->data(), ustring.size());
                             result.insert(id, v);
                         }
                     }
@@ -404,7 +404,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
                 for (int i = 0; i < len; ++i) {
                     JSValue val = rtarray->getConcreteArray()->valueAt(exec, i);
                     UString ustring = val.toString(exec);
-                    QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size());
+                    QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size());
 
                     result.append(qstring);
                 }
@@ -418,7 +418,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
                 for (int i = 0; i < len; ++i) {
                     JSValue val = array->get(exec, i);
                     UString ustring = val.toString(exec);
-                    QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size());
+                    QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size());
 
                     result.append(qstring);
                 }
@@ -427,7 +427,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
             } else {
                 // Make a single length array
                 UString ustring = value.toString(exec);
-                QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size());
+                QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size());
                 QStringList result;
                 result.append(qstring);
                 ret = QVariant(result);
@@ -443,7 +443,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
                 dist = 0;
             } else {
                 UString ustring = value.toString(exec);
-                ret = QVariant(QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()).toLatin1());
+                ret = QVariant(QString((const QChar*)ustring.rep()->data(), ustring.size()).toLatin1());
                 if (type == String)
                     dist = 5;
                 else
@@ -485,7 +485,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
                 }
             } else if (type == String) {
                 UString ustring = value.toString(exec);
-                QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size());
+                QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size());
 
                 if (hint == QMetaType::QDateTime) {
                     QDateTime dt = QDateTime::fromString(qstring, Qt::ISODate);
@@ -534,7 +534,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
 */
                 // Attempt to convert.. a bit risky
                 UString ustring = value.toString(exec);
-                QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size());
+                QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size());
 
                 // this is of the form '/xxxxxx/i'
                 int firstSlash = qstring.indexOf(QLatin1Char('/'));
@@ -554,7 +554,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
                 }
             } else if (type == String) {
                 UString ustring = value.toString(exec);
-                QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size());
+                QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size());
 
                 QRegExp re(qstring);
                 if (re.isValid()) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list