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
+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
macro(connecting) \
macro(addstream) \
macro(removestream) \
+ macro(statechange) \
\
macro(show) \
\
case CLOSED:
break;
}
+
+ dispatchEvent(Event::create(eventNames().statechangeEvent, false, false));
}
} // namespace WebCore
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&);
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);
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;
attribute EventListener onconnecting;
attribute EventListener onopen;
attribute EventListener onmessage;
+ attribute EventListener onstatechange;
attribute EventListener onaddstream;
attribute EventListener onremovestream;
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;
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