OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/peerconnection/RTCSessionDescriptionRequestPromiseImpl.h" | 5 #include "modules/peerconnection/RTCSessionDescriptionRequestPromiseImpl.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
10 #include "modules/peerconnection/RTCPeerConnection.h" | 10 #include "modules/peerconnection/RTCPeerConnection.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // while leaving the associated promise pending as specified. | 40 // while leaving the associated promise pending as specified. |
41 m_resolver->detach(); | 41 m_resolver->detach(); |
42 } | 42 } |
43 | 43 |
44 clear(); | 44 clear(); |
45 } | 45 } |
46 | 46 |
47 void RTCSessionDescriptionRequestPromiseImpl::requestFailed( | 47 void RTCSessionDescriptionRequestPromiseImpl::requestFailed( |
48 const String& error) { | 48 const String& error) { |
49 if (m_requester && m_requester->shouldFireDefaultCallbacks()) { | 49 if (m_requester && m_requester->shouldFireDefaultCallbacks()) { |
50 // TODO(guidou): The error code should come from the content layer. See crbu
g.com/589455 | 50 // TODO(guidou): The error code should come from the content layer. See |
| 51 // crbug.com/589455 |
51 m_resolver->reject(DOMException::create(OperationError, error)); | 52 m_resolver->reject(DOMException::create(OperationError, error)); |
52 } else { | 53 } else { |
53 // This is needed to have the resolver release its internal resources | 54 // This is needed to have the resolver release its internal resources |
54 // while leaving the associated promise pending as specified. | 55 // while leaving the associated promise pending as specified. |
55 m_resolver->detach(); | 56 m_resolver->detach(); |
56 } | 57 } |
57 | 58 |
58 clear(); | 59 clear(); |
59 } | 60 } |
60 | 61 |
61 void RTCSessionDescriptionRequestPromiseImpl::clear() { | 62 void RTCSessionDescriptionRequestPromiseImpl::clear() { |
62 m_requester.clear(); | 63 m_requester.clear(); |
63 } | 64 } |
64 | 65 |
65 DEFINE_TRACE(RTCSessionDescriptionRequestPromiseImpl) { | 66 DEFINE_TRACE(RTCSessionDescriptionRequestPromiseImpl) { |
66 visitor->trace(m_resolver); | 67 visitor->trace(m_resolver); |
67 visitor->trace(m_requester); | 68 visitor->trace(m_requester); |
68 RTCSessionDescriptionRequest::trace(visitor); | 69 RTCSessionDescriptionRequest::trace(visitor); |
69 } | 70 } |
70 | 71 |
71 } // namespace blink | 72 } // namespace blink |
OLD | NEW |