| 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 binaryData->swap(*rawData->mutableData()); | 631 binaryData->swap(*rawData->mutableData()); |
| 632 OwnPtr<BlobData> blobData = BlobData::create(); | 632 OwnPtr<BlobData> blobData = BlobData::create(); |
| 633 blobData->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile); | 633 blobData->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile); |
| 634 Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), siz
e)); | 634 Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), siz
e)); |
| 635 Platform::current()->histogramEnumeration("WebCore.WebSocket.ReceiveType
", WebSocketReceiveTypeBlob, WebSocketReceiveTypeMax); | 635 Platform::current()->histogramEnumeration("WebCore.WebSocket.ReceiveType
", WebSocketReceiveTypeBlob, WebSocketReceiveTypeMax); |
| 636 m_eventQueue->dispatch(MessageEvent::create(blob, SecurityOrigin::create
(m_url)->toString())); | 636 m_eventQueue->dispatch(MessageEvent::create(blob, SecurityOrigin::create
(m_url)->toString())); |
| 637 break; | 637 break; |
| 638 } | 638 } |
| 639 | 639 |
| 640 case BinaryTypeArrayBuffer: | 640 case BinaryTypeArrayBuffer: |
| 641 RefPtr<DOMArrayBuffer> arrayBuffer = DOMArrayBuffer::create(binaryData->
data(), binaryData->size()); | 641 // TODO(junov): crbug.com/536816 |
| 642 // Avoid crashing when out of memory by using createOrNull(). Requires |
| 643 // determining appropriate alternate behavior for dealing with allocatio
n |
| 644 // failures. Should the event be dropped? Should we dispatch an event |
| 645 // with null data? Should we dispatch some kind of failure code? |
| 646 RefPtr<DOMArrayBuffer> arrayBuffer = DOMArrayBuffer::deprecatedCreateOrC
rash(binaryData->data(), binaryData->size()); |
| 642 Platform::current()->histogramEnumeration("WebCore.WebSocket.ReceiveType
", WebSocketReceiveTypeArrayBuffer, WebSocketReceiveTypeMax); | 647 Platform::current()->histogramEnumeration("WebCore.WebSocket.ReceiveType
", WebSocketReceiveTypeArrayBuffer, WebSocketReceiveTypeMax); |
| 643 m_eventQueue->dispatch(MessageEvent::create(arrayBuffer.release(), Secur
ityOrigin::create(m_url)->toString())); | 648 m_eventQueue->dispatch(MessageEvent::create(arrayBuffer.release(), Secur
ityOrigin::create(m_url)->toString())); |
| 644 break; | 649 break; |
| 645 } | 650 } |
| 646 } | 651 } |
| 647 | 652 |
| 648 void DOMWebSocket::didError() | 653 void DOMWebSocket::didError() |
| 649 { | 654 { |
| 650 WTF_LOG(Network, "WebSocket %p didError()", this); | 655 WTF_LOG(Network, "WebSocket %p didError()", this); |
| 651 m_state = CLOSED; | 656 m_state = CLOSED; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 DEFINE_TRACE(DOMWebSocket) | 692 DEFINE_TRACE(DOMWebSocket) |
| 688 { | 693 { |
| 689 visitor->trace(m_channel); | 694 visitor->trace(m_channel); |
| 690 visitor->trace(m_eventQueue); | 695 visitor->trace(m_eventQueue); |
| 691 WebSocketChannelClient::trace(visitor); | 696 WebSocketChannelClient::trace(visitor); |
| 692 RefCountedGarbageCollectedEventTargetWithInlineData<DOMWebSocket>::trace(vis
itor); | 697 RefCountedGarbageCollectedEventTargetWithInlineData<DOMWebSocket>::trace(vis
itor); |
| 693 ActiveDOMObject::trace(visitor); | 698 ActiveDOMObject::trace(visitor); |
| 694 } | 699 } |
| 695 | 700 |
| 696 } // namespace blink | 701 } // namespace blink |
| OLD | NEW |