Changeset 54298 in webkit


Ignore:
Timestamp:
Feb 3, 2010 2:00:21 PM (14 years ago)
Author:
yael.aharon@nokia.com
Message:

[Qt] WebSockets : Buffer the data in WebKit instead of QtNetwork
https://bugs.webkit.org/show_bug.cgi?id=34425

Reviewed by Kenneth Rohde Christiansen.

Reverting r54279, it was a misunderstanding.

  • platform/network/qt/SocketStreamHandlePrivate.h:
  • platform/network/qt/SocketStreamHandleQt.cpp:
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r54292 r54298  
     12010-02-03  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] WebSockets : Buffer the data in WebKit instead of QtNetwork
     6        https://bugs.webkit.org/show_bug.cgi?id=34425
     7
     8        Reverting r54279, it was a misunderstanding.
     9
     10        * platform/network/qt/SocketStreamHandlePrivate.h:
     11        * platform/network/qt/SocketStreamHandleQt.cpp:
     12        (WebCore::SocketStreamHandlePrivate::SocketStreamHandlePrivate):
     13        (WebCore::SocketStreamHandlePrivate::send):
     14        (WebCore::SocketStreamHandlePrivate::close):
     15
    1162010-02-03  Drew Wilson  <atwilson@chromium.org>
    217
  • trunk/WebCore/platform/network/qt/SocketStreamHandlePrivate.h

    r54279 r54298  
    5656    void close();
    5757    void socketSentdata();
    58     void socketBytesWritten(qint64);
    5958    void socketClosed();
    6059    void socketError(QAbstractSocket::SocketError);
     
    6766    QTcpSocket* m_socket;
    6867    SocketStreamHandle* m_streamHandle;
    69     QByteArray m_data;
    7068};
    7169
  • trunk/WebCore/platform/network/qt/SocketStreamHandleQt.cpp

    r54279 r54298  
    5757        return;
    5858
    59     if (isSecure) {
    60 #ifndef QT_NO_OPENSSL
    61         connect(m_socket, SIGNAL(encrypted()), this, SLOT(socketConnected()));
    62         connect(m_socket, SIGNAL(encryptedBytesWritten(qint64)), this, SLOT(socketBytesWritten(qint64)));
    63 #endif
    64     } else {
    65         connect(m_socket, SIGNAL(connected()), this, SLOT(socketConnected()));
    66         connect(m_socket, SIGNAL(bytesWritten(qint64)), this, SLOT(socketBytesWritten(qint64)));
    67     }
     59    connect(m_socket, SIGNAL(connected()), this, SLOT(socketConnected()));
    6860    connect(m_socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead()));
    6961    connect(m_socket, SIGNAL(disconnected()), this, SLOT(socketClosed()));
     
    108100    if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState)
    109101        return 0;
    110     // If we are already sending something, then m_data is not empty.
    111     bool sending = m_data.length() > 0;
    112     m_data.append(data, len);
    113     if (!sending)
    114         m_socket->write(m_data);
    115     return len;
     102    quint64 sentSize = m_socket->write(data, len);
     103    QMetaObject::invokeMethod(this, "socketSentData", Qt::QueuedConnection);
     104    return sentSize;
    116105}
    117106
    118107void SocketStreamHandlePrivate::close()
    119108{
    120     if (m_socket)
     109    if (m_socket && m_socket->state() == QAbstractSocket::ConnectedState)
    121110        m_socket->close();
    122111}
     
    126115    if (m_streamHandle)
    127116        m_streamHandle->sendPendingData();
    128 }
    129 
    130 void SocketStreamHandlePrivate::socketBytesWritten(qint64 written)
    131 {
    132     if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState || written < 0)
    133         return;
    134     m_data.remove(0, written);
    135     // If we are done sending all the data, then m_data is now empty
    136     if (m_data.isEmpty())
    137         QMetaObject::invokeMethod(this, "socketSentdata", Qt::QueuedConnection);
    138     else
    139         m_socket->write(m_data);
    140117}
    141118
Note: See TracChangeset for help on using the changeset viewer.