[chromium] Convert WebPluginContainerImpl over to use WebExternalTextureLayer
authorjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Apr 2012 02:48:16 +0000 (02:48 +0000)
committerjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Apr 2012 02:48:16 +0000 (02:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=84120

Reviewed by Adrienne Walker.

Source/Platform:

This adds support for IO surface backed WebExternalTextureLayer, used by CoreAnimation plugins on OS X and moves
some functionality used by multiple WebLayer subclasses up to the base class.

* chromium/public/WebContentLayer.h:
(WebContentLayer):
* chromium/public/WebExternalTextureLayer.h:
(WebCore):
(WebExternalTextureLayer):
* chromium/public/WebLayer.h:
(WebKit):
(WebLayer):
(WebKit::WebLayer::unwrap):

Source/WebCore:

This renames PluginLayerChromium -> TextureLayerChromium since it is now used only as the implementation of
WebExternalTextureLayer and cleans it up slightly.

* WebCore.gypi:
* platform/graphics/chromium/TextureLayerChromium.cpp: Renamed from Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp.
(WebCore):
(WebCore::TextureLayerChromium::create):
(WebCore::TextureLayerChromium::TextureLayerChromium):
(WebCore::TextureLayerChromium::createCCLayerImpl):
(WebCore::TextureLayerChromium::drawsContent):
(WebCore::TextureLayerChromium::setTextureId):
(WebCore::TextureLayerChromium::setFlipped):
(WebCore::TextureLayerChromium::setUVRect):
(WebCore::TextureLayerChromium::setIOSurfaceProperties):
(WebCore::TextureLayerChromium::pushPropertiesTo):
* platform/graphics/chromium/TextureLayerChromium.h: Renamed from Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h.
(WebCore):
(TextureLayerChromium):
(WebCore::TextureLayerChromium::flipped):
(WebCore::TextureLayerChromium::uvRect):

Source/WebKit/chromium:

This ports WebPluginContainerImpl over to use WebExternalTextureLayer instead of directly using a *LayerChromium
type for better layering and code sharing. The changes to WebPluginContainerImpl are fairly straightforward.  In
addition to renames I also moved some state tracking into WPCI instead of having it exposed on the interface. I
also removed the WebExternalTextureLayerImpl intermediate class since it wasn't doing anything useful.

* WebKit.gyp:
* WebKit.gypi:
* src/WebContentLayer.cpp:
* src/WebExternalTextureLayer.cpp:
(WebKit::WebExternalTextureLayer::create):
(WebKit::WebExternalTextureLayer::setTextureId):
(WebKit::WebExternalTextureLayer::setIOSurfaceProperties):
(WebKit::WebExternalTextureLayer::setFlipped):
(WebKit::WebExternalTextureLayer::flipped):
(WebKit::WebExternalTextureLayer::setUVRect):
(WebKit::WebExternalTextureLayer::uvRect):
(WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
* src/WebExternalTextureLayerImpl.cpp: Removed.
* src/WebExternalTextureLayerImpl.h: Removed.
* src/WebLayer.cpp:
(WebKit::WebLayer::invalidateRect):
(WebKit):
(WebKit::WebLayer::invalidate):
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::setBackingTextureId):
(WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
(WebKit::WebPluginContainerImpl::commitBackingTexture):
(WebKit::WebPluginContainerImpl::setOpaque):
(WebKit::WebPluginContainerImpl::platformLayer):
(WebKit::WebPluginContainerImpl::WebPluginContainerImpl):
* src/WebPluginContainerImpl.h:
(WebCore):
(WebPluginContainerImpl):
* tests/WebExternalTextureLayerImplTest.cpp: Removed.
* tests/WebLayerTest.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114604 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
Source/Platform/ChangeLog
Source/Platform/chromium/public/WebContentLayer.h
Source/Platform/chromium/public/WebExternalTextureLayer.h
Source/Platform/chromium/public/WebLayer.h
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/platform/graphics/chromium/TextureLayerChromium.cpp [moved from Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp with 76% similarity]
Source/WebCore/platform/graphics/chromium/TextureLayerChromium.h [moved from Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h with 87% similarity]
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gyp
Source/WebKit/chromium/WebKit.gypi
Source/WebKit/chromium/src/WebContentLayer.cpp
Source/WebKit/chromium/src/WebExternalTextureLayer.cpp
Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp [deleted file]
Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h [deleted file]
Source/WebKit/chromium/src/WebLayer.cpp
Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
Source/WebKit/chromium/src/WebPluginContainerImpl.h
Source/WebKit/chromium/tests/WebExternalTextureLayerImplTest.cpp [deleted file]
Source/WebKit/chromium/tests/WebLayerTest.cpp

index 1085c3554ff7f72f87f0b7e826cb8663b983dba5..7f933728171302b229f53d360a30187ccd8552bf 100644 (file)
@@ -1,3 +1,23 @@
+2012-04-16  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Convert WebPluginContainerImpl over to use WebExternalTextureLayer
+        https://bugs.webkit.org/show_bug.cgi?id=84120
+
+        Reviewed by Adrienne Walker.
+
+        This adds support for IO surface backed WebExternalTextureLayer, used by CoreAnimation plugins on OS X and moves
+        some functionality used by multiple WebLayer subclasses up to the base class.
+
+        * chromium/public/WebContentLayer.h:
+        (WebContentLayer):
+        * chromium/public/WebExternalTextureLayer.h:
+        (WebCore):
+        (WebExternalTextureLayer):
+        * chromium/public/WebLayer.h:
+        (WebKit):
+        (WebLayer):
+        (WebKit::WebLayer::unwrap):
+
 2012-04-17  Dana Jansens  <danakj@chromium.org>
 
         [chromium] Fix gyp for WebFilterOperation.h and WebFilterOperations.h
index d5c915d852b2d74b98115131e560669b3d82e172..699418c349be96539a8ca7f76a15cc3535a41eca 100644 (file)
@@ -51,11 +51,6 @@ public:
     WEBKIT_EXPORT void setDrawsContent(bool);
     WEBKIT_EXPORT bool drawsContent() const;
 
-    // Sets a region of the layer as invalid, i.e. needs to update its content.
-    // The visible area of the dirty rect will be passed to one or more calls to
-    // WebContentLayerClient::paintContents before the compositing pass occurs.
-    WEBKIT_EXPORT void invalidateRect(const WebFloatRect&);
-
 #if WEBKIT_IMPLEMENTATION
     WebContentLayer(const WTF::PassRefPtr<WebContentLayerImpl>&);
     WebContentLayer& operator=(const WTF::PassRefPtr<WebContentLayerImpl>&);
index ce87bb23876252ce15d593641bc344b246212de8..52efbb7eb38206b31f7e7fe8ebc757dc56f614a8 100644 (file)
 #include "WebFloatRect.h"
 #include "WebLayer.h"
 
+namespace WebCore {
+class TextureLayerChromium;
+}
+
 namespace WebKit {
-class WebExternalTextureLayerImpl;
 
 // This class represents a layer that renders a texture that is generated
 // externally (not managed by the WebLayerTreeView).
@@ -44,18 +47,15 @@ public:
     WEBKIT_EXPORT static WebExternalTextureLayer create();
 
     WebExternalTextureLayer() { }
-    WebExternalTextureLayer(const WebExternalTextureLayer& layer) : WebLayer(layer) { }
     virtual ~WebExternalTextureLayer() { }
-    WebExternalTextureLayer& operator=(const WebExternalTextureLayer& layer)
-    {
-        WebLayer::assign(layer);
-        return *this;
-    }
 
     // Sets the texture id that represents the layer, in the namespace of the
     // compositor context.
     WEBKIT_EXPORT void setTextureId(unsigned);
-    WEBKIT_EXPORT unsigned textureId() const;
+
+    // Sets the IO surface id that represents this layer. setTextureId() and setIOSurfaceProperties() are mutually
+    // exclusive - a layer can be either backed by a texture or an IO surface, but not both.
+    WEBKIT_EXPORT void setIOSurfaceProperties(const WebSize&, unsigned ioSurfaceId);
 
     // Sets whether or not the texture should be flipped in the Y direction when
     // rendered.
@@ -67,14 +67,9 @@ public:
     WEBKIT_EXPORT void setUVRect(const WebFloatRect&);
     WEBKIT_EXPORT WebFloatRect uvRect() const;
 
-    // Marks a region of the layer as needing a display. These regions are
-    // collected in a union until the display occurs.
-    WEBKIT_EXPORT void invalidateRect(const WebFloatRect&);
-
+private:
 #if WEBKIT_IMPLEMENTATION
-    WebExternalTextureLayer(const WTF::PassRefPtr<WebExternalTextureLayerImpl>&);
-    WebExternalTextureLayer& operator=(const WTF::PassRefPtr<WebExternalTextureLayerImpl>&);
-    operator WTF::PassRefPtr<WebExternalTextureLayerImpl>() const;
+    explicit WebExternalTextureLayer(PassRefPtr<WebCore::TextureLayerChromium>);
 #endif
 };
 
index da974fa04107d3bb3ebe22209be96d2d16df3e18..47497de5794780d62b29a4372219bdf5118db7a1 100644 (file)
@@ -36,6 +36,7 @@ namespace WebCore { class LayerChromium; }
 namespace WebKit {
 class WebFilterOperations;
 struct WebFloatPoint;
+struct WebFloatRect;
 struct WebSize;
 
 class WebLayer {
@@ -55,6 +56,9 @@ public:
     WEBKIT_EXPORT void assign(const WebLayer&);
     WEBKIT_EXPORT bool equals(const WebLayer&) const;
 
+    // Sets a region of the layer as invalid, i.e. needs to update its content.
+    WEBKIT_EXPORT void invalidateRect(const WebFloatRect&);
+
     // Sets the entire layer as invalid, i.e. needs to update its content.
     WEBKIT_EXPORT void invalidate();
 
index 835b248082eeb0e3c113480510938557248db960..4774de4631a85eaf7442b915611ee67ff769696b 100644 (file)
@@ -1,3 +1,31 @@
+2012-04-16  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Convert WebPluginContainerImpl over to use WebExternalTextureLayer
+        https://bugs.webkit.org/show_bug.cgi?id=84120
+
+        Reviewed by Adrienne Walker.
+
+        This renames PluginLayerChromium -> TextureLayerChromium since it is now used only as the implementation of
+        WebExternalTextureLayer and cleans it up slightly.
+
+        * WebCore.gypi:
+        * platform/graphics/chromium/TextureLayerChromium.cpp: Renamed from Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp.
+        (WebCore):
+        (WebCore::TextureLayerChromium::create):
+        (WebCore::TextureLayerChromium::TextureLayerChromium):
+        (WebCore::TextureLayerChromium::createCCLayerImpl):
+        (WebCore::TextureLayerChromium::drawsContent):
+        (WebCore::TextureLayerChromium::setTextureId):
+        (WebCore::TextureLayerChromium::setFlipped):
+        (WebCore::TextureLayerChromium::setUVRect):
+        (WebCore::TextureLayerChromium::setIOSurfaceProperties):
+        (WebCore::TextureLayerChromium::pushPropertiesTo):
+        * platform/graphics/chromium/TextureLayerChromium.h: Renamed from Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h.
+        (WebCore):
+        (TextureLayerChromium):
+        (WebCore::TextureLayerChromium::flipped):
+        (WebCore::TextureLayerChromium::uvRect):
+
 2012-04-18  Raymond Toy  <rtoy@google.com>
 
         Expose attack, release as DynamicsCompressorNode's attributes.
index 49a721c070bbb096c7babc5466d7ad3ed039263e..6556e800aa23212352bace0d38afd223d3411eb5 100644 (file)
             'platform/graphics/chromium/PlatformIcon.h',
             'platform/graphics/chromium/PlatformImage.cpp',
             'platform/graphics/chromium/PlatformImage.h',
-            'platform/graphics/chromium/PluginLayerChromium.cpp',
-            'platform/graphics/chromium/PluginLayerChromium.h',
+            'platform/graphics/chromium/TextureLayerChromium.cpp',
+            'platform/graphics/chromium/TextureLayerChromium.h',
             'platform/graphics/chromium/ProgramBinding.cpp',
             'platform/graphics/chromium/ProgramBinding.h',
             'platform/graphics/chromium/RateLimiter.cpp',
similarity index 76%
rename from Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp
rename to Source/WebCore/platform/graphics/chromium/TextureLayerChromium.cpp
index 8a99ab0478f2c5d8649052dfea0cb2b2515b430e..29cc6ba0b124c0fceeaaa03c6c05edca936dbf05 100644 (file)
 
 #if USE(ACCELERATED_COMPOSITING)
 
-#include "PluginLayerChromium.h"
+#include "TextureLayerChromium.h"
 
 #include "cc/CCTextureLayerImpl.h"
 
 namespace WebCore {
 
-PassRefPtr<PluginLayerChromium> PluginLayerChromium::create()
+PassRefPtr<TextureLayerChromium> TextureLayerChromium::create()
 {
-    return adoptRef(new PluginLayerChromium);
+    return adoptRef(new TextureLayerChromium);
 }
 
-PluginLayerChromium::PluginLayerChromium()
+TextureLayerChromium::TextureLayerChromium()
     : LayerChromium()
     , m_textureId(0)
     , m_flipped(true)
@@ -47,42 +47,42 @@ PluginLayerChromium::PluginLayerChromium()
 {
 }
 
-PassOwnPtr<CCLayerImpl> PluginLayerChromium::createCCLayerImpl()
+PassOwnPtr<CCLayerImpl> TextureLayerChromium::createCCLayerImpl()
 {
     return CCTextureLayerImpl::create(m_layerId);
 }
 
-void PluginLayerChromium::setTextureId(unsigned id)
+bool TextureLayerChromium::drawsContent() const
+{
+    return (m_textureId || m_ioSurfaceId) && LayerChromium::drawsContent();
+}
+
+void TextureLayerChromium::setTextureId(unsigned id)
 {
     m_textureId = id;
     setNeedsCommit();
 }
 
-void PluginLayerChromium::setFlipped(bool flipped)
+void TextureLayerChromium::setFlipped(bool flipped)
 {
     m_flipped = flipped;
     setNeedsCommit();
 }
 
-void PluginLayerChromium::setUVRect(const FloatRect& rect)
+void TextureLayerChromium::setUVRect(const FloatRect& rect)
 {
     m_uvRect = rect;
     setNeedsCommit();
 }
 
-void PluginLayerChromium::setIOSurfaceProperties(int width, int height, uint32_t ioSurfaceId)
+void TextureLayerChromium::setIOSurfaceProperties(int width, int height, uint32_t ioSurfaceId)
 {
     m_ioSurfaceSize = IntSize(width, height);
     m_ioSurfaceId = ioSurfaceId;
     setNeedsCommit();
 }
 
-uint32_t PluginLayerChromium::getIOSurfaceId() const
-{
-    return m_ioSurfaceId;
-}
-
-void PluginLayerChromium::pushPropertiesTo(CCLayerImpl* layer)
+void TextureLayerChromium::pushPropertiesTo(CCLayerImpl* layer)
 {
     LayerChromium::pushPropertiesTo(layer);
 
similarity index 87%
rename from Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h
rename to Source/WebCore/platform/graphics/chromium/TextureLayerChromium.h
index 26b58d3118a4f3fcbd11f800bbe247303f0b73fb..7a9109248151b4d11018c7e86709f39aac51c559 100644 (file)
@@ -24,8 +24,8 @@
  */
 
 
-#ifndef PluginLayerChromium_h
-#define PluginLayerChromium_h
+#ifndef TextureLayerChromium_h
+#define TextureLayerChromium_h
 
 #if USE(ACCELERATED_COMPOSITING)
 
 namespace WebCore {
 
 // A Layer containing a the rendered output of a plugin instance.
-class PluginLayerChromium : public LayerChromium {
+class TextureLayerChromium : public LayerChromium {
 public:
-    static PassRefPtr<PluginLayerChromium> create();
+    static PassRefPtr<TextureLayerChromium> create();
 
     virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
 
+    virtual bool drawsContent() const OVERRIDE;
+
     // Code path for plugins which supply their own texture ID.
-    void setTextureId(unsigned textureId);
-    unsigned textureId() const { return m_textureId; }
+    void setTextureId(unsigned);
     void setFlipped(bool);
     bool flipped() const { return m_flipped; }
     void setUVRect(const FloatRect&);
@@ -50,12 +51,11 @@ public:
 
     // Code path for plugins which render via an IOSurface.
     void setIOSurfaceProperties(int width, int height, uint32_t ioSurfaceId);
-    uint32_t getIOSurfaceId() const;
 
     virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
 
 protected:
-    PluginLayerChromium();
+    TextureLayerChromium();
 
 private:
     unsigned m_textureId;
index 1ed1535c3d962189d49ed582dee11355261d253f..c8774abc35521820530643980223c7eb419169b7 100644 (file)
@@ -1,3 +1,46 @@
+2012-04-16  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Convert WebPluginContainerImpl over to use WebExternalTextureLayer
+        https://bugs.webkit.org/show_bug.cgi?id=84120
+
+        Reviewed by Adrienne Walker.
+
+        This ports WebPluginContainerImpl over to use WebExternalTextureLayer instead of directly using a *LayerChromium
+        type for better layering and code sharing. The changes to WebPluginContainerImpl are fairly straightforward.  In
+        addition to renames I also moved some state tracking into WPCI instead of having it exposed on the interface. I
+        also removed the WebExternalTextureLayerImpl intermediate class since it wasn't doing anything useful.
+
+        * WebKit.gyp:
+        * WebKit.gypi:
+        * src/WebContentLayer.cpp:
+        * src/WebExternalTextureLayer.cpp:
+        (WebKit::WebExternalTextureLayer::create):
+        (WebKit::WebExternalTextureLayer::setTextureId):
+        (WebKit::WebExternalTextureLayer::setIOSurfaceProperties):
+        (WebKit::WebExternalTextureLayer::setFlipped):
+        (WebKit::WebExternalTextureLayer::flipped):
+        (WebKit::WebExternalTextureLayer::setUVRect):
+        (WebKit::WebExternalTextureLayer::uvRect):
+        (WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
+        * src/WebExternalTextureLayerImpl.cpp: Removed.
+        * src/WebExternalTextureLayerImpl.h: Removed.
+        * src/WebLayer.cpp:
+        (WebKit::WebLayer::invalidateRect):
+        (WebKit):
+        (WebKit::WebLayer::invalidate):
+        * src/WebPluginContainerImpl.cpp:
+        (WebKit::WebPluginContainerImpl::setBackingTextureId):
+        (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
+        (WebKit::WebPluginContainerImpl::commitBackingTexture):
+        (WebKit::WebPluginContainerImpl::setOpaque):
+        (WebKit::WebPluginContainerImpl::platformLayer):
+        (WebKit::WebPluginContainerImpl::WebPluginContainerImpl):
+        * src/WebPluginContainerImpl.h:
+        (WebCore):
+        (WebPluginContainerImpl):
+        * tests/WebExternalTextureLayerImplTest.cpp: Removed.
+        * tests/WebLayerTest.cpp:
+
 2012-04-18  Dana Jansens  <danakj@chromium.org>
 
         [chromium] Simplify occlusion tracker API by passing layer iterator data
index 23de69083df9b63e094ab5b7dfbaac8b06176800..43752f35afecb2dd4408487efa172a35b9b3a7f7 100644 (file)
                 'src/WebEntities.cpp',
                 'src/WebEntities.h',
                 'src/WebExternalTextureLayer.cpp',
-                'src/WebExternalTextureLayerImpl.cpp',
-                'src/WebExternalTextureLayerImpl.h',
                 'src/WebFileChooserCompletionImpl.cpp',
                 'src/WebFileChooserCompletionImpl.h',
                 'src/WebFileSystemCallbacksImpl.cpp',
index 9abc1f8e4a4db7fe60043ad18e700d5d717ff2b9..9548b2a0f65db199392a8bfe55a9f97d0e7267f4 100644 (file)
             'tests/TreeTestHelpers.cpp',
             'tests/TreeTestHelpers.h',
             'tests/WebCompositorInputHandlerImplTest.cpp',
-            'tests/WebExternalTextureLayerImplTest.cpp',
             'tests/WebFrameTest.cpp',
             'tests/WebGLLayerChromiumTest.cpp',
             'tests/WebLayerTest.cpp',
index d8a5d307e0792521eddd27ad2362bde2d7c05786..5290e2f35ab12b8a75622000fa19330a8936d943 100644 (file)
@@ -46,11 +46,6 @@ bool WebContentLayer::drawsContent() const
     return constUnwrap<WebContentLayerImpl>()->drawsContent();
 }
 
-void WebContentLayer::invalidateRect(const WebFloatRect& dirtyRect)
-{
-    unwrap<WebContentLayerImpl>()->setNeedsDisplayRect(dirtyRect);
-}
-
 WebContentLayer::WebContentLayer(const PassRefPtr<WebContentLayerImpl>& node)
     : WebLayer(node)
 {
index c9ba0bc7b928d168f285b9fb7c33dad3238f1659..2620026bfb7f183542f5c782a0d7490b30cdac6d 100644 (file)
  */
 
 #include "config.h"
-#include "platform/WebExternalTextureLayer.h"
+#include <public/WebExternalTextureLayer.h>
 
-#include "platform/WebFloatRect.h"
-#include "WebExternalTextureLayerImpl.h"
+#include "TextureLayerChromium.h"
+#include <public/WebFloatRect.h>
+#include <public/WebSize.h>
+
+using namespace WebCore;
 
 namespace WebKit {
 
 WebExternalTextureLayer WebExternalTextureLayer::create()
 {
-    return WebExternalTextureLayer(WebExternalTextureLayerImpl::create());
+    RefPtr<TextureLayerChromium> layer = TextureLayerChromium::create();
+    layer->setIsDrawable(true);
+    return WebExternalTextureLayer(layer.release());
 }
 
 void WebExternalTextureLayer::setTextureId(unsigned id)
 {
-    unwrap<WebExternalTextureLayerImpl>()->setTextureId(id);
+    unwrap<TextureLayerChromium>()->setTextureId(id);
 }
 
-unsigned WebExternalTextureLayer::textureId() const
+void WebExternalTextureLayer::setIOSurfaceProperties(const WebSize& size, unsigned ioSurfaceId)
 {
-    return constUnwrap<WebExternalTextureLayerImpl>()->textureId();
+    unwrap<TextureLayerChromium>()->setIOSurfaceProperties(size.width, size.height, ioSurfaceId);
 }
 
 void WebExternalTextureLayer::setFlipped(bool flipped)
 {
-    unwrap<WebExternalTextureLayerImpl>()->setFlipped(flipped);
+    unwrap<TextureLayerChromium>()->setFlipped(flipped);
 }
 
 bool WebExternalTextureLayer::flipped() const
 {
-    return constUnwrap<WebExternalTextureLayerImpl>()->flipped();
+    return constUnwrap<TextureLayerChromium>()->flipped();
 }
 
 void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect)
 {
-    unwrap<WebExternalTextureLayerImpl>()->setUVRect(rect);
+    unwrap<TextureLayerChromium>()->setUVRect(rect);
 }
 
 WebFloatRect WebExternalTextureLayer::uvRect() const
 {
-    return WebFloatRect(constUnwrap<WebExternalTextureLayerImpl>()->uvRect());
-}
-
-void WebExternalTextureLayer::invalidateRect(const WebFloatRect& updateRect)
-{
-    unwrap<WebExternalTextureLayerImpl>()->setNeedsDisplayRect(updateRect);
-}
-
-WebExternalTextureLayer::WebExternalTextureLayer(const PassRefPtr<WebExternalTextureLayerImpl>& node)
-    : WebLayer(node)
-{
-}
-
-WebExternalTextureLayer& WebExternalTextureLayer::operator=(const PassRefPtr<WebExternalTextureLayerImpl>& node)
-{
-    m_private = node;
-    return *this;
+    return WebFloatRect(constUnwrap<TextureLayerChromium>()->uvRect());
 }
 
-WebExternalTextureLayer::operator PassRefPtr<WebExternalTextureLayerImpl>() const
+WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer)
+    : WebLayer(layer)
 {
-    return static_cast<WebExternalTextureLayerImpl*>(m_private.get());
 }
 
 } // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp
deleted file mode 100644 (file)
index ec6c290..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2011 Google 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 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 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.
- */
-
-#include "config.h"
-#include "WebExternalTextureLayerImpl.h"
-
-#include "GraphicsContext.h"
-#include "platform/WebCanvas.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-PassRefPtr<WebExternalTextureLayerImpl> WebExternalTextureLayerImpl::create()
-{
-    return adoptRef(new WebExternalTextureLayerImpl());
-}
-
-WebExternalTextureLayerImpl::WebExternalTextureLayerImpl()
-    : PluginLayerChromium()
-{
-    setFlipped(false);
-    setIsDrawable(true);
-}
-
-WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl()
-{
-}
-
-bool WebExternalTextureLayerImpl::drawsContent() const
-{
-    return !!textureId() && LayerChromium::drawsContent();
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h
deleted file mode 100644 (file)
index 7b73e70..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2011 Google 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 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 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.
- */
-
-#ifndef WebExternalTextureLayerImpl_h
-#define WebExternalTextureLayerImpl_h
-
-#include "PluginLayerChromium.h"
-#include <wtf/PassRefPtr.h>
-
-namespace WebKit {
-
-class WebExternalTextureLayerImpl : public WebCore::PluginLayerChromium {
-public:
-    static PassRefPtr<WebExternalTextureLayerImpl> create();
-
-protected:
-    WebExternalTextureLayerImpl();
-    virtual ~WebExternalTextureLayerImpl();
-    virtual bool drawsContent() const;
-};
-
-} // namespace WebKit
-
-#endif // WebExternalTextureLayerImpl_h
index f77e3732652826e31c4fe3c0302975fdc2964530..7ce075393503e71c5cadd86c4447a6877de1a237 100644 (file)
 #include "SkMatrix44.h"
 #include "TransformationMatrix.h"
 #include "WebLayerImpl.h"
-#include "platform/WebFloatPoint.h"
-#include "platform/WebSize.h"
+
+#include <public/WebFloatPoint.h>
+#include <public/WebFloatRect.h>
+#include <public/WebSize.h>
 
 #include <public/WebFilterOperations.h>
 
@@ -96,6 +98,11 @@ bool WebLayer::equals(const WebLayer& n) const
     return (m_private.get() == n.m_private.get());
 }
 
+void WebLayer::invalidateRect(const WebFloatRect& dirtyRect)
+{
+    m_private->setNeedsDisplayRect(dirtyRect);
+}
+
 void WebLayer::invalidate()
 {
     m_private->setNeedsDisplay();
index f69ae5c935fb957f0aa7e0248ab360036435f70e..8a99e470b56d78a36cb9f18f7162a0e0a7308595 100644 (file)
@@ -33,7 +33,6 @@
 
 #include "Chrome.h"
 #include "ChromeClientImpl.h"
-#include "PluginLayerChromium.h"
 #include "ScrollbarGroup.h"
 #include "platform/WebClipboard.h"
 #include "WebCursorInfo.h"
@@ -334,19 +333,21 @@ void WebPluginContainerImpl::reportGeometry()
     }
 }
 
-void WebPluginContainerImpl::setBackingTextureId(unsigned id)
+void WebPluginContainerImpl::setBackingTextureId(unsigned textureId)
 {
 #if USE(ACCELERATED_COMPOSITING)
-    unsigned currId = m_platformLayer->textureId();
-    if (currId == id)
+    if (m_textureId == textureId)
         return;
 
-    m_platformLayer->setTextureId(id);
+    m_layer.setTextureId(textureId);
+
     // If anyone of the IDs is zero we need to switch between hardware
     // and software compositing. This is done by triggering a style recalc
     // on the container element.
-    if (!(currId * id))
+    if (!m_textureId || !textureId)
         m_element->setNeedsStyleRecalc(WebCore::SyntheticStyleChange);
+
+    m_textureId = textureId;
 #endif
 }
 
@@ -355,25 +356,26 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width,
                                                    uint32_t ioSurfaceId)
 {
 #if OS(DARWIN) && USE(ACCELERATED_COMPOSITING)
-    uint32_t currentId = m_platformLayer->getIOSurfaceId();
-    if (ioSurfaceId == currentId)
+    if (ioSurfaceId == m_ioSurfaceId)
         return;
 
-    m_platformLayer->setIOSurfaceProperties(width, height, ioSurfaceId);
+    m_layer.setIOSurfaceProperties(WebRect(width, height), ioSurfaceId);
 
     // If anyone of the IDs is zero we need to switch between hardware
     // and software compositing. This is done by triggering a style recalc
     // on the container element.
-    if (!(ioSurfaceId * currentId))
+    if (!ioSurfaceId || !m_ioSurfaceId)
         m_element->setNeedsStyleRecalc(WebCore::SyntheticStyleChange);
+
+    m_ioSurfaceId = ioSurfaceId;
 #endif
 }
 
 void WebPluginContainerImpl::commitBackingTexture()
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_platformLayer)
-        m_platformLayer->setNeedsDisplay();
+    if (!m_layer.isNull())
+        m_layer.invalidate();
 #endif
 }
 
@@ -440,8 +442,8 @@ void WebPluginContainerImpl::zoomLevelChanged(double zoomLevel)
 void WebPluginContainerImpl::setOpaque(bool opaque)
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_platformLayer)
-        m_platformLayer->setOpaque(opaque);
+    if (!m_layer.isNull())
+        m_layer.setOpaque(opaque);
 #endif
 }
 
@@ -516,7 +518,7 @@ void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver
 #if USE(ACCELERATED_COMPOSITING)
 WebCore::LayerChromium* WebPluginContainerImpl::platformLayer() const
 {
-    return (m_platformLayer->textureId() || m_platformLayer->getIOSurfaceId()) ? m_platformLayer.get() : 0;
+    return (m_textureId || m_ioSurfaceId) ? m_layer.unwrap<LayerChromium>() : 0;
 }
 #endif
 
@@ -556,7 +558,9 @@ WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* eleme
     , m_element(element)
     , m_webPlugin(webPlugin)
 #if USE(ACCELERATED_COMPOSITING)
-    , m_platformLayer(PluginLayerChromium::create())
+    , m_layer(WebExternalTextureLayer::create())
+    , m_textureId(0)
+    , m_ioSurfaceId(0)
 #endif
 {
 }
index 9d970f2f8ddb07f80a801f2a3a183a89535e7d94..e7d2a652d5f46f35ddc07e518f2058e708a91144 100644 (file)
@@ -35,6 +35,7 @@
 #include "WebPluginContainer.h"
 #include "Widget.h"
 
+#include <public/WebExternalTextureLayer.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/Vector.h>
@@ -48,7 +49,6 @@ class IntRect;
 class KeyboardEvent;
 class LayerChromium;
 class MouseEvent;
-class PluginLayerChromium;
 class ResourceError;
 class ResourceResponse;
 class WheelEvent;
@@ -173,7 +173,9 @@ private:
     Vector<WebPluginLoadObserver*> m_pluginLoadObservers;
 
 #if USE(ACCELERATED_COMPOSITING)
-    RefPtr<WebCore::PluginLayerChromium> m_platformLayer;
+    WebExternalTextureLayer m_layer;
+    unsigned m_textureId;
+    unsigned m_ioSurfaceId;
 #endif
 
     // The associated scrollbar group object, created lazily. Used for Pepper
diff --git a/Source/WebKit/chromium/tests/WebExternalTextureLayerImplTest.cpp b/Source/WebKit/chromium/tests/WebExternalTextureLayerImplTest.cpp
deleted file mode 100644 (file)
index 583d0df..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2012 Google 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 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 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.
- */
-
-#include "config.h"
-
-#include "WebExternalTextureLayerImpl.h"
-
-#include <gtest/gtest.h>
-#include <wtf/RefPtr.h>
-
-namespace {
-
-using namespace WebKit;
-using WTF::RefPtr;
-
-class WebExternalTextureLayerImplTest : public WebExternalTextureLayerImpl {
-public:
-    bool isDrawable() const { return drawsContent(); }
-};
-
-TEST(WebExternalTextureLayerImpl, testIsDrawable)
-{
-    RefPtr<WebExternalTextureLayerImplTest> textureLayer = adoptRef(new WebExternalTextureLayerImplTest());
-
-    textureLayer->setTextureId(1);
-    EXPECT_TRUE(textureLayer->isDrawable());
-}
-
-}
index aac8fb17b168e5d7d216e5ccbd1aed2f4406e115..2b6cba562c24e3426486de703974c0ebd96ce8e7 100644 (file)
@@ -160,7 +160,6 @@ TEST_F(WebLayerTest, Client)
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     textureLayer.setTextureId(3);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_EQ(3u, textureLayer.textureId());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     textureLayer.setFlipped(true);