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

yael.aharon at nokia.com yael.aharon at nokia.com
Thu Apr 8 01:37:43 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit b97c0d0e2ec90f9111d9d1f58a6dbf0e9d22e421
Author: yael.aharon at nokia.com <yael.aharon at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Feb 3 13:42:51 2010 +0000

    [Qt] WebSockets : Buffer the data in WebKit instead of QtNetwork
    https://bugs.webkit.org/show_bug.cgi?id=34425
    
    Reviewed by Kenneth Rohde Christiansen.
    
    Buffer the sent data in SocketStreamHandlePrivate instead of relying on
    the network layer to do it. This is more robust and more consistent with how
    Qt's HTTP stack works.
    Close the socket in SocketStreamHandlePrivate::close() regardless of its state.
    
    No new tests, since no new functionality is introduced.
    
    * platform/network/qt/SocketStreamHandlePrivate.h:
    * platform/network/qt/SocketStreamHandleQt.cpp:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54279 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8fa9326..c50aeb1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-02-02  Yael Aharon  <yael.aharon at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] WebSockets : Buffer the data in WebKit instead of QtNetwork
+        https://bugs.webkit.org/show_bug.cgi?id=34425
+
+        Buffer the sent data in SocketStreamHandlePrivate instead of relying on
+        the network layer to do it. This is more robust and more consistent with how 
+        Qt's HTTP stack works.
+        Close the socket in SocketStreamHandlePrivate::close() regardless of its state.
+
+        No new tests, since no new functionality is introduced.
+
+        * platform/network/qt/SocketStreamHandlePrivate.h:
+        * platform/network/qt/SocketStreamHandleQt.cpp:
+        (WebCore::SocketStreamHandlePrivate::SocketStreamHandlePrivate):
+        (WebCore::SocketStreamHandlePrivate::send):
+        (WebCore::SocketStreamHandlePrivate::close):
+        (WebCore::SocketStreamHandlePrivate::socketBytesWritten):
+
 2010-02-03  Shinichiro Hamaji  <hamaji at chromium.org>
 
         Unreviewed revert of r54259 as it seems to break chromium's unit tests.
diff --git a/WebCore/platform/network/qt/SocketStreamHandlePrivate.h b/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
index 235f1b1..db72c6c 100644
--- a/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
+++ b/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
@@ -55,6 +55,7 @@ public slots:
     int send(const char* data, int len);
     void close();
     void socketSentdata();
+    void socketBytesWritten(qint64);
     void socketClosed();
     void socketError(QAbstractSocket::SocketError);
     void socketClosedCallback();
@@ -65,6 +66,7 @@ public slots:
 public:
     QTcpSocket* m_socket;
     SocketStreamHandle* m_streamHandle;
+    QByteArray m_data;
 };
 
 }
diff --git a/WebCore/platform/network/qt/SocketStreamHandleQt.cpp b/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
index e666ff7..5c2cd0a 100644
--- a/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
+++ b/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
@@ -56,7 +56,15 @@ SocketStreamHandlePrivate::SocketStreamHandlePrivate(SocketStreamHandle* streamH
     if (!m_socket)
         return;
 
-    connect(m_socket, SIGNAL(connected()), this, SLOT(socketConnected()));
+    if (isSecure) {
+#ifndef QT_NO_OPENSSL
+        connect(m_socket, SIGNAL(encrypted()), this, SLOT(socketConnected()));
+        connect(m_socket, SIGNAL(encryptedBytesWritten(qint64)), this, SLOT(socketBytesWritten(qint64)));
+#endif
+    } else {
+        connect(m_socket, SIGNAL(connected()), this, SLOT(socketConnected()));
+        connect(m_socket, SIGNAL(bytesWritten(qint64)), this, SLOT(socketBytesWritten(qint64)));
+    }
     connect(m_socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead()));
     connect(m_socket, SIGNAL(disconnected()), this, SLOT(socketClosed()));
     connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
@@ -99,14 +107,17 @@ int SocketStreamHandlePrivate::send(const char* data, int len)
 {
     if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState)
         return 0;
-    quint64 sentSize = m_socket->write(data, len);
-    QMetaObject::invokeMethod(this, "socketSentData", Qt::QueuedConnection);
-    return sentSize;
+    // If we are already sending something, then m_data is not empty.
+    bool sending = m_data.length() > 0;
+    m_data.append(data, len);
+    if (!sending)
+        m_socket->write(m_data);
+    return len;
 }
 
 void SocketStreamHandlePrivate::close()
 {
-    if (m_socket && m_socket->state() == QAbstractSocket::ConnectedState)
+    if (m_socket)
         m_socket->close();
 }
 
@@ -116,6 +127,18 @@ void SocketStreamHandlePrivate::socketSentdata()
         m_streamHandle->sendPendingData();
 }
 
+void SocketStreamHandlePrivate::socketBytesWritten(qint64 written)
+{
+    if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState || written < 0)
+        return;
+    m_data.remove(0, written);
+    // If we are done sending all the data, then m_data is now empty
+    if (m_data.isEmpty())
+        QMetaObject::invokeMethod(this, "socketSentdata", Qt::QueuedConnection);
+    else
+        m_socket->write(m_data);
+}
+
 void SocketStreamHandlePrivate::socketClosed()
 {
     QMetaObject::invokeMethod(this, "socketClosedCallback", Qt::QueuedConnection);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list