Title: [254555] trunk
Revision
254555
Author
[email protected]
Date
2020-01-14 18:51:21 -0800 (Tue, 14 Jan 2020)

Log Message

[Media in GPU process] Implement the remote video layer support
https://bugs.webkit.org/show_bug.cgi?id=206043

Reviewed by Youenn Fablet.

Source/WebCore:

No new tests, covered by existing tests.

This patch adds function LayerHostingContext::createPlatformLayerForHostingContext() which is
a wrapper of [CALayer _web_renderLayerWithContextID:] to create WebVideoHostingLayer in the Web process.

It also moves LayerHostingContext.[h|mm] to from folder "mac" to "cocoa" because LayerHostingContext
is not only used on the Mac version.
Some issues related to unified build are also fixed.

* platform/graphics/ColorSpace.h:
* platform/graphics/LayoutRect.h:
(WebCore::LayoutRect::encode const):
(WebCore::LayoutRect::decode):
* platform/graphics/cocoa/WebCoreCALayerExtras.mm:
(+[CALayer _web_renderLayerWithContextID:]):
* platform/graphics/cv/ImageTransferSessionVT.mm:

Source/WebKit:

RemoteMediaPlayerProxy in the GPU process creates a LayerHostingContext with createForExternalHostingProcess()
and share the context ID with the MediaPlayerPrivateRemote in the Web process.
Then the MediaPlayerPrivateRemote creates a hosting layer with the context ID for rendering.

This patch updates RemoteMediaPlayerProxy::PrepareForPlayback to provide the initial video content box and scale
for the VideoFullscreenLayerManagerObjC on the GPU process to create WebVideoContainerLayer.
It adds XPC message RemoteMediaPlayerManager::FirstVideoFrameAvailable to notify the renderer on the Web process that the video layer is ready.
RemoteMediaPlayerManagerProxy::SetSize message is removed to avoid the unnecessary XPC message
because MediaPlayerPrivateAVFoundationObjC::setSize() does nothing.

* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerContentBoxRect const):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerContentsScale const):
(WebKit::RemoteMediaPlayerProxy::setSize): Deleted.
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* Platform/cocoa/LayerHostingContext.h: Renamed from Source/WebKit/Platform/mac/LayerHostingContext.h.
* Platform/cocoa/LayerHostingContext.mm: Renamed from Source/WebKit/Platform/mac/LayerHostingContext.mm.
(WebKit::LayerHostingContext::createPlatformLayerForHostingContext):
* Platform/ios/PaymentAuthorizationController.mm:
* PluginProcess/mac/PluginControllerProxyMac.mm:
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
(WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load):
(WebKit::MediaPlayerPrivateRemote::firstVideoFrameAvailable):
(WebKit::MediaPlayerPrivateRemote::platformLayer const):
(WebKit::MediaPlayerPrivateRemote::setSize): Deleted.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
(WebKit::RemoteMediaPlayerManager::characteristicChanged):
(WebKit::RemoteMediaPlayerManager::sizeChanged):
(WebKit::RemoteMediaPlayerManager::addRemoteVideoTrack):
(WebKit::RemoteMediaPlayerManager::removeRemoteVideoTrack):
(WebKit::RemoteMediaPlayerManager::remoteVideoTrackConfigurationChanged):
(WebKit::RemoteMediaPlayerManager::firstVideoFrameAvailable):
* WebProcess/GPU/media/RemoteMediaPlayerManager.h:
* WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in:
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:

LayoutTests:

* gpu-process/TestExpectations:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (254554 => 254555)


--- trunk/LayoutTests/ChangeLog	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/LayoutTests/ChangeLog	2020-01-15 02:51:21 UTC (rev 254555)
@@ -1,3 +1,12 @@
+2020-01-14  Peng Liu  <[email protected]>
+
+        [Media in GPU process] Implement the remote video layer support
+        https://bugs.webkit.org/show_bug.cgi?id=206043
+
+        Reviewed by Youenn Fablet.
+
+        * gpu-process/TestExpectations:
+
 2020-01-14  Ryosuke Niwa  <[email protected]>
 
         REGRESSION: fast/shadow-dom/link-element-in-shadow-tree.html is flaky

Modified: trunk/LayoutTests/gpu-process/TestExpectations (254554 => 254555)


--- trunk/LayoutTests/gpu-process/TestExpectations	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/LayoutTests/gpu-process/TestExpectations	2020-01-15 02:51:21 UTC (rev 254555)
@@ -237,6 +237,9 @@
 http/tests/contentextensions/text-track-blocked.html [ Skip ]
 http/tests/contentextensions/video-element-resource-type.html [ Skip ]
 http/tests/media [ Skip ]
+http/tests/media/video-load-twice.html [ Pass ]
+http/tests/media/video-play-progress.html [ Pass ]
+http/tests/media/video-preload.html [ Pass ]
 http/tests/navigation/page-cache-mediakeysession.html [ Skip ]
 http/tests/navigation/page-cache-mediastream.html [ Skip ]
 http/wpt/mediarecorder [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (254554 => 254555)


--- trunk/Source/WebCore/ChangeLog	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebCore/ChangeLog	2020-01-15 02:51:21 UTC (rev 254555)
@@ -1,3 +1,27 @@
+2020-01-14  Peng Liu  <[email protected]>
+
+        [Media in GPU process] Implement the remote video layer support
+        https://bugs.webkit.org/show_bug.cgi?id=206043
+
+        Reviewed by Youenn Fablet.
+
+        No new tests, covered by existing tests.
+
+        This patch adds function LayerHostingContext::createPlatformLayerForHostingContext() which is
+        a wrapper of [CALayer _web_renderLayerWithContextID:] to create WebVideoHostingLayer in the Web process.
+
+        It also moves LayerHostingContext.[h|mm] to from folder "mac" to "cocoa" because LayerHostingContext
+        is not only used on the Mac version.
+        Some issues related to unified build are also fixed.
+
+        * platform/graphics/ColorSpace.h:
+        * platform/graphics/LayoutRect.h:
+        (WebCore::LayoutRect::encode const):
+        (WebCore::LayoutRect::decode):
+        * platform/graphics/cocoa/WebCoreCALayerExtras.mm:
+        (+[CALayer _web_renderLayerWithContextID:]):
+        * platform/graphics/cv/ImageTransferSessionVT.mm:
+
 2020-01-14  Dean Jackson  <[email protected]>
 
         Build ANGLE as a dynamic library

Modified: trunk/Source/WebCore/platform/graphics/ColorSpace.h (254554 => 254555)


--- trunk/Source/WebCore/platform/graphics/ColorSpace.h	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebCore/platform/graphics/ColorSpace.h	2020-01-15 02:51:21 UTC (rev 254555)
@@ -32,6 +32,5 @@
     LinearRGB,
     DisplayP3
 };
