GraphicsSurface should not modify the current GL context.
https://bugs.webkit.org/show_bug.cgi?id=99320

Instead of reusing the currently bound GL context for drawing
the texture onto the GraphicsSurface, GraphicsSurface should
create a new context that shares the texture names with a context
provided by the caller.
This way the OpenGL states are clearly separated and we do not
risk interfeering with the currently bound GL context.

Reviewed by Noam Rosenthal.

* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
    When creating a GraphicsSurface pass the platform GL context
    as a parameter, so it can be used for sharing textures with.
(WebCore::GraphicsContext3DPrivate::copyToGraphicsSurface):
    Pass the texture instead of the FBO. A Texture can be drawn
    directly or bound to another FBO, where a framebuffer
    always needs to be blit onto the surface.
(WebCore::GraphicsContext3DPrivate::createGraphicsSurfaces):
    Pass the platform GL context as a parameter.
* platform/graphics/surfaces/GraphicsSurface.cpp:
(WebCore::GraphicsSurface::create):
(WebCore::GraphicsSurface::copyFromTexture):
* platform/graphics/surfaces/GraphicsSurface.h:
(GraphicsSurface):
* platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp:
(WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):
    Create a new GL context that shares the textures with the
    context provided by the caller.
(WebCore::GraphicsSurfacePrivate::~GraphicsSurfacePrivate):
(WebCore::GraphicsSurfacePrivate::makeCurrent):
    Add a convenience function to make the context that
    belongs to the surface current.
(GraphicsSurfacePrivate):
(WebCore::GraphicsSurfacePrivate::doneCurrent):
    Add a convenience function to make the previously
    bound context current again.
(WebCore::GraphicsSurfacePrivate::copyFromTexture):
    Move blitting of the texture onto the surface
    into a separate function within GraphicsSurfacePrivate.
(WebCore::GraphicsSurface::platformCopyFromTexture):
    Rename function platformCopyFromFramebuffer to
    platformCopyFromTexture, as we are now passing the texture only.
(WebCore::GraphicsSurface::platformCreate):
* platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp:
(WebCore):
(WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):
(WebCore::GraphicsSurfacePrivate::makeCurrent):
    Add a convenience function to make the context that
    belongs to the surface current.
(GraphicsSurfacePrivate):
(WebCore::GraphicsSurfacePrivate::doneCurrent):
    Add a convenience function to make the previously
(WebCore::GraphicsSurfacePrivate::copyFromTexture):
    Move blitting of the texture onto the surface
    into a separate function within GraphicsSurfacePrivate.
(WebCore::resolveGLMethods):
    Resolve additional GL methods necessary for this change.
(WebCore::GraphicsSurface::platformCopyFromTexture):
    Rename function platformCopyFromFramebuffer to
    platformCopyFromTexture, as we are now passing the texture only.
(WebCore::GraphicsSurface::platformCreate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131719 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Temporarily disable use of QCocoaNativeInterface in GraphicsSurfaceMac.
https://bugs.webkit.org/show_bug.cgi?id=99320

The current version of Qt5 deployed on the buildbots does not yet have
an implementation for QCocoaNativeInterface::nativeResourceForContext().
Therefore we disable this code path until Qt5/qtbase has been updated to
a revision above Change-Id: Id00efc88a73d7df04a68c022f19d9d1c4f6d386b.

Once Qt5 has been updated, this patch must be reverted.

Reviewed by Noam Rosenthal.

* platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp:
(WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
MediaStream API: Add better RTCPeerConnectionHandler creation logic
https://bugs.webkit.org/show_bug.cgi?id=99308

Reviewed by Adam Barth.

This patch makes sure that if the RTCPeerConnectionHandler can't be fully initialized/created
the RTCPeerConnection constructor throws an exception.

Not full testable, existing tests cover the normal case though.

* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
(WebCore::RTCPeerConnectionHandler::create):
(WebCore::RTCPeerConnectionHandlerChromium::RTCPeerConnectionHandlerChromium):
(WebCore::RTCPeerConnectionHandlerChromium::createWebHandler):
(WebCore::RTCPeerConnectionHandlerChromium::initialize):
(WebCore::RTCPeerConnectionHandlerChromium::createOffer):
(WebCore::RTCPeerConnectionHandlerChromium::createAnswer):
(WebCore::RTCPeerConnectionHandlerChromium::setLocalDescription):
(WebCore::RTCPeerConnectionHandlerChromium::setRemoteDescription):
(WebCore::RTCPeerConnectionHandlerChromium::updateIce):
(WebCore::RTCPeerConnectionHandlerChromium::addIceCandidate):
(WebCore::RTCPeerConnectionHandlerChromium::localDescription):
(WebCore::RTCPeerConnectionHandlerChromium::remoteDescription):
(WebCore::RTCPeerConnectionHandlerChromium::addStream):
(WebCore::RTCPeerConnectionHandlerChromium::removeStream):
(WebCore::RTCPeerConnectionHandlerChromium::getStats):
(WebCore::RTCPeerConnectionHandlerChromium::openDataChannel):
(WebCore::RTCPeerConnectionHandlerChromium::sendStringData):
(WebCore::RTCPeerConnectionHandlerChromium::sendRawData):
(WebCore::RTCPeerConnectionHandlerChromium::closeDataChannel):
(WebCore::RTCPeerConnectionHandlerChromium::stop):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h:
(RTCPeerConnectionHandlerChromium):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131721 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] Fix incorrect test expectations of messages_unittest.py.
https://bugs.webkit.org/show_bug.cgi?id=99699

Patch by Byungwoo Lee <bw80.lee@samsung.com> on 2012-10-18
Reviewed by Gyuyoung Kim.

Fix the expected results of messages_unittest.py.

The expected result of messages_unittest.py has bugs, and it makes failure on python test.

* Scripts/webkit2/messages_unittest.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131722 268f45cc-cd09-0410-ab3c-d52691b4dbfc