Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 23 matching lines...) Expand all Loading... | |
| 34 | 34 |
| 35 #include "modules/mediastream/RTCErrorCallback.h" | 35 #include "modules/mediastream/RTCErrorCallback.h" |
| 36 #include "modules/mediastream/RTCPeerConnection.h" | 36 #include "modules/mediastream/RTCPeerConnection.h" |
| 37 #include "modules/mediastream/RTCSessionDescription.h" | 37 #include "modules/mediastream/RTCSessionDescription.h" |
| 38 #include "modules/mediastream/RTCSessionDescriptionCallback.h" | 38 #include "modules/mediastream/RTCSessionDescriptionCallback.h" |
| 39 #include "public/platform/WebRTCSessionDescription.h" | 39 #include "public/platform/WebRTCSessionDescription.h" |
| 40 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 PassRefPtr<RTCSessionDescriptionRequestImpl> RTCSessionDescriptionRequestImpl::c reate(ExecutionContext* context, PassOwnPtr<RTCSessionDescriptionCallback> succe ssCallback, PassOwnPtr<RTCErrorCallback> errorCallback) | 44 PassRefPtr<RTCSessionDescriptionRequestImpl> RTCSessionDescriptionRequestImpl::c reate(ExecutionContext* context, PassRefPtrWillBeRawPtr<RTCPeerConnection> reque ster, PassOwnPtr<RTCSessionDescriptionCallback> successCallback, PassOwnPtr<RTCE rrorCallback> errorCallback) |
| 45 { | 45 { |
| 46 RefPtr<RTCSessionDescriptionRequestImpl> request = adoptRef(new RTCSessionDe scriptionRequestImpl(context, successCallback, errorCallback)); | 46 RefPtr<RTCSessionDescriptionRequestImpl> request = adoptRef(new RTCSessionDe scriptionRequestImpl(context, requester, successCallback, errorCallback)); |
| 47 request->suspendIfNeeded(); | 47 request->suspendIfNeeded(); |
| 48 return request.release(); | 48 return request.release(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 RTCSessionDescriptionRequestImpl::RTCSessionDescriptionRequestImpl(ExecutionCont ext* context, PassOwnPtr<RTCSessionDescriptionCallback> successCallback, PassOwn Ptr<RTCErrorCallback> errorCallback) | 51 RTCSessionDescriptionRequestImpl::RTCSessionDescriptionRequestImpl(ExecutionCont ext* context, PassRefPtrWillBeRawPtr<RTCPeerConnection> requester, PassOwnPtr<RT CSessionDescriptionCallback> successCallback, PassOwnPtr<RTCErrorCallback> error Callback) |
| 52 : ActiveDOMObject(context) | 52 : ActiveDOMObject(context) |
| 53 , m_successCallback(successCallback) | 53 , m_successCallback(successCallback) |
| 54 , m_errorCallback(errorCallback) | 54 , m_errorCallback(errorCallback) |
| 55 , m_requester(requester) | |
| 55 { | 56 { |
| 57 ASSERT(m_requester); | |
| 56 } | 58 } |
| 57 | 59 |
| 58 RTCSessionDescriptionRequestImpl::~RTCSessionDescriptionRequestImpl() | 60 RTCSessionDescriptionRequestImpl::~RTCSessionDescriptionRequestImpl() |
| 59 { | 61 { |
| 60 } | 62 } |
| 61 | 63 |
| 62 void RTCSessionDescriptionRequestImpl::requestSucceeded(const blink::WebRTCSessi onDescription& webSessionDescription) | 64 void RTCSessionDescriptionRequestImpl::requestSucceeded(const blink::WebRTCSessi onDescription& webSessionDescription) |
| 63 { | 65 { |
| 64 if (m_successCallback) { | 66 bool mayFireCallback = m_requester ? m_requester->requestMayFireNonStatsCall back() : false; |
|
haraken
2014/06/17 11:43:45
Nit: mayFireCallback => shouldFireCallback ?
| |
| 67 if (mayFireCallback && m_successCallback) { | |
| 65 RefPtrWillBeRawPtr<RTCSessionDescription> sessionDescription = RTCSessio nDescription::create(webSessionDescription); | 68 RefPtrWillBeRawPtr<RTCSessionDescription> sessionDescription = RTCSessio nDescription::create(webSessionDescription); |
| 66 m_successCallback->handleEvent(sessionDescription.get()); | 69 m_successCallback->handleEvent(sessionDescription.get()); |
| 67 } | 70 } |
| 68 | 71 |
| 69 clear(); | 72 clear(); |
| 70 } | 73 } |
| 71 | 74 |
| 72 void RTCSessionDescriptionRequestImpl::requestFailed(const String& error) | 75 void RTCSessionDescriptionRequestImpl::requestFailed(const String& error) |
| 73 { | 76 { |
| 74 if (m_errorCallback) | 77 bool mayFireCallback = m_requester ? m_requester->requestMayFireNonStatsCall back() : false; |
| 78 if (mayFireCallback && m_errorCallback) | |
| 75 m_errorCallback->handleEvent(error); | 79 m_errorCallback->handleEvent(error); |
| 76 | 80 |
| 77 clear(); | 81 clear(); |
| 78 } | 82 } |
| 79 | 83 |
| 80 void RTCSessionDescriptionRequestImpl::stop() | 84 void RTCSessionDescriptionRequestImpl::stop() |
| 81 { | 85 { |
| 82 clear(); | 86 clear(); |
| 83 } | 87 } |
| 84 | 88 |
| 85 void RTCSessionDescriptionRequestImpl::clear() | 89 void RTCSessionDescriptionRequestImpl::clear() |
| 86 { | 90 { |
| 87 m_successCallback.clear(); | 91 m_successCallback.clear(); |
| 88 m_errorCallback.clear(); | 92 m_errorCallback.clear(); |
| 93 m_requester.clear(); | |
| 89 } | 94 } |
| 90 | 95 |
| 91 } // namespace WebCore | 96 } // namespace WebCore |
| OLD | NEW |