Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (211160 => 211161)
--- trunk/Source/WebCore/CMakeLists.txt 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebCore/CMakeLists.txt 2017-01-25 21:00:11 UTC (rev 211161)
@@ -88,6 +88,7 @@
"${WEBCORE_DIR}/platform/graphics/opentype"
"${WEBCORE_DIR}/platform/graphics/transforms"
"${WEBCORE_DIR}/platform/mediastream"
+ "${WEBCORE_DIR}/platform/mediastream/libwebrtc"
"${WEBCORE_DIR}/platform/mock"
"${WEBCORE_DIR}/platform/mock/mediasource"
"${WEBCORE_DIR}/platform/network"
Modified: trunk/Source/WebCore/ChangeLog (211160 => 211161)
--- trunk/Source/WebCore/ChangeLog 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebCore/ChangeLog 2017-01-25 21:00:11 UTC (rev 211161)
@@ -1,3 +1,43 @@
+2017-01-25 Youenn Fablet <[email protected]>
+
+ [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
+ https://bugs.webkit.org/show_bug.cgi?id=167294
+
+ Reviewed by Alex Christensen.
+
+ Introducing LibWebRTCMacros.h which should be included before any libwebrtc header.
+
+ Introducing LibWebRTCProvider as the abstraction allowing to suport WK1 and WK2 libwebrtc-based WebRTC endpoints.
+ It will create a libwebrtc peerconnection object differently in WK1 and WK2 as networking will be done differently.
+
+ LibWebRTCUtils contains routines used by WK1 and WK2 RTC providers to create the libwebrtc peerconnection object
+ and implement the necessary functionalities for it.
+
+ Updating PageConfiguration accordingly.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ * page/Page.h:
+ (WebCore::Page::libWebRTCProvider):
+ * page/PageConfiguration.cpp:
+ (WebCore::PageConfiguration::PageConfiguration):
+ * page/PageConfiguration.h:
+ * platform/mediastream/libwebrtc/LibWebRTCMacros.h: Added.
+ * platform/mediastream/libwebrtc/LibWebRTCProvider.h: Added.
+ * platform/mediastream/libwebrtc/LibWebRTCUtils.cpp: Added.
+ (WebCore::staticFactoryAndThreads):
+ (WebCore::ThreadMessageData::ThreadMessageData):
+ (WebCore::PeerConnectionFactoryAndThreads::OnMessage):
+ (WebCore::callOnWebRTCNetworkThread):
+ (WebCore::initializePeerConnectionFactoryAndThreads):
+ (WebCore::initializeLibWebRTCInternalsWithSocketServer):
+ (WebCore::peerConnectionFactory):
+ (WebCore::createPeerConnection):
+ * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Added.
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::dataChanged):
+
2017-01-25 Wenson Hsieh <[email protected]>
Add support for named pasteboards, pasteboard strategies and platform pasteboards
Modified: trunk/Source/WebCore/PlatformWin.cmake (211160 => 211161)
--- trunk/Source/WebCore/PlatformWin.cmake 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebCore/PlatformWin.cmake 2017-01-25 21:00:11 UTC (rev 211161)
@@ -243,6 +243,8 @@
platform/graphics/transforms
platform/graphics/win
+ platform/mediastream/libwebrtc
+
platform/text/transcoder
rendering/line
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (211160 => 211161)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-01-25 21:00:11 UTC (rev 211161)
@@ -1534,6 +1534,10 @@
4150F9F112B6E0E70008C860 /* SliderThumbElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */; };
4150F9F212B6E0E70008C860 /* SliderThumbElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */; };
415670471DBE1533009AC3BB /* PeerConnectionStates.h in Headers */ = {isa = PBXBuildFile; fileRef = 415670461DBE1524009AC3BB /* PeerConnectionStates.h */; };
+ 415747471E3869A400E914D8 /* LibWebRTCMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 415747431E38699E00E914D8 /* LibWebRTCMacros.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 415747481E3869A700E914D8 /* LibWebRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 415747441E38699E00E914D8 /* LibWebRTCProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 415747491E3869AA00E914D8 /* LibWebRTCUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 415747451E38699E00E914D8 /* LibWebRTCUtils.cpp */; };
+ 4157474A1E3869AD00E914D8 /* LibWebRTCUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 415747461E38699E00E914D8 /* LibWebRTCUtils.h */; settings = {ATTRIBUTES = (Private, ); }; };
4157AF8012F1FB0400A8C6F5 /* MediaControlsApple.h in Headers */ = {isa = PBXBuildFile; fileRef = 4157AF7E12F1FB0400A8C6F5 /* MediaControlsApple.h */; };
4157AF8112F1FB0400A8C6F5 /* MediaControlsApple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4157AF7F12F1FB0400A8C6F5 /* MediaControlsApple.cpp */; };
41614A781DA6423B004AD06F /* HTTPHeaderValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41614A761DA64236004AD06F /* HTTPHeaderValues.cpp */; };
@@ -8704,6 +8708,10 @@
4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SliderThumbElement.h; sourceTree = "<group>"; };
4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SliderThumbElement.cpp; sourceTree = "<group>"; };
415670461DBE1524009AC3BB /* PeerConnectionStates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeerConnectionStates.h; sourceTree = "<group>"; };
+ 415747431E38699E00E914D8 /* LibWebRTCMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCMacros.h; path = libwebrtc/LibWebRTCMacros.h; sourceTree = "<group>"; };
+ 415747441E38699E00E914D8 /* LibWebRTCProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCProvider.h; path = libwebrtc/LibWebRTCProvider.h; sourceTree = "<group>"; };
+ 415747451E38699E00E914D8 /* LibWebRTCUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCUtils.cpp; path = libwebrtc/LibWebRTCUtils.cpp; sourceTree = "<group>"; };
+ 415747461E38699E00E914D8 /* LibWebRTCUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCUtils.h; path = libwebrtc/LibWebRTCUtils.h; sourceTree = "<group>"; };
4157AF7E12F1FB0400A8C6F5 /* MediaControlsApple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControlsApple.h; sourceTree = "<group>"; };
4157AF7F12F1FB0400A8C6F5 /* MediaControlsApple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaControlsApple.cpp; sourceTree = "<group>"; };
41614A761DA64236004AD06F /* HTTPHeaderValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPHeaderValues.cpp; sourceTree = "<group>"; };
@@ -15210,6 +15218,7 @@
07221B9217CF0AD400848E51 /* mediastream */ = {
isa = PBXGroup;
children = (
+ 415747421E38698000E914D8 /* libwebrtc */,
0729B14D17CFCCA0004F1D60 /* mac */,
07D6A4F61BF2307D00174146 /* AudioTrackPrivateMediaStream.h */,
07B7116A1D899E63009F0FFB /* CaptureDevice.h */,
@@ -16622,6 +16631,17 @@
path = shadow;
sourceTree = "<group>";
};
+ 415747421E38698000E914D8 /* libwebrtc */ = {
+ isa = PBXGroup;
+ children = (
+ 415747431E38699E00E914D8 /* LibWebRTCMacros.h */,
+ 415747441E38699E00E914D8 /* LibWebRTCProvider.h */,
+ 415747451E38699E00E914D8 /* LibWebRTCUtils.cpp */,
+ 415747461E38699E00E914D8 /* LibWebRTCUtils.h */,
+ );
+ name = libwebrtc;
+ sourceTree = "<group>";
+ };
417DA4CD13734204007C57FB /* testing */ = {
isa = PBXGroup;
children = (
@@ -25719,6 +25739,7 @@
085B92BB0EFDE73D00E6123C /* FormDataBuilder.h in Headers */,
A8136D380973A8E700D74463 /* FormDataList.h in Headers */,
7EE6846712D26E3800E79415 /* FormDataStreamCFNet.h in Headers */,
+ 4157474A1E3869AD00E914D8 /* LibWebRTCUtils.h in Headers */,
514C764E0CE9234E007EF3CD /* FormDataStreamMac.h in Headers */,
9B50B1DE17CD4C0F0087F63C /* FormNamedItem.h in Headers */,
656D373A0ADBA5DE00A4554D /* FormState.h in Headers */,
@@ -25800,6 +25821,7 @@
4969B0F313D0B33F00DF3521 /* HitTestingTransformState.h in Headers */,
2D8287F716E4A0380086BD00 /* HitTestLocation.h in Headers */,
930908910AF7EDE40081DF01 /* HitTestRequest.h in Headers */,
+ 415747471E3869A400E914D8 /* LibWebRTCMacros.h in Headers */,
9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */,
BC3BC29C0E91AB0F00835588 /* HostWindow.h in Headers */,
FD31609912B026F700C1A359 /* HRTFDatabase.h in Headers */,
@@ -27460,6 +27482,7 @@
4998AEC613F9D0EA0090B1AA /* RequestAnimationFrameCallback.h in Headers */,
F55B3DD01251F12D003EF269 /* ResetInputType.h in Headers */,
7EE6846A12D26E3800E79415 /* ResourceError.h in Headers */,
+ 415747481E3869A700E914D8 /* LibWebRTCProvider.h in Headers */,
934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */,
514C76790CE923A1007EF3CD /* ResourceHandle.h in Headers */,
26FAE4CD1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h in Headers */,
@@ -31300,6 +31323,7 @@
512DD8E30D91E2B4000F89EE /* SharedBufferCF.cpp in Sources */,
97B1F02E13B025CA00F5103F /* SharedBufferChunkReader.cpp in Sources */,
1A4A95520B4EDCFF002D8C3C /* SharedBufferCocoa.mm in Sources */,
+ 415747491E3869AA00E914D8 /* LibWebRTCUtils.cpp in Sources */,
163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */,
E48944A2180B57D800F165D8 /* SimpleLineLayout.cpp in Sources */,
585D6E031A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp in Sources */,
Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (211160 => 211161)
--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp 2017-01-25 21:00:11 UTC (rev 211161)
@@ -37,6 +37,7 @@
#include "GraphicsContext.h"
#include "InspectorClient.h"
#include "InspectorOverlayPage.h"
+#include "LibWebRTCProvider.h"
#include "MainFrame.h"
#include "Node.h"
#include "Page.h"
@@ -859,7 +860,11 @@
if (m_overlayPage)
return m_overlayPage.get();
- PageConfiguration pageConfiguration(createEmptyEditorClient(), SocketProvider::create());
+ PageConfiguration pageConfiguration(
+ createEmptyEditorClient(),
+ SocketProvider::create(),
+ makeUniqueRef<LibWebRTCProvider>()
+ );
fillWithEmptyClients(pageConfiguration);
m_overlayPage = std::make_unique<Page>(WTFMove(pageConfiguration));
m_overlayPage->setDeviceScaleFactor(m_page.deviceScaleFactor());
Modified: trunk/Source/WebCore/page/Page.cpp (211160 => 211161)
--- trunk/Source/WebCore/page/Page.cpp 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebCore/page/Page.cpp 2017-01-25 21:00:11 UTC (rev 211161)
@@ -55,6 +55,7 @@
#include "HistoryItem.h"
#include "InspectorController.h"
#include "InspectorInstrumentation.h"
+#include "LibWebRTCProvider.h"
#include "Logging.h"
#include "MainFrame.h"
#include "MediaCanStartListener.h"
@@ -201,6 +202,7 @@
, m_validationMessageClient(WTFMove(pageConfiguration.validationMessageClient))
, m_diagnosticLoggingClient(WTFMove(pageConfiguration.diagnosticLoggingClient))
, m_webGLStateTracker(WTFMove(pageConfiguration.webGLStateTracker))
+ , m_libWebRTCProvider(WTFMove(pageConfiguration.libWebRTCProvider))
, m_openedByDOM(false)
, m_tabKeyCyclesThroughElements(true)
, m_defersLoading(false)
Modified: trunk/Source/WebCore/page/Page.h (211160 => 211161)
--- trunk/Source/WebCore/page/Page.h 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebCore/page/Page.h 2017-01-25 21:00:11 UTC (rev 211161)
@@ -97,6 +97,7 @@
class UserInputBridge;
class InspectorClient;
class InspectorController;
+class LibWebRTCProvider;
class MainFrame;
class MediaCanStartListener;
class MediaPlaybackTarget;
@@ -109,9 +110,7 @@
class PluginData;
class PluginInfoProvider;
class PluginViewBase;
-#if ENABLE(POINTER_LOCK)
class PointerLockController;
-#endif
class ProgressTracker;
class ProgressTrackerClient;
class Range;
@@ -223,6 +222,7 @@
#if ENABLE(POINTER_LOCK)
PointerLockController& pointerLockController() const { return *m_pointerLockController; }
#endif
+ LibWebRTCProvider& libWebRTCProvider() { return m_libWebRTCProvider.get(); }
ValidationMessageClient* validationMessageClient() const { return m_validationMessageClient.get(); }
void updateValidationBubbleStateIfNeeded();
@@ -631,6 +631,8 @@
std::unique_ptr<DiagnosticLoggingClient> m_diagnosticLoggingClient;
std::unique_ptr<WebGLStateTracker> m_webGLStateTracker;
+ UniqueRef<LibWebRTCProvider> m_libWebRTCProvider;
+
int m_nestedRunLoopCount { 0 };
std::function<void()> m_unnestCallback;
Modified: trunk/Source/WebCore/page/PageConfiguration.cpp (211160 => 211161)
--- trunk/Source/WebCore/page/PageConfiguration.cpp 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebCore/page/PageConfiguration.cpp 2017-01-25 21:00:11 UTC (rev 211161)
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -31,6 +31,7 @@
#include "DatabaseProvider.h"
#include "DiagnosticLoggingClient.h"
#include "EditorClient.h"
+#include "LibWebRTCProvider.h"
#include "PluginInfoProvider.h"
#include "SocketProvider.h"
#include "StorageNamespaceProvider.h"
@@ -41,9 +42,10 @@
namespace WebCore {
-PageConfiguration::PageConfiguration(UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider)
+PageConfiguration::PageConfiguration(UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider, UniqueRef<LibWebRTCProvider>&& libWebRTCProvider)
: editorClient(WTFMove(editorClient))
, socketProvider(WTFMove(socketProvider))
+ , libWebRTCProvider(WTFMove(libWebRTCProvider))
{
}
Modified: trunk/Source/WebCore/page/PageConfiguration.h (211160 => 211161)
--- trunk/Source/WebCore/page/PageConfiguration.h 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebCore/page/PageConfiguration.h 2017-01-25 21:00:11 UTC (rev 211161)
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
@@ -35,6 +35,7 @@
class ApplicationCacheStorage;
class BackForwardClient;
class ChromeClient;
+class ContextMenuClient;
class DatabaseProvider;
class DiagnosticLoggingClient;
class DragClient;
@@ -41,6 +42,7 @@
class EditorClient;
class FrameLoaderClient;
class InspectorClient;
+class LibWebRTCProvider;
class PaymentCoordinatorClient;
class PlugInClient;
class PluginInfoProvider;
@@ -52,14 +54,10 @@
class VisitedLinkStore;
class WebGLStateTracker;
-#if ENABLE(CONTEXT_MENUS)
-class ContextMenuClient;
-#endif
-
class PageConfiguration {
WTF_MAKE_NONCOPYABLE(PageConfiguration); WTF_MAKE_FAST_ALLOCATED;
public:
- WEBCORE_EXPORT PageConfiguration(UniqueRef<EditorClient>&&, Ref<SocketProvider>&&);
+ WEBCORE_EXPORT PageConfiguration(UniqueRef<EditorClient>&&, Ref<SocketProvider>&&, UniqueRef<LibWebRTCProvider>&&);
WEBCORE_EXPORT ~PageConfiguration();
AlternativeTextClient* alternativeTextClient { nullptr };
@@ -75,6 +73,8 @@
PaymentCoordinatorClient* paymentCoordinatorClient { nullptr };
#endif
+ UniqueRef<LibWebRTCProvider> libWebRTCProvider;
+
PlugInClient* plugInClient { nullptr };
ProgressTrackerClient* progressTrackerClient { nullptr };
RefPtr<BackForwardClient> backForwardClient;
Added: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCMacros.h (0 => 211161)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCMacros.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCMacros.h 2017-01-25 21:00:11 UTC (rev 211161)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 Apple Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(LIBWEBRTC)
+
+#if PLATFORM(IOS)
+#define WEBRTC_IOS
+#endif
+
+#if PLATFORM(MAC)
+#define WEBRTC_MAC
+#endif
+
+#define WEBRTC_POSIX 1
+#define _COMMON_INCLUDED_
+
+#endif // USE(LIBWEBRTC)
Added: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h (0 => 211161)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h 2017-01-25 21:00:11 UTC (rev 211161)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(LIBWEBRTC)
+#include "LibWebRTCMacros.h"
+#include <webrtc/api/peerconnectioninterface.h>
+#endif
+
+namespace WebCore {
+
+class WEBCORE_EXPORT LibWebRTCProvider {
+public:
+#if USE(LIBWEBRTC)
+ virtual rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&) { return createPeerConnection(observer); };
+#endif
+ virtual ~LibWebRTCProvider() = default;
+
+};
+
+} // namespace WebCore
Added: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp (0 => 211161)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp 2017-01-25 21:00:11 UTC (rev 211161)
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2017 Apple Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "LibWebRTCUtils.h"
+
+#if USE(LIBWEBRTC)
+
+#include <webrtc/api/peerconnectionfactory.h>
+#include <webrtc/base/physicalsocketserver.h>
+#include <webrtc/p2p/client/basicportallocator.h>
+#include <webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h>
+#include <wtf/Function.h>
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+struct PeerConnectionFactoryAndThreads : public rtc::MessageHandler {
+ std::unique_ptr<rtc::Thread> networkThread;
+ std::unique_ptr<rtc::Thread> signalingThread;
+ rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory;
+ bool networkThreadWithSocketServer { false };
+private:
+ void OnMessage(rtc::Message*);
+};
+
+static inline PeerConnectionFactoryAndThreads& staticFactoryAndThreads()
+{
+ static NeverDestroyed<PeerConnectionFactoryAndThreads> factoryAndThreads;
+ return factoryAndThreads.get();
+}
+
+struct ThreadMessageData : public rtc::MessageData {
+ ThreadMessageData(Function<void()>&& callback)
+ : callback(WTFMove(callback))
+ { }
+ Function<void()> callback;
+};
+
+void PeerConnectionFactoryAndThreads::OnMessage(rtc::Message* message)
+{
+ ASSERT(message->message_id == 1);
+ static_cast<ThreadMessageData*>(message->pdata)->callback();
+}
+
+void callOnWebRTCNetworkThread(Function<void()>&& callback)
+{
+ PeerConnectionFactoryAndThreads& threads = staticFactoryAndThreads();
+ threads.networkThread->Post(RTC_FROM_HERE, &threads, 1, new ThreadMessageData(WTFMove(callback)));
+}
+
+static void initializePeerConnectionFactoryAndThreads()
+{
+ auto& factoryAndThreads = staticFactoryAndThreads();
+
+ ASSERT(!factoryAndThreads.factory);
+
+ auto thread = rtc::Thread::Create();
+ factoryAndThreads.networkThread = factoryAndThreads.networkThreadWithSocketServer ? rtc::Thread::CreateWithSocketServer() : rtc::Thread::Create();
+ bool result = factoryAndThreads.networkThread->Start();
+ ASSERT_UNUSED(result, result);
+
+ factoryAndThreads.signalingThread = rtc::Thread::Create();
+ result = factoryAndThreads.signalingThread->Start();
+ ASSERT(result);
+
+ factoryAndThreads.factory = webrtc::CreatePeerConnectionFactory(factoryAndThreads.networkThread.get(), factoryAndThreads.networkThread.get(), factoryAndThreads.signalingThread.get(), nullptr, new webrtc::VideoToolboxVideoEncoderFactory() , new webrtc::VideoToolboxVideoDecoderFactory());
+
+ ASSERT(factoryAndThreads.factory);
+}
+
+void initializeLibWebRTCInternalsWithSocketServer()
+{
+ staticFactoryAndThreads().networkThreadWithSocketServer = true;
+}
+
+webrtc::PeerConnectionFactoryInterface& peerConnectionFactory()
+{
+ if (!staticFactoryAndThreads().factory)
+ initializePeerConnectionFactoryAndThreads();
+ return *staticFactoryAndThreads().factory;
+}
+
+static rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver& observer, std::unique_ptr<cricket::BasicPortAllocator>&& portAllocator)
+{
+ ASSERT(staticFactoryAndThreads().factory);
+
+ webrtc::PeerConnectionInterface::RTCConfiguration config;
+ // FIXME: Add a default configuration.
+ return staticFactoryAndThreads().factory->CreatePeerConnection(config, WTFMove(portAllocator), nullptr, &observer);
+}
+
+rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver& observer)
+{
+ ASSERT(staticFactoryAndThreads().networkThreadWithSocketServer);
+
+ auto& factoryAndThreads = staticFactoryAndThreads();
+ if (!factoryAndThreads.factory)
+ initializePeerConnectionFactoryAndThreads();
+
+ return createPeerConnection(observer, nullptr);
+}
+
+rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver& observer, rtc::NetworkManager& networkManager, rtc::PacketSocketFactory& packetSocketFactory)
+{
+ ASSERT(!staticFactoryAndThreads().networkThreadWithSocketServer);
+
+ auto& factoryAndThreads = staticFactoryAndThreads();
+ if (!factoryAndThreads.factory)
+ initializePeerConnectionFactoryAndThreads();
+
+ std::unique_ptr<cricket::BasicPortAllocator> portAllocator;
+ staticFactoryAndThreads().signalingThread->Invoke<void>(RTC_FROM_HERE, [&]() {
+ portAllocator.reset(new cricket::BasicPortAllocator(&networkManager, &packetSocketFactory));
+ });
+
+ return createPeerConnection(observer, WTFMove(portAllocator));
+}
+
+} // namespace WebCore
+
+#endif // USE(LIBWEBRTC)
Added: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.h (0 => 211161)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.h 2017-01-25 21:00:11 UTC (rev 211161)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(LIBWEBRTC)
+
+#include "LibWebRTCMacros.h"
+#include <webrtc/base/scoped_ref_ptr.h>
+#include <wtf/Forward.h>
+
+namespace rtc {
+class NetworkManager;
+class PacketSocketFactory;
+}
+
+namespace webrtc {
+class PeerConnectionFactoryInterface;
+class PeerConnectionInterface;
+class PeerConnectionObserver;
+}
+
+namespace WebCore {
+
+WEBCORE_EXPORT void initializeLibWebRTCInternalsWithSocketServer();
+
+webrtc::PeerConnectionFactoryInterface& peerConnectionFactory();
+WEBCORE_EXPORT rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&, rtc::NetworkManager&, rtc::PacketSocketFactory&);
+WEBCORE_EXPORT rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&);
+
+WEBCORE_EXPORT void callOnWebRTCNetworkThread(Function<void()>&&);
+
+} // namespace WebCore
+
+#endif // USE(LIBWEBRTC)
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (211160 => 211161)
--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2017-01-25 21:00:11 UTC (rev 211161)
@@ -40,6 +40,7 @@
#include "ImageObserver.h"
#include "IntRect.h"
#include "JSDOMWindowBase.h"
+#include "LibWebRTCProvider.h"
#include "MainFrame.h"
#include "Page.h"
#include "PageConfiguration.h"
@@ -414,7 +415,11 @@
return true;
if (allDataReceived) {
- PageConfiguration pageConfiguration(createEmptyEditorClient(), SocketProvider::create());
+ PageConfiguration pageConfiguration(
+ createEmptyEditorClient(),
+ SocketProvider::create(),
+ makeUniqueRef<LibWebRTCProvider>()
+ );
fillWithEmptyClients(pageConfiguration);
m_chromeClient = std::make_unique<SVGImageChromeClient>(this);
pageConfiguration.chromeClient = m_chromeClient.get();
Modified: trunk/Source/WebKit/mac/ChangeLog (211160 => 211161)
--- trunk/Source/WebKit/mac/ChangeLog 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-01-25 21:00:11 UTC (rev 211161)
@@ -1,3 +1,13 @@
+2017-01-24 Youenn Fablet <[email protected]>
+
+ [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
+ https://bugs.webkit.org/show_bug.cgi?id=167294
+
+ Reviewed by Alex Christensen.
+
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+
2017-01-25 Wenson Hsieh <[email protected]>
Add support for named pasteboards, pasteboard strategies and platform pasteboards
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (211160 => 211161)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2017-01-25 21:00:11 UTC (rev 211161)
@@ -157,6 +157,7 @@
#import <WebCore/JSElement.h>
#import <WebCore/JSNodeList.h>
#import <WebCore/JSNotification.h>
+#import <WebCore/LibWebRTCProvider.h>
#import <WebCore/LocalizedStrings.h>
#import <WebCore/LogInitialization.h>
#import <WebCore/MIMETypeRegistry.h>
@@ -1342,7 +1343,11 @@
_private->group = WebViewGroup::getOrCreate(groupName, _private->preferences._localStorageDatabasePath);
_private->group->addWebView(self);
- PageConfiguration pageConfiguration(makeUniqueRef<WebEditorClient>(self), SocketProvider::create());
+ PageConfiguration pageConfiguration(
+ makeUniqueRef<WebEditorClient>(self),
+ SocketProvider::create(),
+ makeUniqueRef<WebCore::LibWebRTCProvider>()
+ );
#if !PLATFORM(IOS)
pageConfiguration.chromeClient = new WebChromeClient(self);
pageConfiguration.contextMenuClient = new WebContextMenuClient(self);
@@ -1597,7 +1602,11 @@
_private->group = WebViewGroup::getOrCreate(groupName, _private->preferences._localStorageDatabasePath);
_private->group->addWebView(self);
- PageConfiguration pageConfiguration(makeUniqueRef<WebEditorClient>(self), SocketProvider::create());
+ PageConfiguration pageConfiguration(
+ makeUniqueRef<WebEditorClient>(self),
+ SocketProvider::create(),
+ makeUniqueRef<WebCore::LibWebRTCProvider>()
+ );
pageConfiguration.chromeClient = new WebChromeClientIOS(self);
#if ENABLE(DRAG_SUPPORT)
pageConfiguration.dragClient = new WebDragClient(self);
Modified: trunk/Source/WebKit/win/ChangeLog (211160 => 211161)
--- trunk/Source/WebKit/win/ChangeLog 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebKit/win/ChangeLog 2017-01-25 21:00:11 UTC (rev 211161)
@@ -1,3 +1,13 @@
+2017-01-24 Youenn Fablet <[email protected]>
+
+ [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
+ https://bugs.webkit.org/show_bug.cgi?id=167294
+
+ Reviewed by Alex Christensen.
+
+ * WebView.cpp:
+ (WebView::initWithFrame):
+
2017-01-23 Chris Dumez <[email protected]>
REGRESSION (r211033): ASSERTION FAILED: m_ptr in com.apple.WebCore: WTF::RefPtr<WebCore::Element>::operator* const + 70
Modified: trunk/Source/WebKit/win/WebView.cpp (211160 => 211161)
--- trunk/Source/WebKit/win/WebView.cpp 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebKit/win/WebView.cpp 2017-01-25 21:00:11 UTC (rev 211161)
@@ -122,6 +122,7 @@
#include <WebCore/IntRect.h>
#include <WebCore/JSElement.h>
#include <WebCore/KeyboardEvent.h>
+#include <WebCore/LibWebRTCProvider.h>
#include <WebCore/LogInitialization.h>
#include <WebCore/Logging.h>
#include <WebCore/MIMETypeRegistry.h>
@@ -3099,7 +3100,11 @@
m_inspectorClient = new WebInspectorClient(this);
- PageConfiguration configuration(makeUniqueRef<WebEditorClient>(this), SocketProvider::create());
+ PageConfiguration configuration(
+ makeUniqueRef<WebEditorClient>(this),
+ SocketProvider::create(),
+ makeUniqueRef<LibWebRTCProvider>()
+ );
configuration.backForwardClient = BackForwardList::create();
configuration.chromeClient = new WebChromeClient(this);
configuration.contextMenuClient = new WebContextMenuClient(this);
Modified: trunk/Source/WebKit2/ChangeLog (211160 => 211161)
--- trunk/Source/WebKit2/ChangeLog 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebKit2/ChangeLog 2017-01-25 21:00:11 UTC (rev 211161)
@@ -1,3 +1,13 @@
+2017-01-25 Youenn Fablet <[email protected]>
+
+ [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
+ https://bugs.webkit.org/show_bug.cgi?id=167294
+
+ Reviewed by Alex Christensen.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::m_userInterfaceLayoutDirection):
+
2017-01-25 Andy Estes <[email protected]>
[iOS] Move WKPDFView's password view to WKWebView
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (211160 => 211161)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-01-25 20:48:41 UTC (rev 211160)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-01-25 21:00:11 UTC (rev 211161)
@@ -147,6 +147,7 @@
#include <WebCore/InspectorController.h>
#include <WebCore/JSDOMWindow.h>
#include <WebCore/KeyboardEvent.h>
+#include <WebCore/LibWebRTCProvider.h>
#include <WebCore/MIMETypeRegistry.h>
#include <WebCore/MainFrame.h>
#include <WebCore/MouseEvent.h>
@@ -373,7 +374,11 @@
Settings::setShouldManageAudioSessionCategory(true);
#endif
- PageConfiguration pageConfiguration(makeUniqueRef<WebEditorClient>(this), WebSocketProvider::create());
+ PageConfiguration pageConfiguration(
+ makeUniqueRef<WebEditorClient>(this),
+ WebSocketProvider::create(),
+ makeUniqueRef<WebCore::LibWebRTCProvider>()
+ );
pageConfiguration.chromeClient = new WebChromeClient(*this);
#if ENABLE(CONTEXT_MENUS)
pageConfiguration.contextMenuClient = new WebContextMenuClient(this);