Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Unified Diff: trunk/Source/web/WebSocketImpl.cpp

Issue 338243006: Revert 176298 "[WebSocket] bufferedAmount should not decrease in..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/Source/web/WebSocketImpl.h ('k') | trunk/public/web/WebSocketClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « trunk/Source/web/WebSocketImpl.h ('k') | trunk/public/web/WebSocketClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698