Index: trunk/Source/web/WebSocketImpl.cpp |
=================================================================== |
--- trunk/Source/web/WebSocketImpl.cpp (revision 176310) |
+++ trunk/Source/web/WebSocketImpl.cpp (working copy) |
@@ -42,7 +42,6 @@ |
#include "public/platform/WebURL.h" |
#include "public/web/WebDocument.h" |
#include "wtf/ArrayBuffer.h" |
-#include "wtf/text/CString.h" |
#include "wtf/text/WTFString.h" |
using namespace WebCore; |
@@ -52,7 +51,6 @@ |
WebSocketImpl::WebSocketImpl(const WebDocument& document, WebSocketClient* client) |
: m_client(client) |
, m_binaryType(BinaryTypeBlob) |
- , m_bufferedAmount(0) |
{ |
RefPtrWillBeRawPtr<Document> coreDocument = PassRefPtrWillBeRawPtr<Document>(document); |
if (RuntimeEnabledFeatures::experimentalWebSocketEnabled()) { |
@@ -97,19 +95,17 @@ |
bool WebSocketImpl::sendText(const WebString& message) |
{ |
- m_bufferedAmount += message.utf8().length(); |
return m_private->send(message) == WebSocketChannel::SendSuccess; |
} |
bool WebSocketImpl::sendArrayBuffer(const WebArrayBuffer& webArrayBuffer) |
{ |
- m_bufferedAmount += webArrayBuffer.byteLength(); |
return m_private->send(*PassRefPtr<ArrayBuffer>(webArrayBuffer), 0, webArrayBuffer.byteLength()) == WebSocketChannel::SendSuccess; |
} |
unsigned long WebSocketImpl::bufferedAmount() const |
{ |
- return m_bufferedAmount; |
+ return m_private->bufferedAmount(); |
} |
void WebSocketImpl::close(int code, const WebString& reason) |
@@ -157,9 +153,9 @@ |
m_client->didReceiveMessageError(); |
} |
-void WebSocketImpl::didConsumeBufferedAmount(unsigned long consumed) |
+void WebSocketImpl::didUpdateBufferedAmount(unsigned long bufferedAmount) |
{ |
- m_bufferedAmount -= consumed; |
+ m_client->didUpdateBufferedAmount(bufferedAmount); |
} |
void WebSocketImpl::didStartClosingHandshake() |
@@ -167,9 +163,9 @@ |
m_client->didStartClosingHandshake(); |
} |
-void WebSocketImpl::didClose(ClosingHandshakeCompletionStatus status, unsigned short code, const String& reason) |
+void WebSocketImpl::didClose(unsigned long bufferedAmount, ClosingHandshakeCompletionStatus status, unsigned short code, const String& reason) |
{ |
- m_client->didClose(m_bufferedAmount, static_cast<WebSocketClient::ClosingHandshakeCompletionStatus>(status), code, WebString(reason)); |
+ m_client->didClose(bufferedAmount, static_cast<WebSocketClient::ClosingHandshakeCompletionStatus>(status), code, WebString(reason)); |
} |
} // namespace blink |