Commit 1dd210cc authored by tommyw@google.com's avatar tommyw@google.com

MediaStream API: Adding the onstatechange callback to PeerConnection

https://bugs.webkit.org/show_bug.cgi?id=77954

When readyState changes a callback should be triggered.

Reviewed by Adam Barth.

Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code.

* dom/EventNames.h:
(WebCore):
* mediastream/PeerConnection.cpp:
(WebCore::PeerConnection::changeReadyState):
* mediastream/PeerConnection.h:
(PeerConnection):
(WebCore::PeerConnection::didChangeState):
* mediastream/PeerConnection.idl:
* platform/mediastream/PeerConnectionHandlerClient.h:
(PeerConnectionHandlerClient):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107054 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4f1a6603
2012-02-08 Tommy Widenflycht <tommyw@google.com>
MediaStream API: Adding the onstatechange callback to PeerConnection
https://bugs.webkit.org/show_bug.cgi?id=77954
When readyState changes a callback should be triggered.
Reviewed by Adam Barth.
Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code.
* dom/EventNames.h:
(WebCore):
* mediastream/PeerConnection.cpp:
(WebCore::PeerConnection::changeReadyState):
* mediastream/PeerConnection.h:
(PeerConnection):
(WebCore::PeerConnection::didChangeState):
* mediastream/PeerConnection.idl:
* platform/mediastream/PeerConnectionHandlerClient.h:
(PeerConnectionHandlerClient):
2012-02-08 Kentaro Hara <haraken@chromium.org>
Rename [DelegatingPutFunction] IDL to [CustomNamedSetter] IDL
......@@ -194,6 +194,7 @@ namespace WebCore {
macro(connecting) \
macro(addstream) \
macro(removestream) \
macro(statechange) \
\
macro(show) \
\
......
......@@ -367,6 +367,8 @@ void PeerConnection::changeReadyState(ReadyState readyState)
case CLOSED:
break;
}
dispatchEvent(Event::create(eventNames().statechangeEvent, false, false));
}
} // namespace WebCore
......
......@@ -58,14 +58,6 @@ public:
void processSignalingMessage(const String& message, ExceptionCode&);
// Name and values of the enum must match the corressponding constants in the .idl file.
enum ReadyState {
NEW = 0,
NEGOTIATING = 1,
ACTIVE = 2,
CLOSED = 3
};
ReadyState readyState() const;
void send(const String& text, ExceptionCode&);
......@@ -78,6 +70,7 @@ public:
DEFINE_ATTRIBUTE_EVENT_LISTENER(connecting);
DEFINE_ATTRIBUTE_EVENT_LISTENER(open);
DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream);
DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream);
......@@ -87,6 +80,7 @@ public:
virtual void didReceiveDataStreamMessage(const char* data, size_t length);
virtual void didAddRemoteStream(PassRefPtr<MediaStreamDescriptor>);
virtual void didRemoveRemoteStream(MediaStreamDescriptor*);
virtual void didChangeState(ReadyState state) { changeReadyState(state); }
// EventTarget
virtual const AtomicString& interfaceName() const;
......
......@@ -58,6 +58,7 @@ module p2p {
attribute EventListener onconnecting;
attribute EventListener onopen;
attribute EventListener onmessage;
attribute EventListener onstatechange;
attribute EventListener onaddstream;
attribute EventListener onremovestream;
......
......@@ -42,6 +42,14 @@ class MediaStreamDescriptor;
class PeerConnectionHandlerClient {
public:
// Name and values of the enum must match the corressponding constants in the PeerConnection.idl file.
enum ReadyState {
NEW = 0,
NEGOTIATING = 1,
ACTIVE = 2,
CLOSED = 3
};
virtual ~PeerConnectionHandlerClient() { }
virtual void didCompleteICEProcessing() = 0;
......@@ -49,6 +57,7 @@ public:
virtual void didReceiveDataStreamMessage(const char* data, size_t length) = 0;
virtual void didAddRemoteStream(PassRefPtr<MediaStreamDescriptor>) = 0;
virtual void didRemoveRemoteStream(MediaStreamDescriptor*) = 0;
virtual void didChangeState(ReadyState) = 0;
};
} // namespace WebCore
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment