Title: [257363] trunk/Source
Revision
257363
Author
commit-qu...@webkit.org
Date
2020-02-25 10:49:00 -0800 (Tue, 25 Feb 2020)

Log Message

Make HostWindow be the creator of the remote ImageBuffer
https://bugs.webkit.org/show_bug.cgi?id=207134

Patch by Said Abou-Hallawa <sabouhall...@apple.com> on 2020-02-25
Reviewed by Darin Adler.

Source/WebCore:

ImageBuffer is responsible of creating all the in-process ImageBuffers.
HostWindow will be responsible of creating the remote ImageBuffers.

HostWindow adds the virtual function createImageBuffer(). Chrome forward
this to the virtual function createImageBuffer() on the ChromeClient.

* page/Chrome.cpp:
(WebCore::Chrome::createImageBuffer const):
* page/Chrome.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::createImageBuffer const):
* platform/HostWindow.h:
* platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::create):
* platform/graphics/RenderingMode.h:

Source/WebKit:

WebChromeClient adds stubs for creating the remote ImageBuffers.

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createImageBuffer const):
* WebProcess/WebCoreSupport/WebChromeClient.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (257362 => 257363)


--- trunk/Source/WebCore/ChangeLog	2020-02-25 18:37:25 UTC (rev 257362)
+++ trunk/Source/WebCore/ChangeLog	2020-02-25 18:49:00 UTC (rev 257363)
@@ -1,3 +1,26 @@
+2020-02-25  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        Make HostWindow be the creator of the remote ImageBuffer
+        https://bugs.webkit.org/show_bug.cgi?id=207134
+
+        Reviewed by Darin Adler.
+
+        ImageBuffer is responsible of creating all the in-process ImageBuffers.
+        HostWindow will be responsible of creating the remote ImageBuffers.
+
+        HostWindow adds the virtual function createImageBuffer(). Chrome forward
+        this to the virtual function createImageBuffer() on the ChromeClient.
+
+        * page/Chrome.cpp:
+        (WebCore::Chrome::createImageBuffer const):
+        * page/Chrome.h:
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::createImageBuffer const):
+        * platform/HostWindow.h:
+        * platform/graphics/ImageBuffer.cpp:
+        (WebCore::ImageBuffer::create):
+        * platform/graphics/RenderingMode.h:
+
 2020-02-25  Sihui Liu  <sihui_...@apple.com>
 
         Assertion failed: currentSchema == createV1ObjectStoreInfoSchema(objectStoreInfoTableName) || currentSchema == createV1ObjectStoreInfoSchema(objectStoreInfoTableNameAlternate)

Modified: trunk/Source/WebCore/page/Chrome.cpp (257362 => 257363)


--- trunk/Source/WebCore/page/Chrome.cpp	2020-02-25 18:37:25 UTC (rev 257362)
+++ trunk/Source/WebCore/page/Chrome.cpp	2020-02-25 18:49:00 UTC (rev 257363)
@@ -494,6 +494,11 @@
     m_client.setCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves);
 }
 
