| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 Member<DOMArrayBuffer> arrayBuffer; | 100 Member<DOMArrayBuffer> arrayBuffer; |
| 101 std::unique_ptr<Vector<char>> vectorData; | 101 std::unique_ptr<Vector<char>> vectorData; |
| 102 unsigned short code; | 102 unsigned short code; |
| 103 String reason; | 103 String reason; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 DocumentWebSocketChannel::BlobLoader::BlobLoader(PassRefPtr<BlobDataHandle> blob
DataHandle, DocumentWebSocketChannel* channel) | 106 DocumentWebSocketChannel::BlobLoader::BlobLoader(PassRefPtr<BlobDataHandle> blob
DataHandle, DocumentWebSocketChannel* channel) |
| 107 : m_channel(channel) | 107 : m_channel(channel) |
| 108 , m_loader(FileReaderLoader::create(FileReaderLoader::ReadAsArrayBuffer, thi
s)) | 108 , m_loader(FileReaderLoader::create(FileReaderLoader::ReadAsArrayBuffer, thi
s)) |
| 109 { | 109 { |
| 110 m_loader->start(channel->getExecutionContext(), blobDataHandle); | 110 m_loader->start(channel->getExecutionContext(), std::move(blobDataHandle)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void DocumentWebSocketChannel::BlobLoader::cancel() | 113 void DocumentWebSocketChannel::BlobLoader::cancel() |
| 114 { | 114 { |
| 115 m_loader->cancel(); | 115 m_loader->cancel(); |
| 116 // didFail will be called immediately. | 116 // didFail will be called immediately. |
| 117 // |this| is deleted here. | 117 // |this| is deleted here. |
| 118 } | 118 } |
| 119 | 119 |
| 120 void DocumentWebSocketChannel::BlobLoader::didFinishLoading() | 120 void DocumentWebSocketChannel::BlobLoader::didFinishLoading() |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 void DocumentWebSocketChannel::send(PassRefPtr<BlobDataHandle> blobDataHandle) | 201 void DocumentWebSocketChannel::send(PassRefPtr<BlobDataHandle> blobDataHandle) |
| 202 { | 202 { |
| 203 NETWORK_DVLOG(1) << this << " sendBlob(" << blobDataHandle->uuid() << ", " <
< blobDataHandle->type() << ", " << blobDataHandle->size() << ")"; | 203 NETWORK_DVLOG(1) << this << " sendBlob(" << blobDataHandle->uuid() << ", " <
< blobDataHandle->type() << ", " << blobDataHandle->size() << ")"; |
| 204 // FIXME: Change the inspector API to show the entire message instead | 204 // FIXME: Change the inspector API to show the entire message instead |
| 205 // of individual frames. | 205 // of individual frames. |
| 206 // FIXME: We can't access the data here. | 206 // FIXME: We can't access the data here. |
| 207 // Since Binary data are not displayed in Inspector, this does not | 207 // Since Binary data are not displayed in Inspector, this does not |
| 208 // affect actual behavior. | 208 // affect actual behavior. |
| 209 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier, We
bSocketFrame::OpCodeBinary, true, "", 0); | 209 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier, We
bSocketFrame::OpCodeBinary, true, "", 0); |
| 210 m_messages.append(new Message(blobDataHandle)); | 210 m_messages.append(new Message(std::move(blobDataHandle))); |
| 211 processSendQueue(); | 211 processSendQueue(); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void DocumentWebSocketChannel::send(const DOMArrayBuffer& buffer, unsigned byteO
ffset, unsigned byteLength) | 214 void DocumentWebSocketChannel::send(const DOMArrayBuffer& buffer, unsigned byteO
ffset, unsigned byteLength) |
| 215 { | 215 { |
| 216 NETWORK_DVLOG(1) << this << " sendArrayBuffer(" << buffer.data() << ", " <<
byteOffset << ", " << byteLength << ")"; | 216 NETWORK_DVLOG(1) << this << " sendArrayBuffer(" << buffer.data() << ", " <<
byteOffset << ", " << byteLength << ")"; |
| 217 // FIXME: Change the inspector API to show the entire message instead | 217 // FIXME: Change the inspector API to show the entire message instead |
| 218 // of individual frames. | 218 // of individual frames. |
| 219 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier, We
bSocketFrame::OpCodeBinary, true, static_cast<const char*>(buffer.data()) + byte
Offset, byteLength); | 219 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier, We
bSocketFrame::OpCodeBinary, true, static_cast<const char*>(buffer.data()) + byte
Offset, byteLength); |
| 220 // buffer.slice copies its contents. | 220 // buffer.slice copies its contents. |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 WebSocketChannel::trace(visitor); | 582 WebSocketChannel::trace(visitor); |
| 583 ContextLifecycleObserver::trace(visitor); | 583 ContextLifecycleObserver::trace(visitor); |
| 584 } | 584 } |
| 585 | 585 |
| 586 std::ostream& operator<<(std::ostream& ostream, const DocumentWebSocketChannel*
channel) | 586 std::ostream& operator<<(std::ostream& ostream, const DocumentWebSocketChannel*
channel) |
| 587 { | 587 { |
| 588 return ostream << "DocumentWebSocketChannel " << static_cast<const void*>(ch
annel); | 588 return ostream << "DocumentWebSocketChannel " << static_cast<const void*>(ch
annel); |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace blink | 591 } // namespace blink |
| OLD | NEW |