| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/presentation/PresentationConnection.h" | 5 #include "modules/presentation/PresentationConnection.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "core/dom/DOMArrayBuffer.h" | 8 #include "core/dom/DOMArrayBuffer.h" |
| 9 #include "core/dom/DOMArrayBufferView.h" | 9 #include "core/dom/DOMArrayBufferView.h" |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 350 |
| 351 void PresentationConnection::didReceiveBinaryMessage(const uint8_t* data, size_t
length) | 351 void PresentationConnection::didReceiveBinaryMessage(const uint8_t* data, size_t
length) |
| 352 { | 352 { |
| 353 if (m_state != WebPresentationConnectionState::Connected) | 353 if (m_state != WebPresentationConnectionState::Connected) |
| 354 return; | 354 return; |
| 355 | 355 |
| 356 switch (m_binaryType) { | 356 switch (m_binaryType) { |
| 357 case BinaryTypeBlob: { | 357 case BinaryTypeBlob: { |
| 358 OwnPtr<BlobData> blobData = BlobData::create(); | 358 OwnPtr<BlobData> blobData = BlobData::create(); |
| 359 blobData->appendBytes(data, length); | 359 blobData->appendBytes(data, length); |
| 360 Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), len
gth)); | 360 Blob* blob = Blob::create(BlobDataHandle::create(std::move(blobData), le
ngth)); |
| 361 dispatchEvent(MessageEvent::create(blob)); | 361 dispatchEvent(MessageEvent::create(blob)); |
| 362 return; | 362 return; |
| 363 } | 363 } |
| 364 case BinaryTypeArrayBuffer: | 364 case BinaryTypeArrayBuffer: |
| 365 DOMArrayBuffer* buffer = DOMArrayBuffer::create(data, length); | 365 DOMArrayBuffer* buffer = DOMArrayBuffer::create(data, length); |
| 366 dispatchEvent(MessageEvent::create(buffer)); | 366 dispatchEvent(MessageEvent::create(buffer)); |
| 367 return; | 367 return; |
| 368 } | 368 } |
| 369 ASSERT_NOT_REACHED(); | 369 ASSERT_NOT_REACHED(); |
| 370 } | 370 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 { | 453 { |
| 454 // Cancel current Blob loading if any. | 454 // Cancel current Blob loading if any. |
| 455 if (m_blobLoader) { | 455 if (m_blobLoader) { |
| 456 m_blobLoader->cancel(); | 456 m_blobLoader->cancel(); |
| 457 m_blobLoader.clear(); | 457 m_blobLoader.clear(); |
| 458 } | 458 } |
| 459 m_messages.clear(); | 459 m_messages.clear(); |
| 460 } | 460 } |
| 461 | 461 |
| 462 } // namespace blink | 462 } // namespace blink |
| OLD | NEW |