| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/presentation/PresentationSessionClientCallbacks.h" | 6 #include "modules/presentation/PresentationSessionClientCallbacks.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
| 10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 , m_presentation(presentation) | 24 , m_presentation(presentation) |
| 25 { | 25 { |
| 26 ASSERT(m_resolver); | 26 ASSERT(m_resolver); |
| 27 ASSERT(m_presentation); | 27 ASSERT(m_presentation); |
| 28 } | 28 } |
| 29 | 29 |
| 30 PresentationSessionClientCallbacks::~PresentationSessionClientCallbacks() | 30 PresentationSessionClientCallbacks::~PresentationSessionClientCallbacks() |
| 31 { | 31 { |
| 32 } | 32 } |
| 33 | 33 |
| 34 void PresentationSessionClientCallbacks::onSuccess(WebPresentationSessionClient*
client) | 34 void PresentationSessionClientCallbacks::onSuccess(WebPresentationSessionClient*
result) |
| 35 { | 35 { |
| 36 ASSERT(client); | 36 OwnPtr<WebPresentationSessionClient> client = adoptPtr(result); |
| 37 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { | 37 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) |
| 38 PresentationSession::dispose(client); | |
| 39 return; | 38 return; |
| 40 } | |
| 41 | 39 |
| 42 m_resolver->resolve(PresentationSession::take(client, m_presentation)); | 40 m_resolver->resolve(PresentationSession::take(client.get(), m_presentation))
; |
| 43 } | 41 } |
| 44 | 42 |
| 45 void PresentationSessionClientCallbacks::onError(WebPresentationError* error) | 43 void PresentationSessionClientCallbacks::onError(WebPresentationError* result) |
| 46 { | 44 { |
| 47 ASSERT(error); | 45 OwnPtr<WebPresentationError> error = adoptPtr(result); |
| 48 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { | 46 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) |
| 49 PresentationError::dispose(error); | |
| 50 return; | 47 return; |
| 51 } | |
| 52 | 48 |
| 53 m_resolver->reject(PresentationError::take(error)); | 49 m_resolver->reject(PresentationError::take(*error)); |
| 54 } | 50 } |
| 55 | 51 |
| 56 } // namespace blink | 52 } // namespace blink |
| OLD | NEW |