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

Unified Diff: Source/modules/websockets/DOMWebSocket.cpp

Issue 606653006: bindings: Adds DOMArrayBuffer, etc. as thin wrappers for ArrayBuffer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 2 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 | « Source/modules/websockets/DOMWebSocket.h ('k') | Source/modules/websockets/DOMWebSocketTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/websockets/DOMWebSocket.cpp
diff --git a/Source/modules/websockets/DOMWebSocket.cpp b/Source/modules/websockets/DOMWebSocket.cpp
index 928e885eb6c832d4f91909b23dafe57518e7bbe8..4ac91877ab57d6ddc6489c4b69561437e3c8307c 100644
--- a/Source/modules/websockets/DOMWebSocket.cpp
+++ b/Source/modules/websockets/DOMWebSocket.cpp
@@ -29,11 +29,12 @@
*/
#include "config.h"
-
#include "modules/websockets/DOMWebSocket.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptController.h"
+#include "core/dom/DOMArrayBuffer.h"
+#include "core/dom/DOMArrayBufferView.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/ExecutionContext.h"
@@ -52,8 +53,6 @@
#include "platform/weborigin/KnownPorts.h"
#include "platform/weborigin/SecurityOrigin.h"
#include "public/platform/Platform.h"
-#include "wtf/ArrayBuffer.h"
-#include "wtf/ArrayBufferView.h"
#include "wtf/Assertions.h"
#include "wtf/HashSet.h"
#include "wtf/PassOwnPtr.h"
@@ -392,10 +391,10 @@ void DOMWebSocket::send(const String& message, ExceptionState& exceptionState)
m_channel->send(message);
}
-void DOMWebSocket::send(ArrayBuffer* binaryData, ExceptionState& exceptionState)
+void DOMWebSocket::send(DOMArrayBuffer* binaryData, ExceptionState& exceptionState)
{
WTF_LOG(Network, "WebSocket %p send() Sending ArrayBuffer %p", this, binaryData);
- ASSERT(binaryData);
+ ASSERT(binaryData && binaryData->buffer());
if (m_state == CONNECTING) {
setInvalidStateErrorForSendMethod(exceptionState);
return;
@@ -407,10 +406,10 @@ void DOMWebSocket::send(ArrayBuffer* binaryData, ExceptionState& exceptionState)
Platform::current()->histogramEnumeration("WebCore.WebSocket.SendType", WebSocketSendTypeArrayBuffer, WebSocketSendTypeMax);
ASSERT(m_channel);
m_bufferedAmount += binaryData->byteLength();
- m_channel->send(*binaryData, 0, binaryData->byteLength());
+ m_channel->send(*binaryData->buffer(), 0, binaryData->byteLength());
}
-void DOMWebSocket::send(ArrayBufferView* arrayBufferView, ExceptionState& exceptionState)
+void DOMWebSocket::send(DOMArrayBufferView* arrayBufferView, ExceptionState& exceptionState)
{
WTF_LOG(Network, "WebSocket %p send() Sending ArrayBufferView %p", this, arrayBufferView);
ASSERT(arrayBufferView);
@@ -425,7 +424,7 @@ void DOMWebSocket::send(ArrayBufferView* arrayBufferView, ExceptionState& except
Platform::current()->histogramEnumeration("WebCore.WebSocket.SendType", WebSocketSendTypeArrayBufferView, WebSocketSendTypeMax);
ASSERT(m_channel);
m_bufferedAmount += arrayBufferView->byteLength();
- RefPtr<ArrayBuffer> arrayBuffer(arrayBufferView->buffer());
+ RefPtr<ArrayBuffer> arrayBuffer(arrayBufferView->view()->buffer());
m_channel->send(*arrayBuffer, arrayBufferView->byteOffset(), arrayBufferView->byteLength());
}
@@ -623,7 +622,7 @@ void DOMWebSocket::didReceiveBinaryMessage(PassOwnPtr<Vector<char> > binaryData)
}
case BinaryTypeArrayBuffer:
- RefPtr<ArrayBuffer> arrayBuffer = ArrayBuffer::create(binaryData->data(), binaryData->size());
+ RefPtr<DOMArrayBuffer> arrayBuffer = DOMArrayBuffer::create(binaryData->data(), binaryData->size());
if (!arrayBuffer) {
// Failed to allocate an ArrayBuffer. We need to crash the renderer
// since there's no way defined in the spec to tell this to the
« no previous file with comments | « Source/modules/websockets/DOMWebSocket.h ('k') | Source/modules/websockets/DOMWebSocketTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698