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/RTCVoidRequestPromiseImpl.h" | 5 #include "modules/peerconnection/RTCVoidRequestPromiseImpl.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 23 matching lines...) Expand all Loading... |
34 // This is needed to have the resolver release its internal resources | 34 // This is needed to have the resolver release its internal resources |
35 // while leaving the associated promise pending as specified. | 35 // while leaving the associated promise pending as specified. |
36 m_resolver->detach(); | 36 m_resolver->detach(); |
37 } | 37 } |
38 | 38 |
39 clear(); | 39 clear(); |
40 } | 40 } |
41 | 41 |
42 void RTCVoidRequestPromiseImpl::requestFailed(const String& error) { | 42 void RTCVoidRequestPromiseImpl::requestFailed(const String& error) { |
43 if (m_requester && m_requester->shouldFireDefaultCallbacks()) { | 43 if (m_requester && m_requester->shouldFireDefaultCallbacks()) { |
44 // TODO(guidou): The error code should come from the content layer. See crbu
g.com/589455 | 44 // TODO(guidou): The error code should come from the content layer. See |
| 45 // crbug.com/589455 |
45 m_resolver->reject(DOMException::create(OperationError, error)); | 46 m_resolver->reject(DOMException::create(OperationError, error)); |
46 } else { | 47 } else { |
47 // This is needed to have the resolver release its internal resources | 48 // This is needed to have the resolver release its internal resources |
48 // while leaving the associated promise pending as specified. | 49 // while leaving the associated promise pending as specified. |
49 m_resolver->detach(); | 50 m_resolver->detach(); |
50 } | 51 } |
51 | 52 |
52 clear(); | 53 clear(); |
53 } | 54 } |
54 | 55 |
55 void RTCVoidRequestPromiseImpl::clear() { | 56 void RTCVoidRequestPromiseImpl::clear() { |
56 m_requester.clear(); | 57 m_requester.clear(); |
57 } | 58 } |
58 | 59 |
59 DEFINE_TRACE(RTCVoidRequestPromiseImpl) { | 60 DEFINE_TRACE(RTCVoidRequestPromiseImpl) { |
60 visitor->trace(m_resolver); | 61 visitor->trace(m_resolver); |
61 visitor->trace(m_requester); | 62 visitor->trace(m_requester); |
62 RTCVoidRequest::trace(visitor); | 63 RTCVoidRequest::trace(visitor); |
63 } | 64 } |
64 | 65 |
65 } // namespace blink | 66 } // namespace blink |
OLD | NEW |