Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/RTCVoidRequestImpl.cpp

Issue 1729563002: Replace RTCErrorCallback with RTCPeerConnectionErrorCallback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing files Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "modules/mediastream/RTCVoidRequestImpl.h" 31 #include "modules/mediastream/RTCVoidRequestImpl.h"
32 32
33 #include "core/dom/DOMException.h"
33 #include "core/html/VoidCallback.h" 34 #include "core/html/VoidCallback.h"
34 #include "modules/mediastream/RTCErrorCallback.h"
35 #include "modules/mediastream/RTCPeerConnection.h" 35 #include "modules/mediastream/RTCPeerConnection.h"
36 #include "modules/mediastream/RTCPeerConnectionErrorCallback.h"
36 37
37 namespace blink { 38 namespace blink {
38 39
39 RTCVoidRequestImpl* RTCVoidRequestImpl::create(ExecutionContext* context, RTCPee rConnection* requester, VoidCallback* successCallback, RTCErrorCallback* errorCa llback) 40 RTCVoidRequestImpl* RTCVoidRequestImpl::create(RTCPeerConnection* requester, Voi dCallback* successCallback, RTCPeerConnectionErrorCallback* errorCallback, Excep tionCode exceptionCode)
40 { 41 {
41 RTCVoidRequestImpl* request = new RTCVoidRequestImpl(context, requester, suc cessCallback, errorCallback); 42 return new RTCVoidRequestImpl(requester, successCallback, errorCallback, exc eptionCode);
42 request->suspendIfNeeded();
43 return request;
44 } 43 }
45 44
46 RTCVoidRequestImpl::RTCVoidRequestImpl(ExecutionContext* context, RTCPeerConnect ion* requester, VoidCallback* successCallback, RTCErrorCallback* errorCallback) 45 RTCVoidRequestImpl::RTCVoidRequestImpl(RTCPeerConnection* requester, VoidCallbac k* successCallback, RTCPeerConnectionErrorCallback* errorCallback, ExceptionCode exceptionCode)
47 : ActiveDOMObject(context) 46 : m_successCallback(successCallback)
48 , m_successCallback(successCallback)
49 , m_errorCallback(errorCallback) 47 , m_errorCallback(errorCallback)
48 , m_exceptionCode(exceptionCode)
50 , m_requester(requester) 49 , m_requester(requester)
51 { 50 {
52 ASSERT(m_requester); 51 ASSERT(m_requester);
53 } 52 }
54 53
55 RTCVoidRequestImpl::~RTCVoidRequestImpl() 54 RTCVoidRequestImpl::~RTCVoidRequestImpl()
56 { 55 {
57 } 56 }
58 57
59 void RTCVoidRequestImpl::requestSucceeded() 58 void RTCVoidRequestImpl::requestSucceeded()
60 { 59 {
61 bool shouldFireCallback = m_requester ? m_requester->shouldFireDefaultCallba cks() : false; 60 bool shouldFireCallback = m_requester && m_requester->shouldFireDefaultCallb acks();
62 if (shouldFireCallback && m_successCallback) 61 if (shouldFireCallback && m_successCallback)
63 m_successCallback->handleEvent(); 62 m_successCallback->handleEvent();
64 63
65 clear(); 64 clear();
66 } 65 }
67 66
68 void RTCVoidRequestImpl::requestFailed(const String& error) 67 void RTCVoidRequestImpl::requestFailed(const String& error)
69 { 68 {
70 bool shouldFireCallback = m_requester ? m_requester->shouldFireDefaultCallba cks() : false; 69 bool shouldFireCallback = m_requester && m_requester->shouldFireDefaultCallb acks();
71 if (shouldFireCallback && m_errorCallback.get()) 70 if (shouldFireCallback && m_errorCallback.get())
72 m_errorCallback->handleEvent(error); 71 m_errorCallback->handleEvent(DOMException::create(m_exceptionCode, error ));
73 72
74 clear(); 73 clear();
75 } 74 }
76 75
77 void RTCVoidRequestImpl::stop()
78 {
79 clear();
80 }
81
82 void RTCVoidRequestImpl::clear() 76 void RTCVoidRequestImpl::clear()
83 { 77 {
84 m_successCallback.clear(); 78 m_successCallback.clear();
85 m_errorCallback.clear(); 79 m_errorCallback.clear();
86 m_requester.clear(); 80 m_requester.clear();
87 } 81 }
88 82
89 DEFINE_TRACE(RTCVoidRequestImpl) 83 DEFINE_TRACE(RTCVoidRequestImpl)
90 { 84 {
91 visitor->trace(m_successCallback); 85 visitor->trace(m_successCallback);
92 visitor->trace(m_errorCallback); 86 visitor->trace(m_errorCallback);
93 visitor->trace(m_requester); 87 visitor->trace(m_requester);
94 RTCVoidRequest::trace(visitor); 88 RTCVoidRequest::trace(visitor);
95 ActiveDOMObject::trace(visitor);
96 } 89 }
97 90
98 } // namespace blink 91 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698