Source/WebCore/ChangeLog

 12017-01-24 Youenn Fablet <youennf@gmail.com>
 2
 3 [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
 4 https://bugs.webkit.org/show_bug.cgi?id=167294
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Introducing LibWebRTCMacros.h which should be included before any libwebrtc header.
 9
 10 Introducing LibWebRTCProvider as the abstraction allowing to suport WK1 and WK2 libwebrtc-based WebRTC endpoints.
 11 It will create a libwebrtc peerconnection object differently in WK1 and WK2 as networking will be done differently.
 12
 13 LibWebRTCUtils contains routines used by WK1 and WK2 RTC providers to create the libwebrtc peerconnection object
 14 and implement the necessary functionalities for it.
 15
 16 Updating PageConfiguration accordingly.
 17
 18 * WebCore.xcodeproj/project.pbxproj:
 19 * page/Page.cpp:
 20 (WebCore::Page::Page):
 21 * page/Page.h:
 22 (WebCore::Page::libWebRTCProvider):
 23 * page/PageConfiguration.cpp:
 24 (WebCore::PageConfiguration::PageConfiguration):
 25 * page/PageConfiguration.h:
 26 * platform/mediastream/libwebrtc/LibWebRTCMacros.h: Added.
 27 * platform/mediastream/libwebrtc/LibWebRTCProvider.h: Added.
 28 * platform/mediastream/libwebrtc/LibWebRTCUtils.cpp: Added.
 29 (WebCore::staticFactoryAndThreads):
 30 (WebCore::ThreadMessageData::ThreadMessageData):
 31 (WebCore::PeerConnectionFactoryAndThreads::OnMessage):
 32 (WebCore::callOnWebRTCNetworkThread):
 33 (WebCore::initializePeerConnectionFactoryAndThreads):
 34 (WebCore::initializeLibWebRTCInternalsWithSocketServer):
 35 (WebCore::peerConnectionFactory):
 36 (WebCore::createPeerConnection):
 37 * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Added.
 38 * svg/graphics/SVGImage.cpp:
 39 (WebCore::SVGImage::dataChanged):
 40
1412017-01-24 Joseph Pecoraro <pecoraro@apple.com>
242
343 Remove always true allowCustomScrollbarInMainFrame setting

Source/WebKit/ChangeLog

 12017-01-24 Youenn Fablet <youennf@gmail.com>
 2
 3 [WebRTC] Add support for WK1 libwebrtc endpoint
 4 https://bugs.webkit.org/show_bug.cgi?id=167305
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * WebKit.xcodeproj/project.pbxproj:
 9
1102017-01-17 Antti Koivisto <antti@apple.com>
211
312 Persist derived data

Source/WebKit/mac/ChangeLog

 12017-01-24 Youenn Fablet <youennf@gmail.com>
 2
 3 [WebRTC] Add support for WK1 libwebrtc endpoint
 4 https://bugs.webkit.org/show_bug.cgi?id=167305
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * WebCoreSupport/WebLibWebRTCProvider.h: Added. WK1 LibWebRTC provider will use the default libwebrtc network stack.
 9 * WebView/WebView.mm:
 10 (-[WebView _commonInitializationWithFrameName:groupName:]):
 11
 122017-01-24 Youenn Fablet <youennf@gmail.com>
 13
 14 [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
 15 https://bugs.webkit.org/show_bug.cgi?id=167294
 16
 17 Reviewed by NOBODY (OOPS!).
 18
 19 * WebView/WebView.mm:
 20 (-[WebView _commonInitializationWithFrameName:groupName:]):
 21
1222017-01-23 Chris Dumez <cdumez@apple.com>
223
324 REGRESSION (r211033): ASSERTION FAILED: m_ptr in com.apple.WebCore: WTF::RefPtr<WebCore::Element>::operator* const + 70

Source/WebKit2/ChangeLog

 12017-01-24 Youenn Fablet <youennf@gmail.com>
 2
 3 [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
 4 https://bugs.webkit.org/show_bug.cgi?id=167294
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * WebProcess/WebPage/WebPage.cpp:
 9 (WebKit::m_userInterfaceLayoutDirection):
 10
1112017-01-24 Miguel Gomez <magomez@igalia.com>
212
313 [Coordinated Graphics] Ensure that we're in AC mode before trying to create GraphicsLayers

Source/WebCore/CMakeLists.txt

@@set(WebCore_INCLUDE_DIRECTORIES
8888 "${WEBCORE_DIR}/platform/graphics/opentype"
8989 "${WEBCORE_DIR}/platform/graphics/transforms"
9090 "${WEBCORE_DIR}/platform/mediastream"
 91 "${WEBCORE_DIR}/platform/mediastream/libwebrtc"
9192 "${WEBCORE_DIR}/platform/mock"
9293 "${WEBCORE_DIR}/platform/mock/mediasource"
9394 "${WEBCORE_DIR}/platform/network"

Source/WebCore/WebCore.xcodeproj/project.pbxproj

15341534 4150F9F112B6E0E70008C860 /* SliderThumbElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */; };
15351535 4150F9F212B6E0E70008C860 /* SliderThumbElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */; };
15361536 415670471DBE1533009AC3BB /* PeerConnectionStates.h in Headers */ = {isa = PBXBuildFile; fileRef = 415670461DBE1524009AC3BB /* PeerConnectionStates.h */; };
 1537 415747471E3869A400E914D8 /* LibWebRTCMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 415747431E38699E00E914D8 /* LibWebRTCMacros.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1538 415747481E3869A700E914D8 /* LibWebRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 415747441E38699E00E914D8 /* LibWebRTCProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1539 415747491E3869AA00E914D8 /* LibWebRTCUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 415747451E38699E00E914D8 /* LibWebRTCUtils.cpp */; };
 1540 4157474A1E3869AD00E914D8 /* LibWebRTCUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 415747461E38699E00E914D8 /* LibWebRTCUtils.h */; settings = {ATTRIBUTES = (Private, ); }; };