-    
+
 } // namespace WebCore
-

Modified: trunk/Source/WebCore/platform/graphics/LayoutRect.h (254554 => 254555)


--- trunk/Source/WebCore/platform/graphics/LayoutRect.h	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebCore/platform/graphics/LayoutRect.h	2020-01-15 02:51:21 UTC (rev 254555)
@@ -57,7 +57,29 @@
     LayoutRect(const IntRect& rect) : m_location(rect.location()), m_size(rect.size()) { }
     
     WEBCORE_EXPORT explicit LayoutRect(const FloatRect&); // don't do this implicitly since it's lossy
-        
+
+    template<class Encoder>
+    void encode(Encoder& encoder) const
+    {
+        encoder << m_location << m_size;
+    }
+
+    template<class Decoder>
+    static Optional<LayoutRect> decode(Decoder& decoder)
+    {
+        Optional<LayoutPoint> layoutPoint;
+        decoder >> layoutPoint;
+        if (!layoutPoint)
+            return WTF::nullopt;
+
+        Optional<LayoutSize> layoutSize;
+        decoder >> layoutSize;
+        if (!layoutSize)
+            return WTF::nullopt;
+
+        return {{ *layoutPoint, *layoutSize }};
+    }
+
     LayoutPoint location() const { return m_location; }
     LayoutSize size() const { return m_size; }
 

Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.mm (254554 => 254555)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.mm	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.mm	2020-01-15 02:51:21 UTC (rev 254555)
@@ -81,6 +81,9 @@
 + (CALayer *)_web_renderLayerWithContextID:(uint32_t)contextID
 {
     CALayerHost *layerHost = [CALayerHost layer];
+#ifndef NDEBUG
+    [layerHost setName:@"WebVideoHostingLayer"];
+#endif
     layerHost.contextId = contextID;
     return layerHost;
 }

Modified: trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm (254554 => 254555)


--- trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm	2020-01-15 02:51:21 UTC (rev 254555)
@@ -28,18 +28,20 @@
 
 #if USE(VIDEOTOOLBOX)
 
+#import "GraphicsContextCG.h"
 #import "Logging.h"
 #import "MediaSampleAVFObjC.h"
 #import <CoreMedia/CMFormatDescription.h>
 #import <CoreMedia/CMSampleBuffer.h>
+
+#import "CoreVideoSoftLink.h"
 #import <pal/cf/CoreMediaSoftLink.h>
+#import "VideoToolboxSoftLink.h"
 
 #if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)
 #include <pal/spi/cocoa/IOSurfaceSPI.h>
 #endif
 
