Title: [213985] trunk/Source/WebCore

Diff

Modified: trunk/Source/WebCore/ChangeLog (213984 => 213985)


--- trunk/Source/WebCore/ChangeLog	2017-03-15 17:04:33 UTC (rev 213984)
+++ trunk/Source/WebCore/ChangeLog	2017-03-15 17:06:55 UTC (rev 213985)
@@ -1,3 +1,15 @@
+2017-03-15  Ryan Haddad  <ryanhad...@apple.com>
+
+        Unreviewed, rolling out r213977.
+
+        This change broke the Windows build.
+
+        Reverted changeset:
+
+        "Make a base class for WebGL and WebGPU contexts"
+        https://bugs.webkit.org/show_bug.cgi?id=169651
+        http://trac.webkit.org/changeset/213977
+
 2017-03-15  Youenn Fablet  <you...@apple.com>
 
         run-webkit-tests is always creating mock libwebrtc tracks

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (213984 => 213985)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-03-15 17:04:33 UTC (rev 213984)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-03-15 17:06:55 UTC (rev 213985)
@@ -1335,7 +1335,6 @@
 		31078CCA1880AACE008099DC /* JSOESTextureHalfFloatLinear.h in Headers */ = {isa = PBXBuildFile; fileRef = 31078CC61880AAAA008099DC /* JSOESTextureHalfFloatLinear.h */; };
 		310D71951B335C9D009C7B73 /* ThemeCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 310D71931B335C9D009C7B73 /* ThemeCocoa.mm */; };
 		310D71961B335C9E009C7B73 /* ThemeCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 310D71941B335C9D009C7B73 /* ThemeCocoa.h */; };
-		311518FC1E78C15F00EC514A /* GPUBasedCanvasRenderingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 311518FB1E78C15F00EC514A /* GPUBasedCanvasRenderingContext.h */; };
 		311C08BD18EB7CAF00B65615 /* mediaControlsApple.css in Resources */ = {isa = PBXBuildFile; fileRef = CDC1DD4117CC2C48008CB55D /* mediaControlsApple.css */; };
 		311C08BE18EB7CAF00B65615 /* mediaControlsApple.js in Resources */ = {isa = PBXBuildFile; fileRef = CDE6560E17CA6E7600526BA7 /* mediaControlsApple.js */; };
 		311C08BF18EB7CAF00B65615 /* mediaControlsiOS.css in Resources */ = {isa = PBXBuildFile; fileRef = CDAAF45D1869094E003C1717 /* mediaControlsiOS.css */; };
@@ -8815,7 +8814,6 @@
 		31078CC61880AAAA008099DC /* JSOESTextureHalfFloatLinear.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESTextureHalfFloatLinear.h; sourceTree = "<group>"; };
 		310D71931B335C9D009C7B73 /* ThemeCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ThemeCocoa.mm; sourceTree = "<group>"; };
 		310D71941B335C9D009C7B73 /* ThemeCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThemeCocoa.h; sourceTree = "<group>"; };
-		311518FB1E78C15F00EC514A /* GPUBasedCanvasRenderingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPUBasedCanvasRenderingContext.h; sourceTree = "<group>"; };
 		311C08BC18E35D6800B65615 /* ControlStates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlStates.h; sourceTree = "<group>"; };
 		31288E6E0E3005D6003619AE /* CSSKeyframeRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSKeyframeRule.cpp; sourceTree = "<group>"; };
 		31288E6F0E3005D6003619AE /* CSSKeyframeRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSKeyframeRule.h; sourceTree = "<group>"; };

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (213984 => 213985)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2017-03-15 17:04:33 UTC (rev 213984)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2017-03-15 17:06:55 UTC (rev 213985)
@@ -293,7 +293,7 @@
     if (!shouldEnableWebGL(document().settings()))
         return nullptr;
 
-    if (m_context && !m_context->isWebGL())
+    if (m_context && !m_context->is3d())
         return nullptr;
 
     if (!m_context) {
@@ -321,7 +321,7 @@
     if (!RuntimeEnabledFeatures::sharedFeatures().webGPUEnabled())
         return nullptr;
 
-    if (m_context && !m_context->isWebGPU())
+    if (m_context && !m_context->isGPU())
         return nullptr;
 
     if (!m_context) {
@@ -393,9 +393,17 @@
 
     setSurfaceSize(newSize);
 
-    if (isGPUBased() && oldSize != size())
-        downcast<GPUBasedCanvasRenderingContext>(*m_context.get()).reshape(width(), height());
+#if ENABLE(WEBGPU)
+    // FIXME: WebGPU needs something here too.
+    if (isGPU() && oldSize != size())
+        static_cast<WebGPURenderingContext*>(m_context.get())->reshape(width(), height());
+#endif
 
+#if ENABLE(WEBGL)
+    if (is3D() && oldSize != size())
+        static_cast<WebGLRenderingContextBase*>(m_context.get())->reshape(width(), height());
+#endif
+
     auto renderer = this->renderer();
     if (is<RenderHTMLCanvas>(renderer)) {
         auto& canvasRenderer = downcast<RenderHTMLCanvas>(*renderer);
@@ -459,15 +467,31 @@
         }
     }
 
-    if (isGPUBased())
-        downcast<GPUBasedCanvasRenderingContext>(*m_context.get()).markLayerComposited();
+#if ENABLE(WEBGPU)
+    if (isGPU())
+        static_cast<WebGPURenderingContext*>(m_context.get())->markLayerComposited();
+#endif
+
+#if ENABLE(WEBGL)
+    if (is3D())
+        static_cast<WebGLRenderingContextBase*>(m_context.get())->markLayerComposited();
+#endif
 }
 
-bool HTMLCanvasElement::isGPUBased() const
+#if ENABLE(WEBGPU)
+bool HTMLCanvasElement::isGPU() const
 {
-    return m_context && m_context->isGPUBased();
+    return m_context && m_context->isGPU();
 }
+#endif
 
+#if ENABLE(WEBGL)
+bool HTMLCanvasElement::is3D() const
+{
+    return m_context && m_context->is3d();
+}
+#endif
+
 void HTMLCanvasElement::makeRenderingResultsAvailable()
 {
     if (m_context)
@@ -568,7 +592,7 @@
 RefPtr<ImageData> HTMLCanvasElement::getImageData()
 {
 #if ENABLE(WEBGL)
-    if (!m_context || !m_context->isWebGL())
+    if (!is3D())
         return nullptr;
 
     WebGLRenderingContextBase* ctx = static_cast<WebGLRenderingContextBase*>(m_context.get());

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (213984 => 213985)


--- trunk/Source/WebCore/html/HTMLCanvasElement.h	2017-03-15 17:04:33 UTC (rev 213984)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h	2017-03-15 17:06:55 UTC (rev 213985)
@@ -177,7 +177,12 @@
 
     bool paintsIntoCanvasBuffer() const;
 
-    bool isGPUBased() const;
+#if ENABLE(WEBGL)
+    bool is3D() const;
+#endif
+#if ENABLE(WEBGPU)
+    bool isGPU() const;
+#endif
 
     HashSet<CanvasObserver*> m_observers;
     std::unique_ptr<CanvasRenderingContext> m_context;

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h (213984 => 213985)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h	2017-03-15 17:04:33 UTC (rev 213984)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h	2017-03-15 17:06:55 UTC (rev 213985)
@@ -53,11 +53,8 @@
     virtual bool is2d() const { return false; }
     virtual bool isWebGL1() const { return false; }
     virtual bool isWebGL2() const { return false; }
-    bool isWebGL() const { return isWebGL1() || isWebGL2(); }
-#if ENABLE(WEBGPU)
-    virtual bool isWebGPU() const { return false; }
-#endif
-    virtual bool isGPUBased() const { return false; }
+    bool is3d() const { return isWebGL1() || isWebGL2(); }
+    virtual bool isGPU() const { return false; }
     virtual bool isAccelerated() const { return false; }
 
     virtual void paintRenderingResultsToCanvas() {}

Deleted: trunk/Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h (213984 => 213985)


--- trunk/Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h	2017-03-15 17:04:33 UTC (rev 213984)
+++ trunk/Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h	2017-03-15 17:06:55 UTC (rev 213985)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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
- * 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 "ActiveDOMObject.h"
-#include "CanvasRenderingContext.h"
-
-namespace WebCore {
-
-class GPUBasedCanvasRenderingContext : public CanvasRenderingContext, public ActiveDOMObject {
-public:
-
-    bool isGPUBased() const override { return true; }
-
-    bool isAccelerated() const override
-    {
-#if PLATFORM(WIN)
-        // FIXME: Implement accelerated canvas on Windows.
-        return false;
-#else
-        return true;
-#endif
-    }
-
-    virtual void reshape(int width, int height) = 0;
-    virtual void markLayerComposited() = 0;
-
-protected:
-    GPUBasedCanvasRenderingContext(HTMLCanvasElement& passedCanvas)
-        : CanvasRenderingContext(passedCanvas)
-        , ActiveDOMObject(&passedCanvas.document())
-    {
-    }
-};
-    
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::GPUBasedCanvasRenderingContext, isGPUBased())

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (213984 => 213985)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2017-03-15 17:04:33 UTC (rev 213984)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2017-03-15 17:06:55 UTC (rev 213985)
@@ -460,7 +460,8 @@
 }
 
 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement& passedCanvas, WebGLContextAttributes attributes)
-    : GPUBasedCanvasRenderingContext(passedCanvas)
+    : CanvasRenderingContext(passedCanvas)
+    , ActiveDOMObject(&passedCanvas.document())
     , m_dispatchContextLostEventTimer(*this, &WebGLRenderingContextBase::dispatchContextLostEvent)
     , m_restoreTimer(*this, &WebGLRenderingContextBase::maybeRestoreContext)
     , m_attributes(attributes)
@@ -473,7 +474,8 @@
 }
 
 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement& passedCanvas, Ref<GraphicsContext3D>&& context, WebGLContextAttributes attributes)
-    : GPUBasedCanvasRenderingContext(passedCanvas)
+    : CanvasRenderingContext(passedCanvas)
+    , ActiveDOMObject(&passedCanvas.document())
     , m_context(WTFMove(context))
     , m_dispatchContextLostEventTimer(*this, &WebGLRenderingContextBase::dispatchContextLostEvent)
     , m_restoreTimer(*this, &WebGLRenderingContextBase::maybeRestoreContext)

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (213984 => 213985)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2017-03-15 17:04:33 UTC (rev 213984)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2017-03-15 17:06:55 UTC (rev 213985)
@@ -27,8 +27,9 @@
 
 #if ENABLE(WEBGL)
 
+#include "ActiveDOMObject.h"
 #include "ActivityStateChangeObserver.h"
-#include "GPUBasedCanvasRenderingContext.h"
+#include "CanvasRenderingContext.h"
 #include "GraphicsContext3D.h"
 #include "ImageBuffer.h"
 #include "Timer.h"
@@ -109,11 +110,18 @@
     return (*clippedX != x || *clippedY != y || *clippedWidth != width || *clippedHeight != height);
 }
 
-class WebGLRenderingContextBase : public GPUBasedCanvasRenderingContext, private ActivityStateChangeObserver {
+class WebGLRenderingContextBase : public CanvasRenderingContext, private ActivityStateChangeObserver, public ActiveDOMObject {
 public:
     static std::unique_ptr<WebGLRenderingContextBase> create(HTMLCanvasElement&, WebGLContextAttributes&, const String&);
     virtual ~WebGLRenderingContextBase();
 
+#if PLATFORM(WIN)
+    // FIXME: Implement accelerated 3d canvas on Windows.
+    bool isAccelerated() const override { return false; }
+#else
+    bool isAccelerated() const override { return true; }
+#endif
+
     int drawingBufferWidth() const;
     int drawingBufferHeight() const;
 
@@ -339,9 +347,9 @@
     WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); }
     PlatformLayer* platformLayer() const override;
 
-    void reshape(int width, int height) override;
+    void reshape(int width, int height);
 
-    void markLayerComposited() override final;
+    void markLayerComposited();
     void paintRenderingResultsToCanvas() override;
     RefPtr<ImageData> paintRenderingResultsToImageData();
 
@@ -838,6 +846,6 @@
 
 } // namespace WebCore
 
-SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::WebGLRenderingContextBase, isWebGL())
+SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::WebGLRenderingContextBase, is3d())
 
 #endif

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp (213984 => 213985)


--- trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp	2017-03-15 17:04:33 UTC (rev 213984)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp	2017-03-15 17:06:55 UTC (rev 213985)
@@ -86,7 +86,8 @@
 }
 
 WebGPURenderingContext::WebGPURenderingContext(HTMLCanvasElement& canvas, PassRefPtr<GPUDevice> device)
-    : GPUBasedCanvasRenderingContext(canvas)
+    : CanvasRenderingContext(canvas)
+    , ActiveDOMObject(&canvas.document())
     , m_device(device)
 {
     initializeNewContext();

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderingContext.h (213984 => 213985)


--- trunk/Source/WebCore/html/canvas/WebGPURenderingContext.h	2017-03-15 17:04:33 UTC (rev 213984)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderingContext.h	2017-03-15 17:06:55 UTC (rev 213985)
@@ -27,7 +27,8 @@
 
 #if ENABLE(WEBGPU)
 
-#include "GPUBasedCanvasRenderingContext.h"
+#include "ActiveDOMObject.h"
+#include "CanvasRenderingContext.h"
 #include "GPUDevice.h"
 #include <runtime/ArrayBuffer.h>
 
@@ -45,16 +46,19 @@
 class WebGPUTexture;
 class WebGPUTextureDescriptor;
 
-class WebGPURenderingContext : public GPUBasedCanvasRenderingContext {
+class WebGPURenderingContext : public CanvasRenderingContext, public ActiveDOMObject {
 public:
     static std::unique_ptr<WebGPURenderingContext> create(HTMLCanvasElement&);
+//    virtual ~WebGPURenderingContext();
 
-    bool isWebGPU() const override final { return true; }
+    bool isGPU() const override { return true; }
 
-    void reshape(int width, int height) override final;
+    bool isAccelerated() const override { return true; }
 
-    void markLayerComposited() override final;
+    void reshape(int width, int height);
 
+    void markLayerComposited();
+
     PlatformLayer* platformLayer() const override;
 
     RefPtr<GPUDevice> device() { return m_device; }
@@ -86,6 +90,7 @@
     void initializeNewContext();
 
 private:
+//    WebGPURenderingContext(HTMLCanvasElement*);//, GraphicsContext3D::Attributes);
     WebGPURenderingContext(HTMLCanvasElement&, PassRefPtr<GPUDevice>);
 
     RefPtr<GPUDevice> m_device;
@@ -93,6 +98,6 @@
 
 } // namespace WebCore
 
-SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::WebGPURenderingContext, isWebGPU())
+SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::WebGPURenderingContext, isGPU())
 
 #endif

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (213984 => 213985)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2017-03-15 17:04:33 UTC (rev 213984)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2017-03-15 17:06:55 UTC (rev 213985)
@@ -81,9 +81,14 @@
     if (!context || !context->isAccelerated())
         return UnacceleratedCanvas;
     
-    if (context->isGPUBased())
+    if (context->is3d())
         return CanvasAsLayerContents;
 
+#if ENABLE(WEBGPU)
+    if (context->isGPU())
+        return CanvasAsLayerContents;
+#endif
+
 #if ENABLE(ACCELERATED_2D_CANVAS)
     return CanvasAsLayerContents;
 #else
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to