Bug 1014304 - Remove onconnection and onclosedconnection from RTCPeerConnection. r=jib, r=jesup, r=smaug

This commit is contained in:
Nils Ohlmeier [:drno] 2014-05-28 09:36:00 -04:00
parent c6e5e670dc
commit 5abd2eec9b
9 changed files with 5 additions and 96 deletions

View File

@ -307,8 +307,6 @@ RTCPeerConnection.prototype = {
this.makeGetterSetterEH("onsignalingstatechange");
this.makeGetterSetterEH("onremovestream");
this.makeGetterSetterEH("ondatachannel");
this.makeGetterSetterEH("onconnection");
this.makeGetterSetterEH("onclosedconnection");
this.makeGetterSetterEH("oniceconnectionstatechange");
this.makeGetterSetterEH("onidentityresult");
this.makeGetterSetterEH("onpeeridentity");
@ -1281,14 +1279,6 @@ PeerConnectionObserver.prototype = {
{ channel: channel }));
},
notifyConnection: function() {
this.dispatchEvent(new this._dompc._win.Event("connection"));
},
notifyClosedConnection: function() {
this.dispatchEvent(new this._dompc._win.Event("closedconnection"));
},
getSupportedConstraints: function(dict) {
return dict;
},

View File

@ -30,8 +30,6 @@ interface PeerConnectionObserver
/* Data channel callbacks */
void notifyDataChannel(DataChannel channel);
void notifyConnection();
void notifyClosedConnection();
/* Notification of one of several types of state changed */
void onStateChange(PCObserverStateType state);

View File

