| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 void DOMWebSocket::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> binaryData) | 639 void DOMWebSocket::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> binaryData) |
| 640 { | 640 { |
| 641 WTF_LOG(Network, "WebSocket %p didReceiveBinaryMessage() %lu byte binary mes
sage", this, static_cast<unsigned long>(binaryData->size())); | 641 WTF_LOG(Network, "WebSocket %p didReceiveBinaryMessage() %lu byte binary mes
sage", this, static_cast<unsigned long>(binaryData->size())); |
| 642 switch (m_binaryType) { | 642 switch (m_binaryType) { |
| 643 case BinaryTypeBlob: { | 643 case BinaryTypeBlob: { |
| 644 size_t size = binaryData->size(); | 644 size_t size = binaryData->size(); |
| 645 RefPtr<RawData> rawData = RawData::create(); | 645 RefPtr<RawData> rawData = RawData::create(); |
| 646 binaryData->swap(*rawData->mutableData()); | 646 binaryData->swap(*rawData->mutableData()); |
| 647 OwnPtr<BlobData> blobData = BlobData::create(); | 647 OwnPtr<BlobData> blobData = BlobData::create(); |
| 648 blobData->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile); | 648 blobData->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile); |
| 649 Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), siz
e)); | 649 Blob* blob = Blob::create(BlobDataHandle::create(std::move(blobData), si
ze)); |
| 650 recordReceiveTypeHistogram(WebSocketReceiveTypeBlob); | 650 recordReceiveTypeHistogram(WebSocketReceiveTypeBlob); |
| 651 m_eventQueue->dispatch(MessageEvent::create(blob, SecurityOrigin::create
(m_url)->toString())); | 651 m_eventQueue->dispatch(MessageEvent::create(blob, SecurityOrigin::create
(m_url)->toString())); |
| 652 break; | 652 break; |
| 653 } | 653 } |
| 654 | 654 |
| 655 case BinaryTypeArrayBuffer: | 655 case BinaryTypeArrayBuffer: |
| 656 DOMArrayBuffer* arrayBuffer = DOMArrayBuffer::create(binaryData->data(),
binaryData->size()); | 656 DOMArrayBuffer* arrayBuffer = DOMArrayBuffer::create(binaryData->data(),
binaryData->size()); |
| 657 recordReceiveTypeHistogram(WebSocketReceiveTypeArrayBuffer); | 657 recordReceiveTypeHistogram(WebSocketReceiveTypeArrayBuffer); |
| 658 m_eventQueue->dispatch(MessageEvent::create(arrayBuffer, SecurityOrigin:
:create(m_url)->toString())); | 658 m_eventQueue->dispatch(MessageEvent::create(arrayBuffer, SecurityOrigin:
:create(m_url)->toString())); |
| 659 break; | 659 break; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 DEFINE_TRACE(DOMWebSocket) | 714 DEFINE_TRACE(DOMWebSocket) |
| 715 { | 715 { |
| 716 visitor->trace(m_channel); | 716 visitor->trace(m_channel); |
| 717 visitor->trace(m_eventQueue); | 717 visitor->trace(m_eventQueue); |
| 718 WebSocketChannelClient::trace(visitor); | 718 WebSocketChannelClient::trace(visitor); |
| 719 EventTargetWithInlineData::trace(visitor); | 719 EventTargetWithInlineData::trace(visitor); |
| 720 ActiveDOMObject::trace(visitor); | 720 ActiveDOMObject::trace(visitor); |
| 721 } | 721 } |
| 722 | 722 |
| 723 } // namespace blink | 723 } // namespace blink |
| OLD | NEW |