Changeset 202337 in webkit
- Timestamp:
- Jun 22, 2016, 11:12:46 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r202168 r202337 1202 1202 bindings/js/JSReadableStreamPrivateConstructors.cpp 1203 1203 bindings/js/JSReadableStreamSourceCustom.cpp 1204 bindings/js/JSRTCPeerConnectionCustom.cpp1205 1204 bindings/js/JSRTCStatsResponseCustom.cpp 1206 1205 bindings/js/JSSQLResultSetRowListCustom.cpp -
trunk/Source/WebCore/ChangeLog
r202336 r202337 1 2016-06-22 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 3 WebRTC: Replace RTCPeerConnection custom constructor with a JS built-in constructor 4 https://bugs.webkit.org/show_bug.cgi?id=158832 5 6 Reviewed by Eric Carlson and Youenn Fablet. 7 8 Use a JS built-in constructor instead of a custom constructor. This makes it easier to 9 initialize private fields for functions implemented as JS built-ins. The constructor 10 behavior is in need of updating, but that is left to a follow-up change [1]. 11 12 [1] http://webkit.org/b/158936 13 No change in behavior. 14 15 * CMakeLists.txt: 16 * Modules/mediastream/RTCPeerConnection.cpp: 17 (WebCore::RTCPeerConnection::create): 18 (WebCore::RTCPeerConnection::RTCPeerConnection): 19 (WebCore::RTCPeerConnection::~RTCPeerConnection): 20 (WebCore::RTCPeerConnection::initializeWith): 21 * Modules/mediastream/RTCPeerConnection.h: 22 * Modules/mediastream/RTCPeerConnection.idl: 23 * Modules/mediastream/RTCPeerConnection.js: 24 (initializeRTCPeerConnection): 25 Add JS built-in constructor function. 26 * WebCore.xcodeproj/project.pbxproj: 27 * bindings/js/JSRTCPeerConnectionCustom.cpp: Removed. 28 (WebCore::constructJSRTCPeerConnection): Deleted. 29 1 30 2016-06-22 Youenn Fablet <youenn@apple.com> 2 31 -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
r202105 r202337 60 60 using namespace PeerConnectionStates; 61 61 62 RefPtr<RTCPeerConnection> RTCPeerConnection::create(ScriptExecutionContext& context, const Dictionary& rtcConfiguration, ExceptionCode& ec) 63 { 64 RefPtr<RTCConfiguration> configuration = RTCConfiguration::create(rtcConfiguration, ec); 65 if (ec) 66 return nullptr; 67 68 RefPtr<RTCPeerConnection> peerConnection = adoptRef(new RTCPeerConnection(context, WTFMove(configuration), ec)); 62 Ref<RTCPeerConnection> RTCPeerConnection::create(ScriptExecutionContext& context) 63 { 64 Ref<RTCPeerConnection> peerConnection = adoptRef(*new RTCPeerConnection(context)); 69 65 peerConnection->suspendIfNeeded(); 70 if (ec)71 return nullptr;72 66 73 67 return peerConnection; 74 68 } 75 69 76 RTCPeerConnection::RTCPeerConnection(ScriptExecutionContext& context , RefPtr<RTCConfiguration>&& configuration, ExceptionCode& ec)70 RTCPeerConnection::RTCPeerConnection(ScriptExecutionContext& context) 77 71 : ActiveDOMObject(&context) 78 , m_signalingState(SignalingState::Stable) 79 , m_iceGatheringState(IceGatheringState::New) 80 , m_iceConnectionState(IceConnectionState::New) 81 , m_configuration(WTFMove(configuration)) 82 { 83 Document& document = downcast<Document>(context); 84 72 , m_backend(PeerConnectionBackend::create(this)) 73 { 74 } 75 76 RTCPeerConnection::~RTCPeerConnection() 77 { 78 stop(); 79 } 80 81 void RTCPeerConnection::initializeWith(Document& document, const Dictionary& rtcConfiguration, ExceptionCode& ec) 82 { 85 83 if (!document.frame()) { 86 84 ec = NOT_SUPPORTED_ERR; … … 88 86 } 89 87 90 m_backend = PeerConnectionBackend::create(this);91 88 if (!m_backend) { 92 89 ec = NOT_SUPPORTED_ERR; … … 94 91 } 95 92 96 m_backend->setConfiguration(*m_configuration); 97 } 98 99 RTCPeerConnection::~RTCPeerConnection() 100 { 101 stop(); 93 setConfiguration(rtcConfiguration, ec); 102 94 } 103 95 -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h
r202039 r202337 61 61 class RTCPeerConnection final : public RefCounted<RTCPeerConnection>, public PeerConnectionBackendClient, public RTCRtpSenderClient, public EventTargetWithInlineData, public ActiveDOMObject { 62 62 public: 63 static Ref Ptr<RTCPeerConnection> create(ScriptExecutionContext&, const Dictionary& rtcConfiguration, ExceptionCode&);63 static Ref<RTCPeerConnection> create(ScriptExecutionContext&); 64 64 ~RTCPeerConnection(); 65 66 void initializeWith(Document&, const Dictionary&, ExceptionCode&); 65 67 66 68 const Vector<RefPtr<RTCRtpSender>>& getSenders() const { return m_transceiverSet->getSenders(); } … … 118 120 119 121 private: 120 RTCPeerConnection(ScriptExecutionContext& , RefPtr<RTCConfiguration>&&, ExceptionCode&);122 RTCPeerConnection(ScriptExecutionContext&); 121 123 122 124 RefPtr<RTCRtpTransceiver> completeAddTransceiver(Ref<RTCRtpTransceiver>&&, const RtpTransceiverInit&); … … 148 150 void replaceTrack(RTCRtpSender&, RefPtr<MediaStreamTrack>&&, PeerConnection::VoidPromise&&) override; 149 151 150 PeerConnectionStates::SignalingState m_signalingState ;151 PeerConnectionStates::IceGatheringState m_iceGatheringState ;152 PeerConnectionStates::IceConnectionState m_iceConnectionState ;152 PeerConnectionStates::SignalingState m_signalingState { PeerConnectionStates::SignalingState::Stable }; 153 PeerConnectionStates::IceGatheringState m_iceGatheringState { PeerConnectionStates::IceGatheringState::New }; 154 PeerConnectionStates::IceConnectionState m_iceConnectionState { PeerConnectionStates::IceConnectionState::New }; 153 155 154 156 std::unique_ptr<RtpTransceiverSet> m_transceiverSet { std::unique_ptr<RtpTransceiverSet>(new RtpTransceiverSet()) }; -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl
r202275 r202337 35 35 Conditional=WEB_RTC, 36 36 ConstructorCallWith=ScriptExecutionContext, 37 ConstructorRaisesException, 38 CustomConstructor(Dictionary rtcConfiguration), 37 JSBuiltinConstructor, 39 38 InterfaceName=webkitRTCPeerConnection, 40 39 ] interface RTCPeerConnection : EventTarget { 40 // Private initializer 41 [PrivateIdentifier, CallWith=Document, RaisesException] void initializeWith(Dictionary parameters); 42 41 43 // RTP Media API extensions 42 44 sequence<RTCRtpSender> getSenders(); -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js
r202130 r202337 31 31 // @conditional=ENABLE(WEB_RTC) 32 32 33 function initializeRTCPeerConnection(configuration) 34 { 35 "use strict"; 36 37 if (arguments.length < 1) 38 throw new @TypeError("Not enough arguments"); 39 40 if (!@isObject(configuration)) 41 throw new @TypeError("RTCPeerConnection argument must be a valid Dictionary"); 42 43 // FIXME: Handle errors in a better way than catching and re-throwing (http://webkit.org/b/158936) 44 try { 45 this.@initializeWith(configuration); 46 } catch (e) { 47 const message = e.name === "TypeMismatchError" ? "Invalid RTCPeerConnection constructor arguments" 48 : "Error creating RTCPeerConnection"; 49 throw new @TypeError(message); 50 } 51 return this; 52 } 53 33 54 function createOffer() 34 55 { -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r202311 r202337 306 306 07C59B6917F784BA000FBCBB /* MediaSourceSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C59B6617F784BA000FBCBB /* MediaSourceSettings.h */; }; 307 307 07C59B6E17F794F6000FBCBB /* JSMediaStreamTrackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07C59B6D17F794F6000FBCBB /* JSMediaStreamTrackCustom.cpp */; }; 308 07CA120E182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07CA120D182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp */; };309 308 07CE77D516712A6A00C55A47 /* InbandTextTrackPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 310 309 07D637401BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = 07D6373E1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h */; }; … … 7768 7767 07C8AD111D073D630087C5CE /* AVFoundationMIMETypeCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVFoundationMIMETypeCache.mm; sourceTree = "<group>"; }; 7769 7768 07C8AD121D073D630087C5CE /* AVFoundationMIMETypeCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVFoundationMIMETypeCache.h; sourceTree = "<group>"; }; 7770 07CA120D182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCPeerConnectionCustom.cpp; sourceTree = "<group>"; };7771 7769 07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivateClient.h; sourceTree = "<group>"; }; 7772 7770 07D6373E1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAudioSourceProviderAVFObjC.h; sourceTree = "<group>"; }; … … 22732 22730 FD8AA63D169514A700D2EA68 /* JSPannerNodeCustom.cpp */, 22733 22731 A85F22081430377D007CC884 /* JSPopStateEventCustom.cpp */, 22734 07CA120D182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp */,22735 22732 07DC5FD317D3EEE90099F890 /* JSRTCStatsResponseCustom.cpp */, 22736 22733 51DCE8010CAC9F1C00488358 /* JSSQLResultSetRowListCustom.cpp */, … … 30851 30848 073794EB19EE341E00E5A045 /* JSRTCIceServer.cpp in Sources */, 30852 30849 07969DB917D14151007FF842 /* JSRTCPeerConnection.cpp in Sources */, 30853 07CA120E182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp in Sources */,30854 30850 5E2C43711BCF0D750001E2BC /* JSRTCRtpReceiver.cpp in Sources */, 30855 30851 5E2C43731BCF0D750001E2BC /* JSRTCRtpSender.cpp in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.