| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 controller->registerConnection(connection); | 193 controller->registerConnection(connection); |
| 194 | 194 |
| 195 // Fire onconnectionavailable event asynchronously. | 195 // Fire onconnectionavailable event asynchronously. |
| 196 auto* event = PresentationConnectionAvailableEvent::create( | 196 auto* event = PresentationConnectionAvailableEvent::create( |
| 197 EventTypeNames::connectionavailable, connection); | 197 EventTypeNames::connectionavailable, connection); |
| 198 request->getExecutionContext()->postTask( | 198 request->getExecutionContext()->postTask( |
| 199 TaskType::Presentation, BLINK_FROM_HERE, | 199 TaskType::Presentation, BLINK_FROM_HERE, |
| 200 createSameThreadTask(&PresentationConnection::dispatchEventAsync, | 200 createSameThreadTask(&PresentationConnection::dispatchEventAsync, |
| 201 wrapPersistent(request), wrapPersistent(event))); | 201 wrapPersistent(request), wrapPersistent(event))); |
| 202 | 202 |
| 203 // Fire onconnect event asynchronously, after onconnectionavailable. |
| 204 connection->didChangeState(WebPresentationConnectionState::Connected); |
| 205 |
| 203 return connection; | 206 return connection; |
| 204 } | 207 } |
| 205 | 208 |
| 206 // static | 209 // static |
| 207 PresentationConnection* PresentationConnection::take( | 210 PresentationConnection* PresentationConnection::take( |
| 208 PresentationReceiver* receiver, | 211 PresentationReceiver* receiver, |
| 209 const WebPresentationSessionInfo& sessionInfo) { | 212 const WebPresentationSessionInfo& sessionInfo) { |
| 210 DCHECK(receiver); | 213 DCHECK(receiver); |
| 211 | 214 |
| 212 PresentationConnection* connection = new PresentationConnection( | 215 PresentationConnection* connection = new PresentationConnection( |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 void PresentationConnection::tearDown() { | 497 void PresentationConnection::tearDown() { |
| 495 // Cancel current Blob loading if any. | 498 // Cancel current Blob loading if any. |
| 496 if (m_blobLoader) { | 499 if (m_blobLoader) { |
| 497 m_blobLoader->cancel(); | 500 m_blobLoader->cancel(); |
| 498 m_blobLoader.clear(); | 501 m_blobLoader.clear(); |
| 499 } | 502 } |
| 500 m_messages.clear(); | 503 m_messages.clear(); |
| 501 } | 504 } |
| 502 | 505 |
| 503 } // namespace blink | 506 } // namespace blink |
| OLD | NEW |