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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 void DOMWebSocket::DidReceiveBinaryMessage( | 708 void DOMWebSocket::DidReceiveBinaryMessage( |
709 std::unique_ptr<Vector<char>> binary_data) { | 709 std::unique_ptr<Vector<char>> binary_data) { |
710 NETWORK_DVLOG(1) << "WebSocket " << this << " didReceiveBinaryMessage() " | 710 NETWORK_DVLOG(1) << "WebSocket " << this << " didReceiveBinaryMessage() " |
711 << binary_data->size() << " byte binary message"; | 711 << binary_data->size() << " byte binary message"; |
712 switch (binary_type_) { | 712 switch (binary_type_) { |
713 case kBinaryTypeBlob: { | 713 case kBinaryTypeBlob: { |
714 size_t size = binary_data->size(); | 714 size_t size = binary_data->size(); |
715 RefPtr<RawData> raw_data = RawData::Create(); | 715 RefPtr<RawData> raw_data = RawData::Create(); |
716 binary_data->swap(*raw_data->MutableData()); | 716 binary_data->swap(*raw_data->MutableData()); |
717 std::unique_ptr<BlobData> blob_data = BlobData::Create(); | 717 std::unique_ptr<BlobData> blob_data = BlobData::Create(); |
718 blob_data->AppendData(raw_data.Release(), 0, BlobDataItem::kToEndOfFile); | 718 blob_data->AppendData(std::move(raw_data), 0, BlobDataItem::kToEndOfFile); |
719 Blob* blob = | 719 Blob* blob = |
720 Blob::Create(BlobDataHandle::Create(std::move(blob_data), size)); | 720 Blob::Create(BlobDataHandle::Create(std::move(blob_data), size)); |
721 RecordReceiveTypeHistogram(kWebSocketReceiveTypeBlob); | 721 RecordReceiveTypeHistogram(kWebSocketReceiveTypeBlob); |
722 RecordReceiveMessageSizeHistogram(kWebSocketReceiveTypeBlob, size); | 722 RecordReceiveMessageSizeHistogram(kWebSocketReceiveTypeBlob, size); |
723 event_queue_->Dispatch( | 723 event_queue_->Dispatch( |
724 MessageEvent::Create(blob, SecurityOrigin::Create(url_)->ToString())); | 724 MessageEvent::Create(blob, SecurityOrigin::Create(url_)->ToString())); |
725 break; | 725 break; |
726 } | 726 } |
727 | 727 |
728 case kBinaryTypeArrayBuffer: | 728 case kBinaryTypeArrayBuffer: |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 | 866 |
867 DEFINE_TRACE(DOMWebSocket) { | 867 DEFINE_TRACE(DOMWebSocket) { |
868 visitor->Trace(channel_); | 868 visitor->Trace(channel_); |
869 visitor->Trace(event_queue_); | 869 visitor->Trace(event_queue_); |
870 WebSocketChannelClient::Trace(visitor); | 870 WebSocketChannelClient::Trace(visitor); |
871 EventTargetWithInlineData::Trace(visitor); | 871 EventTargetWithInlineData::Trace(visitor); |
872 SuspendableObject::Trace(visitor); | 872 SuspendableObject::Trace(visitor); |
873 } | 873 } |
874 | 874 |
875 } // namespace blink | 875 } // namespace blink |
OLD | NEW |