Index: third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp |
diff --git a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp |
index 9afa15c59b902c95e6807c23ab709decc1108b27..916b3fd87a88a68e8c05f5a52de31e99c94d2837 100644 |
--- a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp |
+++ b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp |
@@ -150,6 +150,12 @@ void WorkerWebSocketChannel::close(int code, const String& reason) |
m_bridge->close(code, reason); |
} |
+void WorkerWebSocketChannel::changeBinaryType(BinaryType newBinaryType) |
+{ |
+ ASSERT(m_bridge); |
+ m_bridge->changeBinaryType(newBinaryType); |
+} |
+ |
void WorkerWebSocketChannel::fail(const String& reason, MessageLevel level, const String& sourceURL, unsigned lineNumber) |
{ |
if (!m_bridge) |
@@ -248,6 +254,13 @@ void Peer::close(int code, const String& reason) |
m_mainWebSocketChannel->close(code, reason); |
} |
+void Peer::changeBinaryType(BinaryType newBinaryType) |
+{ |
+ ASSERT(isMainThread()); |
+ if (m_mainWebSocketChannel) |
+ m_mainWebSocketChannel->changeBinaryType(newBinaryType); |
+} |
+ |
void Peer::fail(const String& reason, MessageLevel level, const String& sourceURL, unsigned lineNumber) |
{ |
ASSERT(isMainThread()); |
@@ -294,17 +307,30 @@ void Peer::didReceiveTextMessage(const String& payload) |
m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlobalScopeDidReceiveTextMessage, m_bridge, payload)); |
} |
-static void workerGlobalScopeDidReceiveBinaryMessage(Bridge* bridge, PassOwnPtr<Vector<char>> payload, ExecutionContext* context) |
+static void workerGlobalScopeDidReceiveArrayBuffer(Bridge* bridge, PassOwnPtr<Vector<char>> payload, ExecutionContext* context) |
+{ |
+ ASSERT_UNUSED(context, context->isWorkerGlobalScope()); |
+ if (bridge->client()) |
+ bridge->client()->didReceiveArrayBuffer(payload); |
+} |
+ |
+void Peer::didReceiveArrayBuffer(PassOwnPtr<Vector<char>> payload) |
+{ |
+ ASSERT(isMainThread()); |
+ m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlobalScopeDidReceiveArrayBuffer, m_bridge, payload)); |
+} |
+ |
+static void workerGlobalScopeDidReceiveBlob(Bridge* bridge, PassRefPtr<blink::BlobDataHandle> blobDataHandle, ExecutionContext* context) |
{ |
ASSERT_UNUSED(context, context->isWorkerGlobalScope()); |
if (bridge->client()) |
- bridge->client()->didReceiveBinaryMessage(payload); |
+ bridge->client()->didReceiveBlob(blobDataHandle); |
} |
-void Peer::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload) |
+void Peer::didReceiveBlob(PassRefPtr<blink::BlobDataHandle> blobDataHandle) |
{ |
ASSERT(isMainThread()); |
- m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlobalScopeDidReceiveBinaryMessage, m_bridge, payload)); |
+ m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlobalScopeDidReceiveBlob, m_bridge, blobDataHandle)); |
} |
static void workerGlobalScopeDidConsumeBufferedAmount(Bridge* bridge, uint64_t consumed, ExecutionContext* context) |
@@ -437,6 +463,12 @@ void Bridge::close(int code, const String& reason) |
m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::close, m_peer.get(), code, reason)); |
} |
+void Bridge::changeBinaryType(BinaryType newBinaryType) |
+{ |
+ ASSERT(m_peer); |
+ m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::changeBinaryType, m_peer.get(), newBinaryType)); |
+} |
+ |
void Bridge::fail(const String& reason, MessageLevel level, const String& sourceURL, unsigned lineNumber) |
{ |
ASSERT(m_peer); |