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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(blobData.release(), siz
e)); |
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 RefPtr<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.release(), Secur
ityOrigin::create(m_url)->toString())); |
659 break; | 659 break; |
660 } | 660 } |
661 } | 661 } |
662 | 662 |
663 void DOMWebSocket::didError() | 663 void DOMWebSocket::didError() |
664 { | 664 { |
665 WTF_LOG(Network, "WebSocket %p didError()", this); | 665 WTF_LOG(Network, "WebSocket %p didError()", this); |
666 m_state = CLOSED; | 666 m_state = CLOSED; |
667 m_eventQueue->dispatch(Event::create(EventTypeNames::error)); | 667 m_eventQueue->dispatch(Event::create(EventTypeNames::error)); |
668 } | 668 } |
(...skipping 45 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 RefCountedGarbageCollectedEventTargetWithInlineData<DOMWebSocket>::trace(vis
itor); | 719 RefCountedGarbageCollectedEventTargetWithInlineData<DOMWebSocket>::trace(vis
itor); |
720 ActiveDOMObject::trace(visitor); | 720 ActiveDOMObject::trace(visitor); |
721 } | 721 } |
722 | 722 |
723 } // namespace blink | 723 } // namespace blink |
OLD | NEW |