+std::unique_ptr<ImageBuffer> Chrome::createImageBuffer(const FloatSize& size, RenderingMode renderingMode, float resolutionScale, ColorSpace colorSpace) const
+{
+    return m_client.createImageBuffer(size, renderingMode, resolutionScale, colorSpace);
+}
+
 PlatformDisplayID Chrome::displayID() const
 {
     return m_displayID;

Modified: trunk/Source/WebCore/page/Chrome.h (257362 => 257363)


--- trunk/Source/WebCore/page/Chrome.h	2020-02-25 18:37:25 UTC (rev 257362)
+++ trunk/Source/WebCore/page/Chrome.h	2020-02-25 18:49:00 UTC (rev 257363)
@@ -83,6 +83,8 @@
     void setCursor(const Cursor&) override;
     void setCursorHiddenUntilMouseMoves(bool) override;
 
+    std::unique_ptr<ImageBuffer> createImageBuffer(const FloatSize&, RenderingMode, float resolutionScale, ColorSpace) const override;
+
     void scheduleAnimation() override { }
 
     PlatformDisplayID displayID() const override;

Modified: trunk/Source/WebCore/page/ChromeClient.h (257362 => 257363)


--- trunk/Source/WebCore/page/ChromeClient.h	2020-02-25 18:37:25 UTC (rev 257362)
+++ trunk/Source/WebCore/page/ChromeClient.h	2020-02-25 18:49:00 UTC (rev 257363)
@@ -36,6 +36,7 @@
 #include "HTMLMediaElementEnums.h"
 #include "HostWindow.h"
 #include "Icon.h"
+#include "ImageBuffer.h"
 #include "InputMode.h"
 #include "MediaProducer.h"
 #include "PopupMenu.h"
@@ -305,6 +306,8 @@
     virtual RefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const { return nullptr; }
 #endif
 
+    virtual std::unique_ptr<ImageBuffer> createImageBuffer(const FloatSize&, RenderingMode, float, ColorSpace) const { return nullptr; }
+
     // Pass nullptr as the GraphicsLayer to detatch the root layer.
     virtual void attachRootGraphicsLayer(Frame&, GraphicsLayer*) = 0;
     virtual void attachViewOverlayGraphicsLayer(GraphicsLayer*) = 0;

Modified: trunk/Source/WebCore/platform/HostWindow.h (257362 => 257363)


--- trunk/Source/WebCore/platform/HostWindow.h	2020-02-25 18:37:25 UTC (rev 257362)
+++ trunk/Source/WebCore/platform/HostWindow.h	2020-02-25 18:49:00 UTC (rev 257363)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc.  All rights reserved.
+ * Copyright (C) 2008-2020 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef HostWindow_h
-#define HostWindow_h
+#pragma once
 
 #include "Widget.h"
 
@@ -31,7 +30,11 @@
 namespace WebCore {
 
 class Cursor;
+class ImageBuffer;
 
+enum class ColorSpace : uint8_t;
+enum class RenderingMode : uint8_t;
+
 class HostWindow {
     WTF_MAKE_NONCOPYABLE(HostWindow); WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -55,7 +58,9 @@
     virtual IntRect rootViewToScreen(const IntRect&) const = 0;
     virtual IntPoint accessibilityScreenToRootView(const IntPoint&) const = 0;
     virtual IntRect rootViewToAccessibilityScreen(const IntRect&) const = 0;
-    
+
+    virtual std::unique_ptr<ImageBuffer> createImageBuffer(const FloatSize&, RenderingMode, float resolutionScale, ColorSpace) const = 0;
+
     // Method for retrieving the native client of the page.
     virtual PlatformPageClient platformPageClient() const = 0;
     
@@ -75,5 +80,3 @@
 };
 
 } // namespace WebCore
-
-#endif // HostWindow_h

Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp (257362 => 257363)


--- trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp	2020-02-25 18:37:25 UTC (rev 257362)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp	2020-02-25 18:49:00 UTC (rev 257363)
@@ -29,6 +29,7 @@
 #include "ImageBuffer.h"
 
 #include "GraphicsContext.h"
+#include "HostWindow.h"
 #include "ImageData.h"
 #include "PlatformImageBuffer.h"
 
@@ -40,7 +41,7 @@
 std::unique_ptr<ImageBuffer> ImageBuffer::create(const FloatSize& size, RenderingMode renderingMode, float resolutionScale, ColorSpace colorSpace, const HostWindow* hostWindow)
 {
     std::unique_ptr<ImageBuffer> imageBuffer;
-    
+
     switch (renderingMode) {
     case RenderingMode::Accelerated:
         imageBuffer = AcceleratedImageBuffer::create(size, resolutionScale, colorSpace, hostWindow);
@@ -49,7 +50,7 @@
         if (!imageBuffer)
             imageBuffer = UnacceleratedImageBuffer::create(size, resolutionScale, colorSpace, hostWindow);
         break;
-            
+
     case RenderingMode::DisplayListAccelerated:
         imageBuffer = DisplayListAcceleratedImageBuffer::create(size, resolutionScale, colorSpace, hostWindow);
         FALLTHROUGH;
@@ -57,6 +58,12 @@
         if (!imageBuffer)
             imageBuffer = DisplayListUnacceleratedImageBuffer::create(size, resolutionScale, colorSpace, hostWindow);
         break;
+
+    case RenderingMode::RemoteAccelerated:
+    case RenderingMode::RemoteUnaccelerated:
+        if (hostWindow)
+            imageBuffer = hostWindow->createImageBuffer(size, renderingMode, resolutionScale, colorSpace);
+        break;
     }
 
     return imageBuffer;
@@ -74,7 +81,7 @@
         if (!imageBuffer)
             imageBuffer = UnacceleratedImageBuffer::create(size, context);
         break;
-            
+
     case RenderingMode::DisplayListAccelerated:
         imageBuffer = DisplayListAcceleratedImageBuffer::create(size, context);
         FALLTHROUGH;
@@ -82,6 +89,11 @@
         if (!imageBuffer)
             imageBuffer = DisplayListUnacceleratedImageBuffer::create(size, context);
         break;
+
+    case RenderingMode::RemoteUnaccelerated:
+    case RenderingMode::RemoteAccelerated:
+        ASSERT_NOT_REACHED();
+        break;
     }
 
     return imageBuffer;

Modified: trunk/Source/WebCore/platform/graphics/RenderingMode.h (257362 => 257363)


--- trunk/Source/WebCore/platform/graphics/RenderingMode.h	2020-02-25 18:37:25 UTC (rev 257362)
+++ trunk/Source/WebCore/platform/graphics/RenderingMode.h	2020-02-25 18:49:00 UTC (rev 257363)
@@ -32,6 +32,8 @@
     Unaccelerated,
     DisplayListAccelerated,
     DisplayListUnaccelerated,
+    RemoteAccelerated,
+    RemoteUnaccelerated
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/ChangeLog (257362 => 257363)


--- trunk/Source/WebKit/ChangeLog	2020-02-25 18:37:25 UTC (rev 257362)
+++ trunk/Source/WebKit/ChangeLog	2020-02-25 18:49:00 UTC (rev 257363)
@@ -1,3 +1,16 @@
+2020-02-25  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        Make HostWindow be the creator of the remote ImageBuffer
+        https://bugs.webkit.org/show_bug.cgi?id=207134
+
+        Reviewed by Darin Adler.
+
+        WebChromeClient adds stubs for creating the remote ImageBuffers.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::createImageBuffer const):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
 2020-02-25  Kate Cheney  <katherine_che...@apple.com>
 
         Add additions to NetworkDataTaskCocoa

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (257362 => 257363)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2020-02-25 18:37:25 UTC (rev 257362)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2020-02-25 18:49:00 UTC (rev 257363)
@@ -890,6 +890,21 @@
 
 #endif
 
+std::unique_ptr<ImageBuffer> WebChromeClient::createImageBuffer(const FloatSize&, RenderingMode renderingMode, float, ColorSpace) const
+{
+    switch (renderingMode) {
+    case RenderingMode::RemoteAccelerated:
+    case RenderingMode::RemoteUnaccelerated:
+        // FIXME: Create the remote ImageBuffer
+        return nullptr;
+
+    default:
+        ASSERT_NOT_REACHED();
+    }
+
+    return nullptr;
+}
+
 void WebChromeClient::attachRootGraphicsLayer(Frame&, GraphicsLayer* layer)
 {
     if (layer)

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (257362 => 257363)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2020-02-25 18:37:25 UTC (rev 257362)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2020-02-25 18:49:00 UTC (rev 257363)
@@ -123,6 +123,8 @@
     WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) const final;
     WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) const final;
 
+    std::unique_ptr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, WebCore::RenderingMode, float resolutionScale, WebCore::ColorSpace) const final;
+
     void didFinishLoadingImageForElement(WebCore::HTMLImageElement&) final;
 
     PlatformPageClient platformPageClient() const final;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to