-#import "CoreVideoSoftLink.h"
-
 namespace WebCore {
 using namespace PAL;
 

Modified: trunk/Source/WebKit/ChangeLog (254554 => 254555)


--- trunk/Source/WebKit/ChangeLog	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/ChangeLog	2020-01-15 02:51:21 UTC (rev 254555)
@@ -1,3 +1,54 @@
+2020-01-14  Peng Liu  <[email protected]>
+
+        [Media in GPU process] Implement the remote video layer support
+        https://bugs.webkit.org/show_bug.cgi?id=206043
+
+        Reviewed by Youenn Fablet.
+
+        RemoteMediaPlayerProxy in the GPU process creates a LayerHostingContext with createForExternalHostingProcess()
+        and share the context ID with the MediaPlayerPrivateRemote in the Web process.
+        Then the MediaPlayerPrivateRemote creates a hosting layer with the context ID for rendering.
+
+        This patch updates RemoteMediaPlayerProxy::PrepareForPlayback to provide the initial video content box and scale
+        for the VideoFullscreenLayerManagerObjC on the GPU process to create WebVideoContainerLayer.
+        It adds XPC message RemoteMediaPlayerManager::FirstVideoFrameAvailable to notify the renderer on the Web process that the video layer is ready.
+        RemoteMediaPlayerManagerProxy::SetSize message is removed to avoid the unnecessary XPC message
+        because MediaPlayerPrivateAVFoundationObjC::setSize() does nothing.
+
+        * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
+        (WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
+        (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable):
+        (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged):
+        (WebKit::RemoteMediaPlayerProxy::mediaPlayerContentBoxRect const):
+        (WebKit::RemoteMediaPlayerProxy::mediaPlayerContentsScale const):
+        (WebKit::RemoteMediaPlayerProxy::setSize): Deleted.
+        * GPUProcess/media/RemoteMediaPlayerProxy.h:
+        * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
+        * Platform/cocoa/LayerHostingContext.h: Renamed from Source/WebKit/Platform/mac/LayerHostingContext.h.
+        * Platform/cocoa/LayerHostingContext.mm: Renamed from Source/WebKit/Platform/mac/LayerHostingContext.mm.
+        (WebKit::LayerHostingContext::createPlatformLayerForHostingContext):
+        * Platform/ios/PaymentAuthorizationController.mm:
+        * PluginProcess/mac/PluginControllerProxyMac.mm:
+        * SourcesCocoa.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+        (WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
+        (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load):
+        (WebKit::MediaPlayerPrivateRemote::firstVideoFrameAvailable):
+        (WebKit::MediaPlayerPrivateRemote::platformLayer const):
+        (WebKit::MediaPlayerPrivateRemote::setSize): Deleted.
+        * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
+        * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
+        (WebKit::RemoteMediaPlayerManager::characteristicChanged):
+        (WebKit::RemoteMediaPlayerManager::sizeChanged):
+        (WebKit::RemoteMediaPlayerManager::addRemoteVideoTrack):
+        (WebKit::RemoteMediaPlayerManager::removeRemoteVideoTrack):
+        (WebKit::RemoteMediaPlayerManager::remoteVideoTrackConfigurationChanged):
+        (WebKit::RemoteMediaPlayerManager::firstVideoFrameAvailable):
+        * WebProcess/GPU/media/RemoteMediaPlayerManager.h:
+        * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in:
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+
 2020-01-10  Jiewen Tan  <[email protected]>
 
         [WebAuthn] Implement SPI to tell UI clients to select assertion responses

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp (254554 => 254555)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp	2020-01-15 02:51:21 UTC (rev 254555)
@@ -40,6 +40,7 @@
 #include "RemoteMediaResourceManager.h"
 #include "RemoteVideoTrackProxy.h"
 #include "WebCoreArgumentCoders.h"
+#include <WebCore/LayoutRect.h>
 #include <WebCore/MediaPlayer.h>
 #include <WebCore/MediaPlayerPrivate.h>
 #include <WebCore/NotImplemented.h>
@@ -105,12 +106,16 @@
     completionHandler(WTFMove(configuration));
 }
 
-void RemoteMediaPlayerProxy::prepareForPlayback(bool privateMode, WebCore::MediaPlayerEnums::Preload preload, bool preservesPitch, bool prepareForRendering)
+void RemoteMediaPlayerProxy::prepareForPlayback(bool privateMode, WebCore::MediaPlayerEnums::Preload preload, bool preservesPitch, bool prepareForRendering, LayoutRect layoutRect, float videoContentScale, CompletionHandler<void(Optional<LayerHostingContextID>&& contextId)>&& completionHandler)
 {
     m_player->setPrivateBrowsingMode(privateMode);
     m_player->setPreload(preload);
     m_player->setPreservesPitch(preservesPitch);
     m_player->prepareForRendering();
+    m_videoContentBoxRect = layoutRect;
+    m_videoContentScale = videoContentScale;
+    m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess();
+    completionHandler(m_layerHostingContext->contextID());
 }
 
 void RemoteMediaPlayerProxy::cancelLoad()
@@ -179,11 +184,6 @@
     m_player->prepareForRendering();
 }
 
-void RemoteMediaPlayerProxy::setSize(const WebCore::IntSize& size)
-{
-    m_player->setSize(size);
-}
-
 void RemoteMediaPlayerProxy::setVisible(bool visible)
 {
     m_player->setVisible(visible);
@@ -430,12 +430,13 @@
 
 void RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable()
 {
-    notImplemented();
+    m_layerHostingContext->setRootLayer(m_player->platformLayer());
+    m_webProcessConnection->send(Messages::RemoteMediaPlayerManager::FirstVideoFrameAvailable(m_id), 0);
 }
 
 void RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged()
 {
-    notImplemented();
+    m_layerHostingContext->setRootLayer(m_player->platformLayer());
 }
 
 void RemoteMediaPlayerProxy::mediaPlayerActiveSourceBuffersChanged()
@@ -496,14 +497,12 @@
 
 LayoutRect RemoteMediaPlayerProxy::mediaPlayerContentBoxRect() const
 {
-    notImplemented();
-    return LayoutRect();
+    return m_videoContentBoxRect;
 }
 
 float RemoteMediaPlayerProxy::mediaPlayerContentsScale() const
 {
-    notImplemented();
-    return 1;
+    return m_videoContentScale;
 }
 
 void RemoteMediaPlayerProxy::mediaPlayerPause()

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h (254554 => 254555)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h	2020-01-15 02:51:21 UTC (rev 254555)
@@ -52,6 +52,8 @@
 
 namespace WebKit {
 
+using LayerHostingContextID = uint32_t;
+class LayerHostingContext;
 class RemoteAudioTrackProxy;
 class RemoteMediaPlayerManagerProxy;
 class RemoteVideoTrackProxy;
@@ -72,7 +74,8 @@
 
     void getConfiguration(RemoteMediaPlayerConfiguration&);
 
-    void prepareForPlayback(bool privateMode, WebCore::MediaPlayerEnums::Preload, bool preservesPitch, bool prepareForRendering);
+    void prepareForPlayback(bool privateMode, WebCore::MediaPlayerEnums::Preload, bool preservesPitch, bool prepareForRendering, WebCore::LayoutRect, float videoContentScale, CompletionHandler<void(Optional<LayerHostingContextID>&&)>&&);
+    void prepareForRendering();
 
     void load(const URL&, Optional<SandboxExtension::Handle>&&, const WebCore::ContentType&, const String&, CompletionHandler<void(RemoteMediaPlayerConfiguration&&)>&&);
     void cancelLoad();
@@ -92,8 +95,6 @@
     void setPrivateBrowsingMode(bool);
     void setPreservesPitch(bool);
 
-    void prepareForRendering();
-    void setSize(const WebCore::IntSize&);
     void setVisible(bool);
     void setShouldMaintainAspectRatio(bool);
     void setVideoFullscreenFrame(WebCore::FloatRect);
@@ -209,6 +210,7 @@
     RefPtr<SandboxExtension> m_sandboxExtension;
     Ref<IPC::Connection> m_webProcessConnection;
     RefPtr<WebCore::MediaPlayer> m_player;
+    std::unique_ptr<LayerHostingContext> m_layerHostingContext;
     RemoteMediaPlayerManagerProxy& m_manager;
     WebCore::MediaPlayerEnums::MediaEngineIdentifier m_engineIdentifier;
     Vector<WebCore::ContentType> m_typesRequiringHardwareSupport;
@@ -218,6 +220,8 @@
     bool m_seekableChanged { true };
     bool m_bufferedChanged { true };
     bool m_renderingCanBeAccelerated { true };
+    WebCore::LayoutRect m_videoContentBoxRect;
+    float m_videoContentScale { 1.0 };
 
 #if !RELEASE_LOG_DISABLED
     const Logger& m_logger;

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in (254554 => 254555)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in	2020-01-15 02:51:21 UTC (rev 254555)
@@ -24,7 +24,7 @@
 #if ENABLE(VIDEO)
 
 messages -> RemoteMediaPlayerProxy NotRefCounted {
-    PrepareForPlayback(bool privateMode, enum:uint8_t WebCore::MediaPlayerEnums::Preload preload, bool preservesPitch, bool prepareForRendering)
+    PrepareForPlayback(bool privateMode, enum:uint8_t WebCore::MediaPlayerEnums::Preload preload, bool preservesPitch, bool prepareForRendering, WebCore::LayoutRect layoutRect, float videoContentScale) -> (Optional<WebKit::LayerHostingContextID> layerHostingContextId) Async
 
     Load(URL url, Optional<WebKit::SandboxExtension::Handle> sandboxExtension, WebCore::ContentType contentType, String keySystem) -> (struct WebKit::RemoteMediaPlayerConfiguration playerConfiguration) Async
     CancelLoad()
@@ -45,7 +45,6 @@
     SetPreservesPitch(bool preservesPitch)
 
     PrepareForRendering()
-    SetSize(WebCore::IntSize size)
     SetVisible(bool visible)
     SetShouldMaintainAspectRatio(bool maintainAspectRatio)
     SetVideoFullscreenFrame(WebCore::FloatRect rect)

Copied: trunk/Source/WebKit/Platform/cocoa/LayerHostingContext.h (from rev 254554, trunk/Source/WebKit/Platform/mac/LayerHostingContext.h) (0 => 254555)


--- trunk/Source/WebKit/Platform/cocoa/LayerHostingContext.h	                        (rev 0)
+++ trunk/Source/WebKit/Platform/cocoa/LayerHostingContext.h	2020-01-15 02:51:21 UTC (rev 254555)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2012-2018 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
+
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS CALayer;
+OBJC_CLASS CAContext;
+
+namespace WTF {
+class MachSendRight;
+}
+
+namespace WebKit {
+
+using LayerHostingContextID = uint32_t;
+enum class LayerHostingMode : uint8_t;
+
+struct LayerHostingContextOptions {
+#if PLATFORM(IOS_FAMILY)
+    bool canShowWhileLocked { false };
+#endif
+};
+
+class LayerHostingContext {
+    WTF_MAKE_NONCOPYABLE(LayerHostingContext); WTF_MAKE_FAST_ALLOCATED;
+public:
+    static std::unique_ptr<LayerHostingContext> createForPort(const WTF::MachSendRight& serverPort);
+    
+#if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
+    static std::unique_ptr<LayerHostingContext> createForExternalHostingProcess(const LayerHostingContextOptions& = { });
+
+#if PLATFORM(MAC)
+    static std::unique_ptr<LayerHostingContext> createForExternalPluginHostingProcess();
+#endif
+
+    static RetainPtr<CALayer> createPlatformLayerForHostingContext(LayerHostingContextID);
+
+#endif // HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
+
+    LayerHostingContext();
+    ~LayerHostingContext();
+
+    void setRootLayer(CALayer *);
+    CALayer *rootLayer() const;
+
+    LayerHostingContextID contextID() const;
+    void invalidate();
+
+    LayerHostingMode layerHostingMode() { return m_layerHostingMode; }
+
+    void setColorSpace(CGColorSpaceRef);
+    CGColorSpaceRef colorSpace() const;
+
+#if PLATFORM(MAC)
+    void setColorMatchUntaggedContent(bool);
+    bool colorMatchUntaggedContent() const;
+#endif
+
+    // Fences only work on iOS and OS 10.10+.
+    void setFencePort(mach_port_t);
+
+    // createFencePort does not install the fence port on the LayerHostingContext's
+    // CAContext; call setFencePort() with the newly created port if synchronization
+    // with this context is desired.
+    WTF::MachSendRight createFencePort();
+
+private:
+    LayerHostingMode m_layerHostingMode;
+    RetainPtr<CAContext> m_context;
+};
+
+} // namespace WebKit
+

Copied: trunk/Source/WebKit/Platform/cocoa/LayerHostingContext.mm (from rev 254554, trunk/Source/WebKit/Platform/mac/LayerHostingContext.mm) (0 => 254555)


--- trunk/Source/WebKit/Platform/cocoa/LayerHostingContext.mm	                        (rev 0)
+++ trunk/Source/WebKit/Platform/cocoa/LayerHostingContext.mm	2020-01-15 02:51:21 UTC (rev 254555)
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2012-2018 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.
+ */
+
+#import "config.h"
+#import "LayerHostingContext.h"
+
+#import "LayerTreeContext.h"
+#import <WebCore/WebCoreCALayerExtras.h>
+#import <pal/spi/cg/CoreGraphicsSPI.h>
+#import <pal/spi/cocoa/QuartzCoreSPI.h>
+#import <wtf/MachSendRight.h>
+
+namespace WebKit {
+
+std::unique_ptr<LayerHostingContext> LayerHostingContext::createForPort(const MachSendRight& serverPort)
+{
+    auto layerHostingContext = makeUnique<LayerHostingContext>();
+
+    NSDictionary *options = @{
+        kCAContextPortNumber : @(serverPort.sendRight()),
+#if PLATFORM(MAC)
+        kCAContextCIFilterBehavior : @"ignore",
+#endif
+    };
+
+    layerHostingContext->m_layerHostingMode = LayerHostingMode::InProcess;
+    layerHostingContext->m_context = [CAContext remoteContextWithOptions:options];
+
+    return layerHostingContext;
+}
+
+#if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
+std::unique_ptr<LayerHostingContext> LayerHostingContext::createForExternalHostingProcess(const LayerHostingContextOptions& options)
+{
+    auto layerHostingContext = makeUnique<LayerHostingContext>();
+    layerHostingContext->m_layerHostingMode = LayerHostingMode::OutOfProcess;
+
+#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST)
+    // Use a very large display ID to ensure that the context is never put on-screen 
+    // without being explicitly parented. See <rdar://problem/16089267> for details.
+    layerHostingContext->m_context = [CAContext remoteContextWithOptions:@{
+        kCAContextSecure: @(options.canShowWhileLocked),
+#if HAVE(CORE_ANIMATION_RENDER_SERVER)
+        kCAContextIgnoresHitTest : @YES,
+        kCAContextDisplayId : @10000
+#endif
+    }];
+#elif !PLATFORM(MACCATALYST) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+    [CAContext setAllowsCGSConnections:NO];
+    layerHostingContext->m_context = [CAContext remoteContextWithOptions:@{
+        kCAContextCIFilterBehavior :  @"ignore",
+    }];
+#else
+    layerHostingContext->m_context = [CAContext contextWithCGSConnection:CGSMainConnectionID() options:@{
+        kCAContextCIFilterBehavior : @"ignore",
+    }];
+#endif
+    
+    return layerHostingContext;
+}
+
+#if PLATFORM(MAC)
+std::unique_ptr<LayerHostingContext> LayerHostingContext::createForExternalPluginHostingProcess()
+{
+    auto layerHostingContext = makeUnique<LayerHostingContext>();
+    layerHostingContext->m_layerHostingMode = LayerHostingMode::OutOfProcess;
+    layerHostingContext->m_context = [CAContext contextWithCGSConnection:CGSMainConnectionID() options:@{ kCAContextCIFilterBehavior : @"ignore" }];
+    return layerHostingContext;
+}
+#endif
+
+RetainPtr<CALayer> LayerHostingContext::createPlatformLayerForHostingContext(LayerHostingContextID contextID)
+{
+    return [CALayer _web_renderLayerWithContextID:contextID];
+}
+
+#endif // HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
+
+LayerHostingContext::LayerHostingContext()
+{
+}
+
+LayerHostingContext::~LayerHostingContext()
+{
+}
+
+void LayerHostingContext::setRootLayer(CALayer *rootLayer)
+{
+    [m_context setLayer:rootLayer];
+}
+
+CALayer *LayerHostingContext::rootLayer() const
+{
+    return [m_context layer];
+}
+
+LayerHostingContextID LayerHostingContext::contextID() const
+{
+    return [m_context contextId];
+}
+
+void LayerHostingContext::invalidate()
+{
+    [m_context invalidate];
+}
+
+void LayerHostingContext::setColorSpace(CGColorSpaceRef colorSpace)
+{
+    [m_context setColorSpace:colorSpace];
+}
+
+CGColorSpaceRef LayerHostingContext::colorSpace() const
+{
+    return [m_context colorSpace];
+}
+
+#if PLATFORM(MAC)
+void LayerHostingContext::setColorMatchUntaggedContent(bool colorMatchUntaggedContent)
+{
+    [m_context setColorMatchUntaggedContent:colorMatchUntaggedContent];
+}
+
+bool LayerHostingContext::colorMatchUntaggedContent() const
+{
+    return [m_context colorMatchUntaggedContent];
+}
+#endif
+
+void LayerHostingContext::setFencePort(mach_port_t fencePort)
+{
+    [m_context setFencePort:fencePort];
+}
+
+MachSendRight LayerHostingContext::createFencePort()
+{
+    return MachSendRight::adopt([m_context createFencePort]);
+}
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/Platform/ios/PaymentAuthorizationController.mm (254554 => 254555)


--- trunk/Source/WebKit/Platform/ios/PaymentAuthorizationController.mm	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/Platform/ios/PaymentAuthorizationController.mm	2020-01-15 02:51:21 UTC (rev 254555)
@@ -30,6 +30,7 @@
 
 #import "WKPaymentAuthorizationDelegate.h"
 #import <pal/cocoa/PassKitSoftLink.h>
+#import <wtf/CompletionHandler.h>
 
 @interface WKPaymentAuthorizationControllerDelegate : WKPaymentAuthorizationDelegate <PKPaymentAuthorizationControllerDelegate, PKPaymentAuthorizationControllerPrivateDelegate>
 

Deleted: trunk/Source/WebKit/Platform/mac/LayerHostingContext.h (254554 => 254555)


--- trunk/Source/WebKit/Platform/mac/LayerHostingContext.h	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/Platform/mac/LayerHostingContext.h	2020-01-15 02:51:21 UTC (rev 254555)
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2012-2018 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
-
-#include "LayerTreeContext.h"
-#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/RetainPtr.h>
-
-OBJC_CLASS CALayer;
-OBJC_CLASS CAContext;
-
-namespace WTF {
-class MachSendRight;
-}
-
-namespace WebKit {
-
-using LayerHostingContextID = uint32_t;
-    
-struct LayerHostingContextOptions {
-#if PLATFORM(IOS_FAMILY)
-    bool canShowWhileLocked { false };
-#endif
-};
-
-class LayerHostingContext {
-    WTF_MAKE_NONCOPYABLE(LayerHostingContext); WTF_MAKE_FAST_ALLOCATED;
-public:
-    static std::unique_ptr<LayerHostingContext> createForPort(const WTF::MachSendRight& serverPort);
-    
-#if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
-    static std::unique_ptr<LayerHostingContext> createForExternalHostingProcess(const LayerHostingContextOptions& = { });
-
-#if PLATFORM(MAC)
-    static std::unique_ptr<LayerHostingContext> createForExternalPluginHostingProcess();
-#endif
-    
-#endif // HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
-
-    LayerHostingContext();
-    ~LayerHostingContext();
-
-    void setRootLayer(CALayer *);
-    CALayer *rootLayer() const;
-
-    LayerHostingContextID contextID() const;
-    void invalidate();
-
-    LayerHostingMode layerHostingMode() { return m_layerHostingMode; }
-
-    void setColorSpace(CGColorSpaceRef);
-    CGColorSpaceRef colorSpace() const;
-
-#if PLATFORM(MAC)
-    void setColorMatchUntaggedContent(bool);
-    bool colorMatchUntaggedContent() const;
-#endif
-
-    // Fences only work on iOS and OS 10.10+.
-    void setFencePort(mach_port_t);
-
-    // createFencePort does not install the fence port on the LayerHostingContext's
-    // CAContext; call setFencePort() with the newly created port if synchronization
-    // with this context is desired.
-    WTF::MachSendRight createFencePort();
-
-private:
-    LayerHostingMode m_layerHostingMode;
-    RetainPtr<CAContext> m_context;
-};
-
-} // namespace WebKit
-

Deleted: trunk/Source/WebKit/Platform/mac/LayerHostingContext.mm (254554 => 254555)


--- trunk/Source/WebKit/Platform/mac/LayerHostingContext.mm	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/Platform/mac/LayerHostingContext.mm	2020-01-15 02:51:21 UTC (rev 254555)
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2012-2018 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.
- */
-
-#import "config.h"
-#import "LayerHostingContext.h"
-
-#import <pal/spi/cg/CoreGraphicsSPI.h>
-#import <pal/spi/cocoa/QuartzCoreSPI.h>
-#import <wtf/MachSendRight.h>
-
-namespace WebKit {
-
-std::unique_ptr<LayerHostingContext> LayerHostingContext::createForPort(const MachSendRight& serverPort)
-{
-    auto layerHostingContext = makeUnique<LayerHostingContext>();
-
-    NSDictionary *options = @{
-        kCAContextPortNumber : @(serverPort.sendRight()),
-#if PLATFORM(MAC)
-        kCAContextCIFilterBehavior : @"ignore",
-#endif
-    };
-
-    layerHostingContext->m_layerHostingMode = LayerHostingMode::InProcess;
-    layerHostingContext->m_context = [CAContext remoteContextWithOptions:options];
-
-    return layerHostingContext;
-}
-
-#if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
-std::unique_ptr<LayerHostingContext> LayerHostingContext::createForExternalHostingProcess(const LayerHostingContextOptions& options)
-{
-    auto layerHostingContext = makeUnique<LayerHostingContext>();
-    layerHostingContext->m_layerHostingMode = LayerHostingMode::OutOfProcess;
-
-#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST)
-    // Use a very large display ID to ensure that the context is never put on-screen 
-    // without being explicitly parented. See <rdar://problem/16089267> for details.
-    layerHostingContext->m_context = [CAContext remoteContextWithOptions:@{
-        kCAContextSecure: @(options.canShowWhileLocked),
-#if HAVE(CORE_ANIMATION_RENDER_SERVER)
-        kCAContextIgnoresHitTest : @YES,
-        kCAContextDisplayId : @10000
-#endif
-    }];
-#elif !PLATFORM(MACCATALYST) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
-    [CAContext setAllowsCGSConnections:NO];
-    layerHostingContext->m_context = [CAContext remoteContextWithOptions:@{
-        kCAContextCIFilterBehavior :  @"ignore",
-    }];
-#else
-    layerHostingContext->m_context = [CAContext contextWithCGSConnection:CGSMainConnectionID() options:@{
-        kCAContextCIFilterBehavior : @"ignore",
-    }];
-#endif
-    
-    return layerHostingContext;
-}
-
-#if PLATFORM(MAC)
-std::unique_ptr<LayerHostingContext> LayerHostingContext::createForExternalPluginHostingProcess()
-{
-    auto layerHostingContext = makeUnique<LayerHostingContext>();
-    layerHostingContext->m_layerHostingMode = LayerHostingMode::OutOfProcess;
-    layerHostingContext->m_context = [CAContext contextWithCGSConnection:CGSMainConnectionID() options:@{ kCAContextCIFilterBehavior : @"ignore" }];
-    return layerHostingContext;
-}
-#endif
-#endif // HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
-
-LayerHostingContext::LayerHostingContext()
-{
-}
-
-LayerHostingContext::~LayerHostingContext()
-{
-}
-
-void LayerHostingContext::setRootLayer(CALayer *rootLayer)
-{
-    [m_context setLayer:rootLayer];
-}
-
-CALayer *LayerHostingContext::rootLayer() const
-{
-    return [m_context layer];
-}
-
-LayerHostingContextID LayerHostingContext::contextID() const
-{
-    return [m_context contextId];
-}
-
-void LayerHostingContext::invalidate()
-{
-    [m_context invalidate];
-}
-
-void LayerHostingContext::setColorSpace(CGColorSpaceRef colorSpace)
-{
-    [m_context setColorSpace:colorSpace];
-}
-
-CGColorSpaceRef LayerHostingContext::colorSpace() const
-{
-    return [m_context colorSpace];
-}
-
-#if PLATFORM(MAC)
-void LayerHostingContext::setColorMatchUntaggedContent(bool colorMatchUntaggedContent)
-{
-    [m_context setColorMatchUntaggedContent:colorMatchUntaggedContent];
-}
-
-bool LayerHostingContext::colorMatchUntaggedContent() const
-{
-    return [m_context colorMatchUntaggedContent];
-}
-#endif
-
-void LayerHostingContext::setFencePort(mach_port_t fencePort)
-{
-    [m_context setFencePort:fencePort];
-}
-
-MachSendRight LayerHostingContext::createFencePort()
-{
-    return MachSendRight::adopt([m_context createFencePort]);
-}
-
-} // namespace WebKit

Modified: trunk/Source/WebKit/PluginProcess/mac/PluginControllerProxyMac.mm (254554 => 254555)


--- trunk/Source/WebKit/PluginProcess/mac/PluginControllerProxyMac.mm	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/PluginProcess/mac/PluginControllerProxyMac.mm	2020-01-15 02:51:21 UTC (rev 254555)
@@ -29,6 +29,7 @@
 #if ENABLE(NETSCAPE_PLUGIN_API)
 
 #import "LayerHostingContext.h"
+#import "LayerTreeContext.h"
 #import "PluginCreationParameters.h"
 #import "PluginProcess.h"
 #import "PluginProcessProxyMessages.h"

Modified: trunk/Source/WebKit/SourcesCocoa.txt (254554 => 254555)


--- trunk/Source/WebKit/SourcesCocoa.txt	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2020-01-15 02:51:21 UTC (rev 254555)
@@ -69,6 +69,7 @@
 Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp
 Platform/classifier/ResourceLoadStatisticsClassifier.cpp
 
+Platform/cocoa/LayerHostingContext.mm
 Platform/cocoa/PaymentAuthorizationPresenter.mm
 Platform/cocoa/PaymentAuthorizationViewController.mm
 Platform/cocoa/SharedMemoryCocoa.cpp
@@ -84,7 +85,6 @@
 Platform/IPC/cocoa/ConnectionCocoa.mm
 Platform/IPC/cocoa/MachMessage.cpp
 
-Platform/mac/LayerHostingContext.mm
 Platform/mac/MachUtilities.cpp
 Platform/mac/MenuUtilities.mm
 Platform/mac/StringUtilities.mm

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (254554 => 254555)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-01-15 02:51:21 UTC (rev 254555)
@@ -5551,8 +5551,6 @@
 		1A7E814E1152D2240003695B /* mac */ = {
 			isa = PBXGroup;
 			children = (
-				BCE0937614FB128B001138D9 /* LayerHostingContext.h */,
-				BCE0937514FB128B001138D9 /* LayerHostingContext.mm */,
 				1A24B5F011F531E800C38269 /* MachUtilities.cpp */,
 				1A24B5F111F531E800C38269 /* MachUtilities.h */,
 				51933DEB1965EB24008AC3EA /* MenuUtilities.h */,
@@ -7243,6 +7241,8 @@
 		4450AEBE1DC3FAAC009943F2 /* cocoa */ = {
 			isa = PBXGroup;
 			children = (
+				BCE0937614FB128B001138D9 /* LayerHostingContext.h */,
+				BCE0937514FB128B001138D9 /* LayerHostingContext.mm */,
 				A1798B3D222D97A2000764BD /* PaymentAuthorizationPresenter.h */,
 				A1798B4A222F133A000764BD /* PaymentAuthorizationPresenter.mm */,
 				A1798B3F222D98B6000764BD /* PaymentAuthorizationViewController.h */,

Modified: trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp (254554 => 254555)


--- trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2020-01-15 02:51:21 UTC (rev 254555)
@@ -46,11 +46,11 @@
 #include <wtf/URL.h>
 #include <wtf/text/CString.h>
 
+namespace WebCore {
 #if !RELEASE_LOG_DISABLED
-namespace WebCore {
 extern WTFLogChannel LogMedia;
+#endif
 }
-#endif
 
 namespace WebKit {
 using namespace WebCore;
@@ -89,7 +89,18 @@
 
 void MediaPlayerPrivateRemote::prepareForPlayback(bool privateMode, MediaPlayer::Preload preload, bool preservesPitch, bool prepare)
 {
-    connection().send(Messages::RemoteMediaPlayerProxy::PrepareForPlayback(privateMode, preload, preservesPitch, prepare), m_id);
+    auto layoutRect = m_player->playerContentBoxRect();
+    auto scale = m_player->playerContentsScale();
+
+    connection().sendWithAsyncReply(Messages::RemoteMediaPlayerProxy::PrepareForPlayback(privateMode, preload, preservesPitch, prepare, layoutRect, scale), [weakThis = makeWeakPtr(*this), this](auto contextId) mutable {
+        if (!weakThis)
+            return;
+
+        if (!contextId)
+            return;
+
+        m_videoLayer = LayerHostingContext::createPlatformLayerForHostingContext(contextId.value());
+    }, m_id);
 }
 
 void MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load(const URL& url, const ContentType& contentType, const String& keySystem)
@@ -121,7 +132,7 @@
 
     connection().sendWithAsyncReply(Messages::RemoteMediaPlayerProxy::Load(url, sandboxExtensionHandle, contentType, keySystem), [weakThis = makeWeakPtr(*this)](auto&& configuration) {
         if (weakThis)
-            weakThis->m_configuration = configuration;
+            weakThis->m_configuration = WTFMove(configuration);
     }, m_id);
 }
 
@@ -291,6 +302,11 @@
     m_player->sizeChanged();
 }
 
+void MediaPlayerPrivateRemote::firstVideoFrameAvailable()
+{
+    m_player->firstVideoFrameAvailable();
+}
+
 String MediaPlayerPrivateRemote::engineDescription() const
 {
     return m_configuration.engineDescription;
@@ -346,11 +362,6 @@
     connection().send(Messages::RemoteMediaPlayerProxy::PrepareForRendering(), m_id);
 }
 
-void MediaPlayerPrivateRemote::setSize(const WebCore::IntSize& size)
-{
-    connection().send(Messages::RemoteMediaPlayerProxy::SetSize(size), m_id);
-}
-
 void MediaPlayerPrivateRemote::setVisible(bool visible)
 {
     connection().send(Messages::RemoteMediaPlayerProxy::SetVisible(visible), m_id);
@@ -480,8 +491,7 @@
 
 PlatformLayer* MediaPlayerPrivateRemote::platformLayer() const
 {
-    notImplemented();
-    return nullptr;
+    return m_videoLayer.get();
 }
 
 #if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))

Modified: trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h (254554 => 254555)


--- trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2020-01-15 02:51:21 UTC (rev 254555)
@@ -78,6 +78,7 @@
     void updateCachedState(RemoteMediaPlayerState&&);
     void characteristicChanged(bool hasAudio, bool hasVideo, WebCore::MediaPlayerEnums::MovieLoadType);
     void sizeChanged(WebCore::FloatSize);
+    void firstVideoFrameAvailable();
 
     void addRemoteAudioTrack(TrackPrivateRemoteIdentifier, TrackPrivateRemoteConfiguration&&);
     void removeRemoteAudioTrack(TrackPrivateRemoteIdentifier);
@@ -123,7 +124,6 @@
 
     bool shouldIgnoreIntrinsicSize() final;
 
-    // Unimplemented
     PlatformLayer* platformLayer() const final;
 
 #if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
@@ -196,7 +196,10 @@
     unsigned long long totalBytes() const final;
     bool didLoadingProgress() const final;
 
-    void setSize(const WebCore::IntSize&) final;
+    // In the Cocoa WebKit port, MediaPlayerPrivateAVFoundationObjC::setSize() does nothing,
+    // so the Web process does not need to send IPC messages to call it in the GPU process.
+    // Other WebKit ports may need to do that.
+    void setSize(const WebCore::IntSize&) final { }
 
     void paint(WebCore::GraphicsContext&, const WebCore::FloatRect&) final;
 
@@ -316,6 +319,7 @@
 
     WebCore::MediaPlayer* m_player { nullptr };
     RefPtr<WebCore::PlatformMediaResourceLoader> m_mediaResourceLoader;
+    RetainPtr<PlatformLayer> m_videoLayer;
     RemoteMediaPlayerManager& m_manager;
     WebCore::MediaPlayerEnums::MediaEngineIdentifier m_remoteEngineIdentifier;
     MediaPlayerPrivateRemoteIdentifier m_id;

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp (254554 => 254555)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp	2020-01-15 02:51:21 UTC (rev 254555)
@@ -293,13 +293,13 @@
 
 void RemoteMediaPlayerManager::characteristicChanged(MediaPlayerPrivateRemoteIdentifier id, bool hasAudio, bool hasVideo, WebCore::MediaPlayerEnums::MovieLoadType loadType)
 {
-    if (auto player = m_players.get(id))
+    if (const auto& player = m_players.get(id))
         player->characteristicChanged(hasAudio, hasVideo, loadType);
 }
 
 void RemoteMediaPlayerManager::sizeChanged(MediaPlayerPrivateRemoteIdentifier id, WebCore::FloatSize naturalSize)
 {
-    if (auto player = m_players.get(id))
+    if (const auto& player = m_players.get(id))
         player->sizeChanged(naturalSize);
 }
 
@@ -323,22 +323,28 @@
 
 void RemoteMediaPlayerManager::addRemoteVideoTrack(MediaPlayerPrivateRemoteIdentifier playerID, TrackPrivateRemoteIdentifier trackID, TrackPrivateRemoteConfiguration&& configuration)
 {
-    if (auto player = m_players.get(playerID))
+    if (const auto& player = m_players.get(playerID))
         player->addRemoteVideoTrack(trackID, WTFMove(configuration));
 }
 
 void RemoteMediaPlayerManager::removeRemoteVideoTrack(MediaPlayerPrivateRemoteIdentifier playerID, TrackPrivateRemoteIdentifier trackID)
 {
-    if (auto player = m_players.get(playerID))
+    if (const auto& player = m_players.get(playerID))
         player->removeRemoteVideoTrack(trackID);
 }
 
 void RemoteMediaPlayerManager::remoteVideoTrackConfigurationChanged(MediaPlayerPrivateRemoteIdentifier playerID, TrackPrivateRemoteIdentifier trackID, TrackPrivateRemoteConfiguration&& configuration)
 {
-    if (auto player = m_players.get(playerID))
+    if (const auto& player = m_players.get(playerID))
         player->remoteVideoTrackConfigurationChanged(trackID, WTFMove(configuration));
 }
 
+void RemoteMediaPlayerManager::firstVideoFrameAvailable(WebKit::MediaPlayerPrivateRemoteIdentifier id)
+{
+    if (const auto& player = m_players.get(id))
+        player->firstVideoFrameAvailable();
+}
+
 void RemoteMediaPlayerManager::requestResource(MediaPlayerPrivateRemoteIdentifier id, RemoteMediaResourceIdentifier remoteMediaResourceIdentifier, ResourceRequest&& request, PlatformMediaResourceLoader::LoadOptions options, CompletionHandler<void()>&& completionHandler)
 {
     if (const auto& player = m_players.get(id))
@@ -364,7 +370,7 @@
 
 void RemoteMediaPlayerManager::updateCachedState(MediaPlayerPrivateRemoteIdentifier id, RemoteMediaPlayerState&& state)
 {
-    if (auto player = m_players.get(id))
+    if (const auto& player = m_players.get(id))
         player->updateCachedState(WTFMove(state));
 }
 

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.h (254554 => 254555)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.h	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.h	2020-01-15 02:51:21 UTC (rev 254555)
@@ -93,6 +93,7 @@
     void addRemoteAudioTrack(MediaPlayerPrivateRemoteIdentifier, TrackPrivateRemoteIdentifier, TrackPrivateRemoteConfiguration&&);
     void removeRemoteAudioTrack(MediaPlayerPrivateRemoteIdentifier, TrackPrivateRemoteIdentifier);
     void remoteAudioTrackConfigurationChanged(MediaPlayerPrivateRemoteIdentifier, TrackPrivateRemoteIdentifier, TrackPrivateRemoteConfiguration&&);
+    void firstVideoFrameAvailable(WebKit::MediaPlayerPrivateRemoteIdentifier);
 
     void addRemoteVideoTrack(MediaPlayerPrivateRemoteIdentifier, TrackPrivateRemoteIdentifier, TrackPrivateRemoteConfiguration&&);
     void removeRemoteVideoTrack(MediaPlayerPrivateRemoteIdentifier, TrackPrivateRemoteIdentifier);

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in (254554 => 254555)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in	2020-01-15 02:51:21 UTC (rev 254555)
@@ -26,6 +26,7 @@
 messages -> RemoteMediaPlayerManager NotRefCounted {
     NetworkStateChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, struct WebKit::RemoteMediaPlayerState state)
     ReadyStateChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, struct WebKit::RemoteMediaPlayerState state)
+    FirstVideoFrameAvailable(WebKit::MediaPlayerPrivateRemoteIdentifier id)
     VolumeChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, double volume)
     MuteChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, bool mute)
     TimeChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, struct WebKit::RemoteMediaPlayerState state)

Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (254554 => 254555)


--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2020-01-15 02:50:12 UTC (rev 254554)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2020-01-15 02:51:21 UTC (rev 254555)
@@ -48,6 +48,7 @@
 
 #if PLATFORM(COCOA)
 #include "LayerHostingContext.h"
+#include "LayerTreeContext.h"
 #endif
 
 namespace WebKit {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to