| 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 25a282a876770d37c1db07e879c9b56e9f92bc47..d833cf38afc67928b282e188d9f1a499bbda6e5f 100644
|
| --- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
|
| +++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
|
| @@ -83,31 +83,6 @@
|
| FileReaderLoader m_loader;
|
| };
|
|
|
| -class DocumentWebSocketChannel::Message : public GarbageCollectedFinalized<DocumentWebSocketChannel::Message> {
|
| -public:
|
| - explicit Message(const CString&);
|
| - explicit Message(PassRefPtr<BlobDataHandle>);
|
| - explicit Message(DOMArrayBuffer*);
|
| - // For WorkerWebSocketChannel
|
| - explicit Message(PassOwnPtr<Vector<char>>, MessageType);
|
| - // Close message
|
| - Message(unsigned short code, const String& reason);
|
| -
|
| - DEFINE_INLINE_TRACE()
|
| - {
|
| - visitor->trace(arrayBuffer);
|
| - }
|
| -
|
| - MessageType type;
|
| -
|
| - CString text;
|
| - RefPtr<BlobDataHandle> blobDataHandle;
|
| - Member<DOMArrayBuffer> arrayBuffer;
|
| - OwnPtr<Vector<char>> vectorData;
|
| - unsigned short code;
|
| - String reason;
|
| -};
|
| -
|
| DocumentWebSocketChannel::BlobLoader::BlobLoader(PassRefPtr<BlobDataHandle> blobDataHandle, DocumentWebSocketChannel* channel)
|
| : m_channel(channel)
|
| , m_loader(FileReaderLoader::ReadAsArrayBuffer, this)
|
| @@ -197,7 +172,7 @@
|
| // FIXME: Change the inspector API to show the entire message instead
|
| // of individual frames.
|
| InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier, WebSocketFrame::OpCodeText, true, message.data(), message.length());
|
| - m_messages.append(new Message(message));
|
| + m_messages.append(adoptPtr(new Message(message)));
|
| processSendQueue();
|
| }
|
|
|
| @@ -210,7 +185,7 @@
|
| // Since Binary data are not displayed in Inspector, this does not
|
| // affect actual behavior.
|
| InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier, WebSocketFrame::OpCodeBinary, true, "", 0);
|
| - m_messages.append(new Message(blobDataHandle));
|
| + m_messages.append(adoptPtr(new Message(blobDataHandle)));
|
| processSendQueue();
|
| }
|
|
|
| @@ -223,7 +198,7 @@
|
| // buffer.slice copies its contents.
|
| // FIXME: Reduce copy by sending the data immediately when we don't need to
|
| // queue the data.
|
| - m_messages.append(new Message(buffer.slice(byteOffset, byteOffset + byteLength)));
|
| + m_messages.append(adoptPtr(new Message(buffer.slice(byteOffset, byteOffset + byteLength))));
|
| processSendQueue();
|
| }
|
|
|
| @@ -233,7 +208,7 @@
|
| // FIXME: Change the inspector API to show the entire message instead
|
| // of individual frames.
|
| InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier, WebSocketFrame::OpCodeText, true, data->data(), data->size());
|
| - m_messages.append(new Message(data, MessageTypeTextAsCharVector));
|
| + m_messages.append(adoptPtr(new Message(data, MessageTypeTextAsCharVector)));
|
| processSendQueue();
|
| }
|
|
|
| @@ -243,7 +218,7 @@
|
| // FIXME: Change the inspector API to show the entire message instead
|
| // of individual frames.
|
| InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier, WebSocketFrame::OpCodeBinary, true, data->data(), data->size());
|
| - m_messages.append(new Message(data, MessageTypeBinaryAsCharVector));
|
| + m_messages.append(adoptPtr(new Message(data, MessageTypeBinaryAsCharVector)));
|
| processSendQueue();
|
| }
|
|
|
| @@ -252,7 +227,7 @@
|
| WTF_LOG(Network, "DocumentWebSocketChannel %p close(%d, %s)", this, code, reason.utf8().data());
|
| ASSERT(m_handle);
|
| unsigned short codeToSend = static_cast<unsigned short>(code == CloseEventCodeNotSpecified ? CloseEventCodeNoStatusRcvd : code);
|
| - m_messages.append(new Message(codeToSend, reason));
|
| + m_messages.append(adoptPtr(new Message(codeToSend, reason)));
|
| processSendQueue();
|
| }
|
|
|
| @@ -294,7 +269,7 @@
|
| : type(MessageTypeBlob)
|
| , blobDataHandle(blobDataHandle) { }
|
|
|
| -DocumentWebSocketChannel::Message::Message(DOMArrayBuffer* arrayBuffer)
|
| +DocumentWebSocketChannel::Message::Message(PassRefPtr<DOMArrayBuffer> arrayBuffer)
|
| : type(MessageTypeArrayBuffer)
|
| , arrayBuffer(arrayBuffer) { }
|
|
|
| @@ -554,14 +529,14 @@
|
| m_client->didStartClosingHandshake();
|
| }
|
|
|
| -void DocumentWebSocketChannel::didFinishLoadingBlob(DOMArrayBuffer* buffer)
|
| +void DocumentWebSocketChannel::didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer> buffer)
|
| {
|
| m_blobLoader.clear();
|
| ASSERT(m_handle);
|
| // The loaded blob is always placed on m_messages[0].
|
| ASSERT(m_messages.size() > 0 && m_messages.first()->type == MessageTypeBlob);
|
| // We replace it with the loaded blob.
|
| - m_messages.first() = new Message(buffer);
|
| + m_messages.first() = adoptPtr(new Message(buffer));
|
| processSendQueue();
|
| }
|
|
|
| @@ -580,7 +555,6 @@
|
| DEFINE_TRACE(DocumentWebSocketChannel)
|
| {
|
| visitor->trace(m_blobLoader);
|
| - visitor->trace(m_messages);
|
| visitor->trace(m_client);
|
| WebSocketChannel::trace(visitor);
|
| ContextLifecycleObserver::trace(visitor);
|
|
|