| Index: third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
|
| diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
|
| index 797dab0005f0d01223e335dbcce54a896c9580de..599772e902b4fa5493bb3fde8a3b14ddca6f8621 100644
|
| --- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
|
| +++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
|
| @@ -55,6 +55,7 @@
|
| #include "public/platform/WebVector.h"
|
| #include "public/platform/modules/websockets/WebSocketHandshakeRequestInfo.h"
|
| #include "public/platform/modules/websockets/WebSocketHandshakeResponseInfo.h"
|
| +#include <inttypes.h>
|
|
|
| using blink::WebSocketHandle;
|
|
|
| @@ -231,6 +232,21 @@ void DocumentWebSocketChannel::close(int code, const String& reason)
|
| processSendQueue();
|
| }
|
|
|
| +static WebSocketHandle::BinaryType toHandleBinaryType(DocumentWebSocketChannel::BinaryType binaryType)
|
| +{
|
| + static_assert(static_cast<WebSocketHandle::BinaryType>(DocumentWebSocketChannel::BinaryTypeBlob) == WebSocketHandle::BinaryTypeBlob, "enums must match");
|
| + static_assert(static_cast<WebSocketHandle::BinaryType>(DocumentWebSocketChannel::BinaryTypeArrayBuffer) == WebSocketHandle::BinaryTypeArrayBuffer, "enums must match");
|
| + ASSERT(binaryType == DocumentWebSocketChannel::BinaryTypeBlob || binaryType == DocumentWebSocketChannel::BinaryTypeArrayBuffer);
|
| + return static_cast<WebSocketHandle::BinaryType>(binaryType);
|
| +}
|
| +
|
| +void DocumentWebSocketChannel::changeBinaryType(BinaryType newBinaryType)
|
| +{
|
| + WTF_LOG(Network, "DocumentWebSocketChannel %p changeBinaryType(%d)", this, newBinaryType);
|
| + ASSERT(m_handle);
|
| + m_handle->changeBinaryType(toHandleBinaryType(newBinaryType));
|
| +}
|
| +
|
| void DocumentWebSocketChannel::fail(const String& reason, MessageLevel level, const String& sourceURL, unsigned lineNumber)
|
| {
|
| WTF_LOG(Network, "DocumentWebSocketChannel %p fail(%s)", this, reason.utf8().data());
|
| @@ -483,10 +499,26 @@ void DocumentWebSocketChannel::didReceiveData(WebSocketHandle* handle, bool fin,
|
| } else {
|
| OwnPtr<Vector<char>> binaryData = adoptPtr(new Vector<char>);
|
| binaryData->swap(m_receivingMessageData);
|
| - m_client->didReceiveBinaryMessage(binaryData.release());
|
| + m_client->didReceiveArrayBuffer(binaryData.release());
|
| }
|
| }
|
|
|
| +void DocumentWebSocketChannel::didReceiveBlob(WebSocketHandle* handle,
|
| + const WebString& uuid,
|
| + uint64_t size)
|
| +{
|
| + WTF_LOG(Network, "DocumentWebSocketChannel %p didReceiveBlob(%p, %s, %" PRIu64 ")", this, handle, uuid.utf8().c_str(), size);
|
| +
|
| + ASSERT(m_handle);
|
| + ASSERT(handle == m_handle);
|
| + ASSERT(m_client);
|
| +
|
| + // FIXME: Report the Blob to InspectorInstrumentation.
|
| + RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(uuid, "", size);
|
| + handle->confirmBlob();
|
| + m_client->didReceiveBlob(blobDataHandle.release());
|
| +}
|
| +
|
| void DocumentWebSocketChannel::didClose(WebSocketHandle* handle, bool wasClean, unsigned short code, const WebString& reason)
|
| {
|
| WTF_LOG(Network, "DocumentWebSocketChannel %p didClose(%p, %d, %u, %s)", this, handle, wasClean, code, String(reason).utf8().data());
|
|
|