| Index: Source/modules/websockets/NewWebSocketChannelImpl.cpp
|
| diff --git a/Source/modules/websockets/NewWebSocketChannelImpl.cpp b/Source/modules/websockets/NewWebSocketChannelImpl.cpp
|
| index 7b056012a46a1b31e2b628f282b8c0e9336ebfc1..22331beed8a198d1ffb979bf5b71adce8fb812f1 100644
|
| --- a/Source/modules/websockets/NewWebSocketChannelImpl.cpp
|
| +++ b/Source/modules/websockets/NewWebSocketChannelImpl.cpp
|
| @@ -191,6 +191,8 @@ WebSocketChannel::SendResult NewWebSocketChannelImpl::send(const String& message
|
| CString data = message.utf8();
|
| InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier, WebSocketFrame::OpCodeText, true, data.data(), data.length());
|
| }
|
| + if (m_client)
|
| + m_client->didIncreaseBufferedAmount(message.utf8().length());
|
| m_messages.append(adoptPtr(new Message(message)));
|
| sendInternal();
|
| return SendSuccess;
|
| @@ -207,6 +209,8 @@ WebSocketChannel::SendResult NewWebSocketChannelImpl::send(PassRefPtr<BlobDataHa
|
| // affect actual behavior.
|
| InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier, WebSocketFrame::OpCodeBinary, true, "", 0);
|
| }
|
| + if (m_client)
|
| + m_client->didIncreaseBufferedAmount(blobDataHandle->size());
|
| m_messages.append(adoptPtr(new Message(blobDataHandle)));
|
| sendInternal();
|
| return SendSuccess;
|
| @@ -220,6 +224,8 @@ WebSocketChannel::SendResult NewWebSocketChannelImpl::send(const ArrayBuffer& bu
|
| // of individual frames.
|
| InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier, WebSocketFrame::OpCodeBinary, true, static_cast<const char*>(buffer.data()) + byteOffset, byteLength);
|
| }
|
| + if (m_client)
|
| + m_client->didIncreaseBufferedAmount(byteLength);
|
| // buffer.slice copies its contents.
|
| // FIXME: Reduce copy by sending the data immediately when we don't need to
|
| // queue the data.
|
| @@ -317,7 +323,7 @@ NewWebSocketChannelImpl::Message::Message(PassOwnPtr<Vector<char> > vectorData)
|
| void NewWebSocketChannelImpl::sendInternal()
|
| {
|
| ASSERT(m_handle);
|
| - unsigned long bufferedAmount = m_bufferedAmount;
|
| + int64_t quota = m_sendingQuota;
|
| while (!m_messages.isEmpty() && m_sendingQuota > 0 && !m_blobLoader) {
|
| bool final = false;
|
| Message* message = m_messages.first().get();
|
| @@ -362,8 +368,9 @@ void NewWebSocketChannelImpl::sendInternal()
|
| m_sentSizeOfTopMessage = 0;
|
| }
|
| }
|
| - if (m_client && m_bufferedAmount != bufferedAmount) {
|
| - m_client->didUpdateBufferedAmount(m_bufferedAmount);
|
| + if (m_client && quota != m_sendingQuota) {
|
| + unsigned long diff = quota - m_sendingQuota;
|
| + m_client->didDecreaseBufferedAmount(diff);
|
| }
|
| }
|
|
|
|
|