15371541 4157AF8012F1FB0400A8C6F5 /* MediaControlsApple.h in Headers */ = {isa = PBXBuildFile; fileRef = 4157AF7E12F1FB0400A8C6F5 /* MediaControlsApple.h */; };
15381542 4157AF8112F1FB0400A8C6F5 /* MediaControlsApple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4157AF7F12F1FB0400A8C6F5 /* MediaControlsApple.cpp */; };
15391543 41614A781DA6423B004AD06F /* HTTPHeaderValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41614A761DA64236004AD06F /* HTTPHeaderValues.cpp */; };

86988702 4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SliderThumbElement.h; sourceTree = "<group>"; };
86998703 4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SliderThumbElement.cpp; sourceTree = "<group>"; };
87008704 415670461DBE1524009AC3BB /* PeerConnectionStates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeerConnectionStates.h; sourceTree = "<group>"; };
 8705 415747431E38699E00E914D8 /* LibWebRTCMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCMacros.h; path = libwebrtc/LibWebRTCMacros.h; sourceTree = "<group>"; };
 8706 415747441E38699E00E914D8 /* LibWebRTCProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCProvider.h; path = libwebrtc/LibWebRTCProvider.h; sourceTree = "<group>"; };
 8707 415747451E38699E00E914D8 /* LibWebRTCUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCUtils.cpp; path = libwebrtc/LibWebRTCUtils.cpp; sourceTree = "<group>"; };
 8708 415747461E38699E00E914D8 /* LibWebRTCUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCUtils.h; path = libwebrtc/LibWebRTCUtils.h; sourceTree = "<group>"; };
87018709 4157AF7E12F1FB0400A8C6F5 /* MediaControlsApple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControlsApple.h; sourceTree = "<group>"; };
87028710 4157AF7F12F1FB0400A8C6F5 /* MediaControlsApple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaControlsApple.cpp; sourceTree = "<group>"; };
87038711 41614A761DA64236004AD06F /* HTTPHeaderValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPHeaderValues.cpp; sourceTree = "<group>"; };

1519815206 07221B9217CF0AD400848E51 /* mediastream */ = {
1519915207 isa = PBXGroup;
1520015208 children = (
 15209 415747421E38698000E914D8 /* libwebrtc */,
1520115210 0729B14D17CFCCA0004F1D60 /* mac */,
1520215211 07D6A4F61BF2307D00174146 /* AudioTrackPrivateMediaStream.h */,
1520315212 07B7116A1D899E63009F0FFB /* CaptureDevice.h */,

1661016619 path = shadow;
1661116620 sourceTree = "<group>";
1661216621 };
 16622 415747421E38698000E914D8 /* libwebrtc */ = {
 16623 isa = PBXGroup;
 16624 children = (
 16625 415747431E38699E00E914D8 /* LibWebRTCMacros.h */,
 16626 415747441E38699E00E914D8 /* LibWebRTCProvider.h */,
 16627 415747451E38699E00E914D8 /* LibWebRTCUtils.cpp */,
 16628 415747461E38699E00E914D8 /* LibWebRTCUtils.h */,
 16629 );
 16630 name = libwebrtc;
 16631 sourceTree = "<group>";
 16632 };
1661316633 417DA4CD13734204007C57FB /* testing */ = {
1661416634 isa = PBXGroup;
1661516635 children = (

2569325713 085B92BB0EFDE73D00E6123C /* FormDataBuilder.h in Headers */,
2569425714 A8136D380973A8E700D74463 /* FormDataList.h in Headers */,
2569525715 7EE6846712D26E3800E79415 /* FormDataStreamCFNet.h in Headers */,
 25716 4157474A1E3869AD00E914D8 /* LibWebRTCUtils.h in Headers */,
2569625717 514C764E0CE9234E007EF3CD /* FormDataStreamMac.h in Headers */,
2569725718 9B50B1DE17CD4C0F0087F63C /* FormNamedItem.h in Headers */,
2569825719 656D373A0ADBA5DE00A4554D /* FormState.h in Headers */,

2577625797 4969B0F313D0B33F00DF3521 /* HitTestingTransformState.h in Headers */,
2577725798 2D8287F716E4A0380086BD00 /* HitTestLocation.h in Headers */,
2577825799 930908910AF7EDE40081DF01 /* HitTestRequest.h in Headers */,
 25800 415747471E3869A400E914D8 /* LibWebRTCMacros.h in Headers */,
2577925801 9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */,
2578025802 BC3BC29C0E91AB0F00835588 /* HostWindow.h in Headers */,
2578125803 FD31609912B026F700C1A359 /* HRTFDatabase.h in Headers */,

2742427446 4998AEC613F9D0EA0090B1AA /* RequestAnimationFrameCallback.h in Headers */,
2742527447 F55B3DD01251F12D003EF269 /* ResetInputType.h in Headers */,
2742627448 7EE6846A12D26E3800E79415 /* ResourceError.h in Headers */,
 27449 415747481E3869A700E914D8 /* LibWebRTCProvider.h in Headers */,
2742727450 934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */,
2742827451 514C76790CE923A1007EF3CD /* ResourceHandle.h in Headers */,
2742927452 26FAE4CD1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h in Headers */,

3127331296 512DD8E30D91E2B4000F89EE /* SharedBufferCF.cpp in Sources */,
3127431297 97B1F02E13B025CA00F5103F /* SharedBufferChunkReader.cpp in Sources */,
3127531298 1A4A95520B4EDCFF002D8C3C /* SharedBufferCocoa.mm in Sources */,
 31299 415747491E3869AA00E914D8 /* LibWebRTCUtils.cpp in Sources */,
3127631300 163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */,
3127731301 E48944A2180B57D800F165D8 /* SimpleLineLayout.cpp in Sources */,
3127831302 585D6E031A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp in Sources */,

Source/WebCore/page/Page.cpp

5555#include "HistoryItem.h"
5656#include "InspectorController.h"
5757#include "InspectorInstrumentation.h"
 58#include "LibWebRTCProvider.h"
5859#include "Logging.h"
5960#include "MainFrame.h"
6061#include "MediaCanStartListener.h"

@@Page::Page(PageConfiguration&& pageConfiguration)
201202 , m_validationMessageClient(WTFMove(pageConfiguration.validationMessageClient))
202203 , m_diagnosticLoggingClient(WTFMove(pageConfiguration.diagnosticLoggingClient))
203204 , m_webGLStateTracker(WTFMove(pageConfiguration.webGLStateTracker))
 205#if USE(LIBWEBRTC)
 206 , m_libWebRTCProvider(WTFMove(pageConfiguration.libWebRTCProvider))
 207#endif
204208 , m_openedByDOM(false)
205209 , m_tabKeyCyclesThroughElements(true)
206210 , m_defersLoading(false)

Source/WebCore/page/Page.h

@@class ActivityStateChangeObserver;
132132class VisitedLinkStore;
133133class WebGLStateTracker;
134134
 135#if USE(LIBWEBRTC)
 136class LibWebRTCProvider;
 137#endif
 138
135139typedef uint64_t LinkHash;
136140
137141enum FindDirection {

@@public:
223227#if ENABLE(POINTER_LOCK)
224228 PointerLockController& pointerLockController() const { return *m_pointerLockController; }
225229#endif
 230#if USE(LIBWEBRTC)
 231 LibWebRTCProvider& libWebRTCProvider() { return m_libWebRTCProvider.get(); }
 232#endif
226233
227234 ValidationMessageClient* validationMessageClient() const { return m_validationMessageClient.get(); }
228235 void updateValidationBubbleStateIfNeeded();

@@private:
631638 std::unique_ptr<DiagnosticLoggingClient> m_diagnosticLoggingClient;
632639 std::unique_ptr<WebGLStateTracker> m_webGLStateTracker;
633640
 641#if USE(LIBWEBRTC)
 642 UniqueRef<LibWebRTCProvider> m_libWebRTCProvider;
 643#endif
 644
634645 int m_nestedRunLoopCount { 0 };
635646 std::function<void()> m_unnestCallback;
636647

Source/WebCore/page/PageConfiguration.cpp

2020 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424 */
2525
2626#include "config.h"

3131#include "DatabaseProvider.h"
3232#include "DiagnosticLoggingClient.h"
3333#include "EditorClient.h"
 34#include "LibWebRTCProvider.h"
3435#include "PluginInfoProvider.h"
3536#include "SocketProvider.h"
3637#include "StorageNamespaceProvider.h"

4142
4243namespace WebCore {
4344
44 PageConfiguration::PageConfiguration(UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider)
 45PageConfiguration::PageConfiguration(UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider
 46#if USE(LIBWEBRTC)
 47 , UniqueRef<LibWebRTCProvider>&& libWebRTCProvider
 48#endif
 49 )
4550 : editorClient(WTFMove(editorClient))
4651 , socketProvider(WTFMove(socketProvider))
 52#if USE(LIBWEBRTC)
 53 , libWebRTCProvider(WTFMove(libWebRTCProvider))
 54#endif
4755{
4856}
4957

Source/WebCore/page/PageConfiguration.h

2020 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424 */
2525
2626#pragma once

@@class WebGLStateTracker;
5656class ContextMenuClient;
5757#endif
5858
 59#if USE(LIBWEBRTC)
 60class LibWebRTCProvider;
 61#endif
 62
5963class PageConfiguration {
6064 WTF_MAKE_NONCOPYABLE(PageConfiguration); WTF_MAKE_FAST_ALLOCATED;
6165public:
62  WEBCORE_EXPORT PageConfiguration(UniqueRef<EditorClient>&&, Ref<SocketProvider>&&);
 66 WEBCORE_EXPORT PageConfiguration(UniqueRef<EditorClient>&&, Ref<SocketProvider>&&
 67#if USE(LIBWEBRTC)
 68 , UniqueRef<LibWebRTCProvider>&&
 69#endif
 70 );
6371 WEBCORE_EXPORT ~PageConfiguration();
6472
6573 AlternativeTextClient* alternativeTextClient { nullptr };

@@public:
7583 PaymentCoordinatorClient* paymentCoordinatorClient { nullptr };
7684#endif
7785
 86#if USE(LIBWEBRTC)
 87 UniqueRef<LibWebRTCProvider> libWebRTCProvider;
 88#endif
 89
7890 PlugInClient* plugInClient { nullptr };
7991 ProgressTrackerClient* progressTrackerClient { nullptr };
8092 RefPtr<BackForwardClient> backForwardClient;

Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCMacros.h

 1/*
 2 * Copyright (C) 2017 Apple Inc.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted, provided that the following conditions
 6 * are required to be met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Apple Inc. nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. AND ITS CONTRIBUTORS BE LIABLE FOR
 21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29#pragma once
 30
 31#if USE(LIBWEBRTC)
 32
 33#if PLATFORM(IOS)
 34#define WEBRTC_IOS
 35#endif
 36
 37#if PLATFORM(MAC)
 38#define WEBRTC_MAC
 39#endif
 40
 41#define WEBRTC_POSIX 1
 42#define _COMMON_INCLUDED_
 43
 44#endif // USE(LIBWEBRTC)

Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h

 1/*
 2 * Copyright (C) 2017 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if USE(LIBWEBRTC)
 29
 30#include "WebCore/LibWebRTCMacros.h"
 31#include <webrtc/api/peerconnectioninterface.h>
 32#include <wtf/UniqueRef.h>
 33
 34namespace WebCore {
 35
 36class WEBCORE_EXPORT LibWebRTCProvider {
 37public:
 38 virtual rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&) = 0;
 39 virtual ~LibWebRTCProvider() = default;
 40
 41};
 42
 43class LibWebRTCEmptyProvider final : public LibWebRTCProvider {
 44 rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&) final { return nullptr; }
 45};
 46
 47} // namespace WebCore
 48
 49#endif // USE(LIBWEBRTC)

Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp

 1/*
 2 * Copyright (C) 2017 Apple Inc.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted, provided that the following conditions
 6 * are required to be met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Apple Inc. nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. AND ITS CONTRIBUTORS BE LIABLE FOR
 21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29#include "config.h"
 30#include "LibWebRTCUtils.h"
 31
 32#if USE(LIBWEBRTC)
 33
 34#include <webrtc/api/peerconnectionfactory.h>
 35#include <webrtc/base/physicalsocketserver.h>
 36#include <webrtc/p2p/client/basicportallocator.h>
 37#include <webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h>
 38#include <wtf/Function.h>
 39#include <wtf/NeverDestroyed.h>
 40
 41namespace WebCore {
 42
 43struct PeerConnectionFactoryAndThreads : public rtc::MessageHandler {
 44 std::unique_ptr<rtc::Thread> networkThread;
 45 std::unique_ptr<rtc::Thread> signalingThread;
 46 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory;
 47 bool networkThreadWithSocketServer { false };
 48private:
 49 void OnMessage(rtc::Message*);
 50};
 51
 52static inline PeerConnectionFactoryAndThreads& staticFactoryAndThreads()
 53{
 54 static NeverDestroyed<PeerConnectionFactoryAndThreads> factoryAndThreads;
 55 return factoryAndThreads.get();
 56}
 57
 58struct ThreadMessageData : public rtc::MessageData {
 59 ThreadMessageData(Function<void()>&& function) : function(WTFMove(function)) { }
 60 Function<void()> function;
 61};
 62
 63void PeerConnectionFactoryAndThreads::OnMessage(rtc::Message* message)
 64{
 65 ASSERT(message->message_id == 1);
 66 static_cast<ThreadMessageData*>(message->pdata)->function();
 67}
 68
 69void callOnWebRTCNetworkThread(Function<void()>&& callback)
 70{
 71 PeerConnectionFactoryAndThreads& threads = staticFactoryAndThreads();
 72 threads.networkThread->Post(RTC_FROM_HERE, &threads, 1, new ThreadMessageData(WTFMove(callback)));
 73}
 74
 75static void initializePeerConnectionFactoryAndThreads()
 76{
 77 auto& factoryAndThreads = staticFactoryAndThreads();
 78
 79 ASSERT(!factoryAndThreads.factory);
 80
 81 auto thread = rtc::Thread::Create();
 82 factoryAndThreads.networkThread = factoryAndThreads.networkThreadWithSocketServer ? rtc::Thread::CreateWithSocketServer() : rtc::Thread::Create();
 83 bool result = factoryAndThreads.networkThread->Start();
 84 ASSERT_UNUSED(result, result);
 85
 86 factoryAndThreads.signalingThread = rtc::Thread::Create();
 87 result = factoryAndThreads.signalingThread->Start();
 88 ASSERT(result);
 89
 90 factoryAndThreads.factory = webrtc::CreatePeerConnectionFactory(factoryAndThreads.networkThread.get(), factoryAndThreads.networkThread.get(), factoryAndThreads.signalingThread.get(), nullptr, new webrtc::VideoToolboxVideoEncoderFactory() , new webrtc::VideoToolboxVideoDecoderFactory());
 91
 92 ASSERT(factoryAndThreads.factory);
 93}
 94
 95void initializeLibWebRTCInternalsWithSocketServer()
 96{
 97 staticFactoryAndThreads().networkThreadWithSocketServer = true;
 98}
 99
 100webrtc::PeerConnectionFactoryInterface& peerConnectionFactory()
 101{
 102 if (!staticFactoryAndThreads().factory)
 103 initializePeerConnectionFactoryAndThreads();
 104 return *staticFactoryAndThreads().factory;
 105}
 106
 107static rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver& observer, std::unique_ptr<cricket::BasicPortAllocator>&& portAllocator)
 108{
 109 ASSERT(staticFactoryAndThreads().factory);
 110
 111 webrtc::PeerConnectionInterface::RTCConfiguration config;
 112 // FIXME: Add a default configuration.
 113 return staticFactoryAndThreads().factory->CreatePeerConnection(config, WTFMove(portAllocator), nullptr, &observer);
 114}
 115
 116rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver& observer)
 117{
 118 ASSERT(staticFactoryAndThreads().networkThreadWithSocketServer);
 119
 120 auto& factoryAndThreads = staticFactoryAndThreads();
 121 if (!factoryAndThreads.factory)
 122 initializePeerConnectionFactoryAndThreads();
 123
 124 return createPeerConnection(observer, nullptr);
 125}
 126
 127rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver& observer, rtc::NetworkManager& networkManager, rtc::PacketSocketFactory& packetSocketFactory)
 128{
 129 ASSERT(!staticFactoryAndThreads().networkThreadWithSocketServer);
 130
 131 auto& factoryAndThreads = staticFactoryAndThreads();
 132 if (!factoryAndThreads.factory)
 133 initializePeerConnectionFactoryAndThreads();
 134
 135 std::unique_ptr<cricket::BasicPortAllocator> portAllocator;
 136 staticFactoryAndThreads().signalingThread->Invoke<void>(RTC_FROM_HERE, [&]() {
 137 portAllocator.reset(new cricket::BasicPortAllocator(&networkManager, &packetSocketFactory));
 138 });
 139
 140 return createPeerConnection(observer, WTFMove(portAllocator));
 141}
 142
 143} // namespace WebCore
 144
 145#endif // USE(LIBWEBRTC)

Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.h

 1/*
 2 * Copyright (C) 2017 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if USE(LIBWEBRTC)
 29
 30#include "LibWebRTCMacros.h"
 31#include <webrtc/base/scoped_ref_ptr.h>
 32#include <wtf/Forward.h>
 33
 34namespace rtc {
 35class NetworkManager;
 36class PacketSocketFactory;
 37}
 38
 39namespace webrtc {
 40class PeerConnectionFactoryInterface;
 41class PeerConnectionInterface;
 42class PeerConnectionObserver;
 43}
 44
 45namespace WebCore {
 46
 47WEBCORE_EXPORT void initializeLibWebRTCInternalsWithSocketServer();
 48
 49webrtc::PeerConnectionFactoryInterface& peerConnectionFactory();
 50WEBCORE_EXPORT rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&, rtc::NetworkManager&, rtc::PacketSocketFactory&);
 51WEBCORE_EXPORT rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&);
 52
 53WEBCORE_EXPORT void callOnWebRTCNetworkThread(Function<void()>&&);
 54
 55} // namespace WebCore
 56
 57#endif // USE(LIBWEBRTC)

Source/WebCore/svg/graphics/SVGImage.cpp

4040#include "ImageObserver.h"
4141#include "IntRect.h"
4242#include "JSDOMWindowBase.h"
 43#include "LibWebRTCProvider.h"
4344#include "MainFrame.h"
4445#include "Page.h"
4546#include "PageConfiguration.h"

@@bool SVGImage::dataChanged(bool allDataReceived)
414415 return true;
415416
416417 if (allDataReceived) {
417  PageConfiguration pageConfiguration(createEmptyEditorClient(), SocketProvider::create());
 418 PageConfiguration pageConfiguration(createEmptyEditorClient(), SocketProvider::create()
 419#if USE(LIBWEBRTC)
 420 , makeUniqueRef<LibWebRTCEmptyProvider>()
 421#endif
 422 );
418423 fillWithEmptyClients(pageConfiguration);
419424 m_chromeClient = std::make_unique<SVGImageChromeClient>(this);
420425 pageConfiguration.chromeClient = m_chromeClient.get();

Source/WebKit/WebKit.xcodeproj/project.pbxproj

121121 3ABB3C7A1309C3B500E93D94 /* WebStorageTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3ABB3C781309C3B500E93D94 /* WebStorageTrackerClient.h */; };
122122 3ABB3C7B1309C3B500E93D94 /* WebStorageTrackerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3ABB3C791309C3B500E93D94 /* WebStorageTrackerClient.mm */; };
123123 3AE15D5012DBDED4009323C8 /* WebStorageManagerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AE15D4F12DBDED4009323C8 /* WebStorageManagerInternal.h */; };
 124 415747401E3862A600E914D8 /* WebLibWebRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 4157473F1E3862A600E914D8 /* WebLibWebRTCProvider.h */; };
124125 44BB8B141241A022001E3A22 /* WebArchiveInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 44BB8B131241A022001E3A22 /* WebArchiveInternal.h */; };
125126 4618DFF81DEF760A0033C3AA /* WebValidationMessageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4618DFF61DEF760A0033C3AA /* WebValidationMessageClient.h */; };
126127 4618DFF91DEF760A0033C3AA /* WebValidationMessageClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4618DFF71DEF760A0033C3AA /* WebValidationMessageClient.mm */; };