@ -139,8 +139,6 @@ interface mozRTCPeerConnection : EventTarget {
RTCDataChannel createDataChannel (DOMString label,
optional RTCDataChannelInit dataChannelDict);
attribute EventHandler ondatachannel;
attribute EventHandler onconnection;
attribute EventHandler onclosedconnection;
[Pref="media.peerconnection.identity.enabled"]
attribute EventHandler onidentityresult;
[Pref="media.peerconnection.identity.enabled"]

View File

@ -1128,47 +1128,6 @@ do_QueryObjectReferent(nsIWeakReference* aRawPtr) {
return tmp3.forget();
}
void
PeerConnectionImpl::NotifyConnection()
{
PC_AUTO_ENTER_API_CALL_NO_CHECK();
CSFLogDebug(logTag, "%s", __FUNCTION__);
#ifdef MOZILLA_INTERNAL_API
nsRefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(mPCObserver);
if (!pco) {
return;
}
WrappableJSErrorResult rv;
RUN_ON_THREAD(mThread,
WrapRunnable(pco,
&PeerConnectionObserver::NotifyConnection,
rv, static_cast<JSCompartment*>(nullptr)),
NS_DISPATCH_NORMAL);
#endif
}
void
PeerConnectionImpl::NotifyClosedConnection()
{
PC_AUTO_ENTER_API_CALL_NO_CHECK();
CSFLogDebug(logTag, "%s", __FUNCTION__);
#ifdef MOZILLA_INTERNAL_API
nsRefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(mPCObserver);
if (!pco) {
return;
}
WrappableJSErrorResult rv;
RUN_ON_THREAD(mThread,
WrapRunnable(pco, &PeerConnectionObserver::NotifyClosedConnection,
rv, static_cast<JSCompartment*>(nullptr)),
NS_DISPATCH_NORMAL);
#endif
}
#ifdef MOZILLA_INTERNAL_API
// Not a member function so that we don't need to keep the PC live.

View File

@ -246,8 +246,6 @@ public:
void onCallEvent(const OnCallEventArgs &args);
// DataConnection observers
void NotifyConnection();
void NotifyClosedConnection();
void NotifyDataChannel(already_AddRefed<mozilla::DataChannel> aChannel);
// Get the media object

View File

@ -77,8 +77,6 @@ public:
virtual NS_IMETHODIMP OnSetRemoteDescriptionSuccess(ER&) = 0;
virtual NS_IMETHODIMP OnSetLocalDescriptionError(uint32_t code, const char *msg, ER&) = 0;
virtual NS_IMETHODIMP OnSetRemoteDescriptionError(uint32_t code, const char *msg, ER&) = 0;
virtual NS_IMETHODIMP NotifyConnection(ER&) = 0;
virtual NS_IMETHODIMP NotifyClosedConnection(ER&) = 0;
virtual NS_IMETHODIMP NotifyDataChannel(nsIDOMDataChannel *channel, ER&) = 0;
virtual NS_IMETHODIMP OnStateChange(mozilla::dom::PCObserverStateType state_type, ER&,
void* = nullptr) = 0;

View File

@ -265,8 +265,6 @@ public:
NS_IMETHODIMP OnSetRemoteDescriptionSuccess(ER&);
NS_IMETHODIMP OnSetLocalDescriptionError(uint32_t code, const char *msg, ER&);
NS_IMETHODIMP OnSetRemoteDescriptionError(uint32_t code, const char *msg, ER&);
NS_IMETHODIMP NotifyConnection(ER&);
NS_IMETHODIMP NotifyClosedConnection(ER&);
NS_IMETHODIMP NotifyDataChannel(nsIDOMDataChannel *channel, ER&);
NS_IMETHODIMP OnStateChange(PCObserverStateType state_type, ER&, void*);
NS_IMETHODIMP OnAddStream(nsIDOMMediaStream *stream, ER&);
@ -358,20 +356,6 @@ TestObserver::OnSetRemoteDescriptionError(uint32_t code, const char *message, ER
return NS_OK;
}
NS_IMETHODIMP
TestObserver::NotifyConnection(ER&)
{
std::cout << name << ": NotifyConnection" << std::endl;
return NS_OK;
}
NS_IMETHODIMP
TestObserver::NotifyClosedConnection(ER&)
{
std::cout << name << ": NotifyClosedConnection" << std::endl;
return NS_OK;
}
NS_IMETHODIMP
TestObserver::NotifyDataChannel(nsIDOMDataChannel *channel, ER&)
{

View File

@ -625,7 +625,7 @@ DataChannelConnection::CompleteConnect(TransportFlow *flow, TransportLayer::Stat
// Note: currently this doesn't actually notify the application
NS_DispatchToMainThread(new DataChannelOnMessageAvailable(
DataChannelOnMessageAvailable::ON_CONNECTION,
this, false));
this));
return;
}
@ -1455,7 +1455,7 @@ DataChannelConnection::HandleAssociationChangeEvent(const struct sctp_assoc_chan
NS_DispatchToMainThread(new DataChannelOnMessageAvailable(
DataChannelOnMessageAvailable::ON_CONNECTION,
this, true));
this));
LOG(("DTLS connect() succeeded! Entering connected mode"));
// Open any streams pending...

View File

@ -108,12 +108,6 @@ public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DataChannelConnection::DataConnectionListener)
virtual ~DataConnectionListener() {}
// Called when a the connection is open
virtual void NotifyConnection() = 0;
// Called when a the connection is lost/closed
virtual void NotifyClosedConnection() = 0;
// Called when a new DataChannel has been opened by the other side.
virtual void NotifyDataChannel(already_AddRefed<DataChannel> channel) = 0;
};
@ -480,11 +474,9 @@ public:
// for ON_CONNECTION/ON_DISCONNECTED
DataChannelOnMessageAvailable(int32_t aType,
DataChannelConnection *aConnection,
bool aResult = true)
DataChannelConnection *aConnection)
: mType(aType),
mConnection(aConnection),
mResult(aResult) {}
mConnection(aConnection) {}
NS_IMETHOD Run()
{
@ -533,14 +525,7 @@ public:
// important to give it an already_AddRefed pointer!
mConnection->mListener->NotifyDataChannel(mChannel.forget());
break;
case ON_CONNECTION:
if (mResult) {
mConnection->mListener->NotifyConnection();
}
// FIX - on mResult false (failure) we should do something. Needs spec work here
break;
case ON_DISCONNECTED:
mConnection->mListener->NotifyClosedConnection();
default:
break;
}
break;
@ -560,7 +545,6 @@ private:
nsRefPtr<DataChannelConnection> mConnection;
nsCString mData;
int32_t mLen;
bool mResult;
};
}