| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 controller->registerConnection(connection); | 202 controller->registerConnection(connection); |
| 203 | 203 |
| 204 // Fire onconnectionavailable event asynchronously. | 204 // Fire onconnectionavailable event asynchronously. |
| 205 auto* event = PresentationConnectionAvailableEvent::create( | 205 auto* event = PresentationConnectionAvailableEvent::create( |
| 206 EventTypeNames::connectionavailable, connection); | 206 EventTypeNames::connectionavailable, connection); |
| 207 request->getExecutionContext()->postTask( | 207 request->getExecutionContext()->postTask( |
| 208 TaskType::Presentation, BLINK_FROM_HERE, | 208 TaskType::Presentation, BLINK_FROM_HERE, |
| 209 createSameThreadTask(&PresentationConnection::dispatchEventAsync, | 209 createSameThreadTask(&PresentationConnection::dispatchEventAsync, |
| 210 wrapPersistent(request), wrapPersistent(event))); | 210 wrapPersistent(request), wrapPersistent(event))); |
| 211 | 211 |
| 212 // Fire onconnect event asynchronously, after onconnectionavailable. | |
| 213 connection->didChangeState(WebPresentationConnectionState::Connected); | |
| 214 | |
| 215 return connection; | 212 return connection; |
| 216 } | 213 } |
| 217 | 214 |
| 218 // static | 215 // static |
| 219 PresentationConnection* PresentationConnection::take( | 216 PresentationConnection* PresentationConnection::take( |
| 220 PresentationReceiver* receiver, | 217 PresentationReceiver* receiver, |
| 221 const WebPresentationSessionInfo& sessionInfo) { | 218 const WebPresentationSessionInfo& sessionInfo) { |
| 222 DCHECK(receiver); | 219 DCHECK(receiver); |
| 223 | 220 |
| 224 PresentationConnection* connection = new PresentationConnection( | 221 PresentationConnection* connection = new PresentationConnection( |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 void PresentationConnection::tearDown() { | 505 void PresentationConnection::tearDown() { |
| 509 // Cancel current Blob loading if any. | 506 // Cancel current Blob loading if any. |
| 510 if (m_blobLoader) { | 507 if (m_blobLoader) { |
| 511 m_blobLoader->cancel(); | 508 m_blobLoader->cancel(); |
| 512 m_blobLoader.clear(); | 509 m_blobLoader.clear(); |
| 513 } | 510 } |
| 514 m_messages.clear(); | 511 m_messages.clear(); |
| 515 } | 512 } |
| 516 | 513 |
| 517 } // namespace blink | 514 } // namespace blink |
| OLD | NEW |