942943 3ABB3C781309C3B500E93D94 /* WebStorageTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebStorageTrackerClient.h; sourceTree = "<group>"; };
943944 3ABB3C791309C3B500E93D94 /* WebStorageTrackerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebStorageTrackerClient.mm; sourceTree = "<group>"; };
944945 3AE15D4F12DBDED4009323C8 /* WebStorageManagerInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebStorageManagerInternal.h; sourceTree = "<group>"; };
 946 4157473F1E3862A600E914D8 /* WebLibWebRTCProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebLibWebRTCProvider.h; path = mac/WebCoreSupport/WebLibWebRTCProvider.h; sourceTree = SOURCE_ROOT; };
945947 449098B90F8F82DF0076A327 /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
946948 44BB8B131241A022001E3A22 /* WebArchiveInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebArchiveInternal.h; sourceTree = "<group>"; };
947949 4618DFF61DEF760A0033C3AA /* WebValidationMessageClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebValidationMessageClient.h; sourceTree = "<group>"; };

26142616 9345D4EB0365C5B2008635CE /* WebJavaScriptTextInputPanel.m */,
26152617 CD8BFCE615531224005AFB25 /* WebKitFullScreenListener.h */,
26162618 CD8BFCE515531224005AFB25 /* WebKitFullScreenListener.mm */,
 2619 4157473F1E3862A600E914D8 /* WebLibWebRTCProvider.h */,
