Commit 46689138 authored by tommyw@google.com's avatar tommyw@google.com
Browse files

MediaStream API: RTCPeerConnection should send down its handler via the...

MediaStream API: RTCPeerConnection should send down its handler via the FrameLoaderClient directly after creation.
https://bugs.webkit.org/show_bug.cgi?id=98149

Reviewed by Adam Barth.

Source/WebCore:

The chromium implementation needs to know which Frame created a PeerConnection so
that the right housekeeping can take place correctly.

Not testable in DRT, but have verified the change manually and with our pyautotests.

* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::RTCPeerConnection):
* loader/FrameLoaderClient.h:
(WebCore):
(FrameLoaderClient):
(WebCore::FrameLoaderClient::dispatchWillStartUsingPeerConnectionHandler):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
(WebCore::RTCPeerConnectionHandlerChromium::toWebRTCPeerConnectionHandler):
(WebCore):
(WebCore::RTCPeerConnectionHandlerChromium::RTCPeerConnectionHandlerChromium):
(WebCore::RTCPeerConnectionHandlerChromium::initialize):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h:
(RTCPeerConnectionHandlerChromium):

Source/WebKit/chromium:

Adding willStartUsingPeerConnectionHandler to the WebFrameClient.

* public/WebFrameClient.h:
(WebKit):
(WebFrameClient):
(WebKit::WebFrameClient::willStartUsingPeerConnectionHandler):
* src/FrameLoaderClientImpl.cpp:
(WebKit):
(WebKit::FrameLoaderClientImpl::dispatchWillStartUsingPeerConnectionHandler):
* src/FrameLoaderClientImpl.h:
(FrameLoaderClientImpl):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130270 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e508ef60
2012-10-03 Tommy Widenflycht <tommyw@google.com>
MediaStream API: RTCPeerConnection should send down its handler via the FrameLoaderClient directly after creation.
https://bugs.webkit.org/show_bug.cgi?id=98149
Reviewed by Adam Barth.
The chromium implementation needs to know which Frame created a PeerConnection so
that the right housekeeping can take place correctly.
Not testable in DRT, but have verified the change manually and with our pyautotests.
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::RTCPeerConnection):
* loader/FrameLoaderClient.h:
(WebCore):
(FrameLoaderClient):
(WebCore::FrameLoaderClient::dispatchWillStartUsingPeerConnectionHandler):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
(WebCore::RTCPeerConnectionHandlerChromium::toWebRTCPeerConnectionHandler):
(WebCore):
(WebCore::RTCPeerConnectionHandlerChromium::RTCPeerConnectionHandlerChromium):
(WebCore::RTCPeerConnectionHandlerChromium::initialize):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h:
(RTCPeerConnectionHandlerChromium):
2012-10-03 Eugene Klyuchnikov <eustas.bug@gmail.com>
Web Inspector: Profiles: taking heap snapshot causes error message in console.
......
......@@ -35,8 +35,11 @@
#include "RTCPeerConnection.h"
#include "ArrayValue.h"
#include "Document.h"
#include "Event.h"
#include "ExceptionCode.h"
#include "Frame.h"
#include "FrameLoaderClient.h"
#include "MediaConstraintsImpl.h"
#include "MediaStreamEvent.h"
#include "RTCConfiguration.h"
......@@ -130,9 +133,26 @@ RTCPeerConnection::RTCPeerConnection(ScriptExecutionContext* context, PassRefPtr
, m_localStreams(MediaStreamList::create())
, m_remoteStreams(MediaStreamList::create())
{
ASSERT(m_scriptExecutionContext->isDocument());
Document* document = static_cast<Document*>(m_scriptExecutionContext);
if (!document->frame()) {
ec = NOT_SUPPORTED_ERR;
return;
}
m_peerHandler = RTCPeerConnectionHandler::create(this);
if (!m_peerHandler || !m_peerHandler->initialize(configuration, constraints))
if (!m_peerHandler) {
ec = NOT_SUPPORTED_ERR;
return;
}
document->frame()->loader()->client()->dispatchWillStartUsingPeerConnectionHandler(m_peerHandler.get());
if (!m_peerHandler->initialize(configuration, constraints)) {
ec = NOT_SUPPORTED_ERR;
return;
}
}
RTCPeerConnection::~RTCPeerConnection()
......
......@@ -96,6 +96,9 @@ namespace WebCore {
class ResourceLoader;
class ResourceRequest;
class ResourceResponse;
#if ENABLE(MEDIA_STREAM)
class RTCPeerConnectionHandler;
#endif
class SecurityOrigin;
class SharedBuffer;
class SocketStreamHandle;
......@@ -341,6 +344,10 @@ namespace WebCore {
virtual void dispatchWillDisconnectDOMWindowExtensionFromGlobalObject(DOMWindowExtension*) { }
virtual void dispatchDidReconnectDOMWindowExtensionToGlobalObject(DOMWindowExtension*) { }
virtual void dispatchWillDestroyGlobalObjectForDOMWindowExtension(DOMWindowExtension*) { }
#if ENABLE(MEDIA_STREAM)
virtual void dispatchWillStartUsingPeerConnectionHandler(RTCPeerConnectionHandler*) { }
#endif
};
} // namespace WebCore
......
......@@ -55,6 +55,11 @@
namespace WebCore {
WebKit::WebRTCPeerConnectionHandler* RTCPeerConnectionHandlerChromium::toWebRTCPeerConnectionHandler(RTCPeerConnectionHandler* handler)
{
return static_cast<RTCPeerConnectionHandlerChromium*>(handler)->m_webHandler.get();
}
PassOwnPtr<RTCPeerConnectionHandler> RTCPeerConnectionHandler::create(RTCPeerConnectionHandlerClient* client)
{
return adoptPtr(new RTCPeerConnectionHandlerChromium(client));
......@@ -64,6 +69,7 @@ RTCPeerConnectionHandlerChromium::RTCPeerConnectionHandlerChromium(RTCPeerConnec
: m_client(client)
{
ASSERT(m_client);
m_webHandler = adoptPtr(WebKit::Platform::current()->createRTCPeerConnectionHandler(this));
}
RTCPeerConnectionHandlerChromium::~RTCPeerConnectionHandlerChromium()
......@@ -72,8 +78,10 @@ RTCPeerConnectionHandlerChromium::~RTCPeerConnectionHandlerChromium()
bool RTCPeerConnectionHandlerChromium::initialize(PassRefPtr<RTCConfiguration> configuration, PassRefPtr<MediaConstraints> constraints)
{
m_webHandler = adoptPtr(WebKit::Platform::current()->createRTCPeerConnectionHandler(this));
return m_webHandler ? m_webHandler->initialize(configuration, constraints) : false;
if (!m_webHandler)
return false;
return m_webHandler->initialize(configuration, constraints);
}
void RTCPeerConnectionHandlerChromium::createOffer(PassRefPtr<RTCSessionDescriptionRequest> request, PassRefPtr<MediaConstraints> constraints)
......
......@@ -49,7 +49,7 @@ namespace WebCore {
class RTCPeerConnectionHandlerChromium : public RTCPeerConnectionHandler, public WebKit::WebRTCPeerConnectionHandlerClient {
public:
RTCPeerConnectionHandlerChromium(RTCPeerConnectionHandlerClient*);
explicit RTCPeerConnectionHandlerChromium(RTCPeerConnectionHandlerClient*);
virtual ~RTCPeerConnectionHandlerChromium();
virtual bool initialize(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) OVERRIDE;
......@@ -75,6 +75,8 @@ public:
virtual void didAddRemoteStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE;
virtual void didRemoveRemoteStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE;
static WebKit::WebRTCPeerConnectionHandler* toWebRTCPeerConnectionHandler(RTCPeerConnectionHandler*);
private:
OwnPtr<WebKit::WebRTCPeerConnectionHandler> m_webHandler;
RTCPeerConnectionHandlerClient* m_client;
......
2012-10-03 Tommy Widenflycht <tommyw@google.com>
MediaStream API: RTCPeerConnection should send down its handler via the FrameLoaderClient directly after creation.
https://bugs.webkit.org/show_bug.cgi?id=98149
Reviewed by Adam Barth.
Adding willStartUsingPeerConnectionHandler to the WebFrameClient.
* public/WebFrameClient.h:
(WebKit):
(WebFrameClient):
(WebKit::WebFrameClient::willStartUsingPeerConnectionHandler):
* src/FrameLoaderClientImpl.cpp:
(WebKit):
(WebKit::FrameLoaderClientImpl::dispatchWillStartUsingPeerConnectionHandler):
* src/FrameLoaderClientImpl.h:
(FrameLoaderClientImpl):
2012-10-03 Peter Kotwicz <pkotwicz@google.com>
WebImage::framesFromData should skip corrupted frames
......
......@@ -62,6 +62,7 @@ class WebMediaPlayer;
class WebMediaPlayerClient;
class WebNode;
class WebPlugin;
class WebRTCPeerConnectionHandler;
class WebSharedWorker;
class WebSharedWorkerClient;
class WebSocketStreamHandle;
......@@ -398,6 +399,11 @@ public:
// A WebSocket object is going to open new stream connection.
virtual void willOpenSocketStream(WebSocketStreamHandle*) { }
// MediaStream -----------------------------------------------------
// A new WebRTCPeerConnectionHandler is created.
virtual void willStartUsingPeerConnectionHandler(WebFrame*, WebRTCPeerConnectionHandler*) { }
// Messages ------------------------------------------------------
// Notifies the embedder that a postMessage was issued on this frame, and
......
......@@ -57,6 +57,9 @@
#include "ProgressTracker.h"
#include "ResourceHandleInternal.h"
#include "ResourceLoader.h"
#if ENABLE(MEDIA_STREAM)
#include "RTCPeerConnectionHandlerChromium.h"
#endif
#include "Settings.h"
#include "SocketStreamHandleInternal.h"
#include "WebDOMEvent.h"
......@@ -1638,4 +1641,12 @@ void FrameLoaderClientImpl::dispatchWillOpenSocketStream(SocketStreamHandle* han
m_webFrame->client()->willOpenSocketStream(SocketStreamHandleInternal::toWebSocketStreamHandle(handle));
}
#if ENABLE(MEDIA_STREAM)
void FrameLoaderClientImpl::dispatchWillStartUsingPeerConnectionHandler(RTCPeerConnectionHandler* handler)
{
m_webFrame->client()->willStartUsingPeerConnectionHandler(webFrame(), RTCPeerConnectionHandlerChromium::toWebRTCPeerConnectionHandler(handler));
}
#endif
} // namespace WebKit
......@@ -220,6 +220,10 @@ public:
virtual void dispatchWillOpenSocketStream(WebCore::SocketStreamHandle*) OVERRIDE;
#if ENABLE(MEDIA_STREAM)
virtual void dispatchWillStartUsingPeerConnectionHandler(WebCore::RTCPeerConnectionHandler*) OVERRIDE;
#endif
private:
void makeDocumentView();
......
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