| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 WebPresentationConnectionCloseReason reason, | 461 WebPresentationConnectionCloseReason reason, |
| 462 const String& message) { | 462 const String& message) { |
| 463 if (m_state == WebPresentationConnectionState::Closed) | 463 if (m_state == WebPresentationConnectionState::Closed) |
| 464 return; | 464 return; |
| 465 | 465 |
| 466 m_state = WebPresentationConnectionState::Closed; | 466 m_state = WebPresentationConnectionState::Closed; |
| 467 dispatchStateChangeEvent(PresentationConnectionCloseEvent::create( | 467 dispatchStateChangeEvent(PresentationConnectionCloseEvent::create( |
| 468 EventTypeNames::close, connectionCloseReasonToString(reason), message)); | 468 EventTypeNames::close, connectionCloseReasonToString(reason), message)); |
| 469 } | 469 } |
| 470 | 470 |
| 471 void PresentationConnection::didClose() { |
| 472 didClose(WebPresentationConnectionCloseReason::Closed, ""); |
| 473 } |
| 474 |
| 471 void PresentationConnection::didFinishLoadingBlob(DOMArrayBuffer* buffer) { | 475 void PresentationConnection::didFinishLoadingBlob(DOMArrayBuffer* buffer) { |
| 472 ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob); | 476 ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob); |
| 473 ASSERT(buffer && buffer->buffer()); | 477 ASSERT(buffer && buffer->buffer()); |
| 474 // Send the loaded blob immediately here and continue processing the queue. | 478 // Send the loaded blob immediately here and continue processing the queue. |
| 475 WebPresentationClient* client = presentationClient(getExecutionContext()); | 479 WebPresentationClient* client = presentationClient(getExecutionContext()); |
| 476 if (client) { | 480 if (client) { |
| 477 client->sendBlobData(m_url, m_id, | 481 client->sendBlobData(m_url, m_id, |
| 478 static_cast<const uint8_t*>(buffer->data()), | 482 static_cast<const uint8_t*>(buffer->data()), |
| 479 buffer->byteLength(), m_proxy.get()); | 483 buffer->byteLength(), m_proxy.get()); |
| 480 } | 484 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 void PresentationConnection::tearDown() { | 516 void PresentationConnection::tearDown() { |
| 513 // Cancel current Blob loading if any. | 517 // Cancel current Blob loading if any. |
| 514 if (m_blobLoader) { | 518 if (m_blobLoader) { |
| 515 m_blobLoader->cancel(); | 519 m_blobLoader->cancel(); |
| 516 m_blobLoader.clear(); | 520 m_blobLoader.clear(); |
| 517 } | 521 } |
| 518 m_messages.clear(); | 522 m_messages.clear(); |
| 519 } | 523 } |
| 520 | 524 |
| 521 } // namespace blink | 525 } // namespace blink |
| OLD | NEW |