26172620 31C11A6C1476552E0049A4CC /* WebNotificationClient.h */,
26182621 31C11A6D1476552E0049A4CC /* WebNotificationClient.mm */,
26192622 A58A5797143E727000125F50 /* WebOpenPanelResultListener.h */,

30023005 A5DEFC0F11D5343E00885273 /* WebDatabaseQuotaManager.h in Headers */,
30033006 9398104B0824BF01008DF038 /* WebDataSource.h in Headers */,
30043007 658A40960A14853B005E6987 /* WebDataSourceInternal.h in Headers */,
 3008 415747401E3862A600E914D8 /* WebLibWebRTCProvider.h in Headers */,
30053009 9398104C0824BF01008DF038 /* WebDataSourcePrivate.h in Headers */,
30063010 9398104E0824BF01008DF038 /* WebDefaultContextMenuDelegate.h in Headers */,
30073011 9398108D0824BF01008DF038 /* WebDefaultEditingDelegate.h in Headers */,

Source/WebKit/mac/WebCoreSupport/WebLibWebRTCProvider.h

 1/*
 2 * Copyright (C) 2017 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if USE(LIBWEBRTC)
 29
 30#include <WebCore/LibWebRTCProvider.h>
 31#include <WebCore/LibWebRTCUtils.h>
 32#include <webrtc/api/peerconnectioninterface.h>
 33
 34class WebLibWebRTCProvider final : public WebCore::LibWebRTCProvider {
 35public:
 36 WebLibWebRTCProvider() = default;
 37
 38private:
 39 rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver& observer) final { return WebCore::createPeerConnection(observer); }
 40};
 41
 42#endif

Source/WebKit/mac/WebView/WebView.mm

8282#import "WebKitNSStringExtras.h"
8383#import "WebKitStatisticsPrivate.h"
8484#import "WebKitVersionChecks.h"
 85#import "WebLibWebRTCProvider.h"
8586#import "WebLocalizableStrings.h"
8687#import "WebNSDataExtras.h"
8788#import "WebNSDataExtrasPrivate.h"

@@static void WebKitInitializeGamepadProviderIfNecessary()
13421343 _private->group = WebViewGroup::getOrCreate(groupName, _private->preferences._localStorageDatabasePath);
13431344 _private->group->addWebView(self);
13441345
1345  PageConfiguration pageConfiguration(makeUniqueRef<WebEditorClient>(self), SocketProvider::create());
 1346 PageConfiguration pageConfiguration(makeUniqueRef<WebEditorClient>(self), SocketProvider::create()
 1347#if USE(LIBWEBRTC)
 1348 , makeUniqueRef<WebLibWebRTCProvider>()
 1349#endif
 1350 );
13461351#if !PLATFORM(IOS)
13471352 pageConfiguration.chromeClient = new WebChromeClient(self);
13481353 pageConfiguration.contextMenuClient = new WebContextMenuClient(self);

Source/WebKit2/WebProcess/WebPage/WebPage.cpp

147147#include <WebCore/InspectorController.h>
148148#include <WebCore/JSDOMWindow.h>
149149#include <WebCore/KeyboardEvent.h>
 150#include <WebCore/LibWebRTCProvider.h>
150151#include <WebCore/MIMETypeRegistry.h>
151152#include <WebCore/MainFrame.h>
152153#include <WebCore/MouseEvent.h>

@@WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
373374 Settings::setShouldManageAudioSessionCategory(true);
374375#endif
375376
376  PageConfiguration pageConfiguration(makeUniqueRef<WebEditorClient>(this), WebSocketProvider::create());
 377 PageConfiguration pageConfiguration(makeUniqueRef<WebEditorClient>(this), WebSocketProvider::create()
 378#if USE(LIBWEBRTC)
 379 , makeUniqueRef<WebCore::LibWebRTCEmptyProvider>()
 380#endif
 381 );
377382 pageConfiguration.chromeClient = new WebChromeClient(*this);
378383#if ENABLE(CONTEXT_MENUS)
379384 pageConfiguration.contextMenuClient = new WebContextMenuClient(this);