Diff
Modified: trunk/Source/Platform/ChangeLog (120022 => 120023)
--- trunk/Source/Platform/ChangeLog 2012-06-12 00:32:10 UTC (rev 120022)
+++ trunk/Source/Platform/ChangeLog 2012-06-12 00:39:18 UTC (rev 120023)
@@ -1,3 +1,21 @@
+2012-06-11 James Robinson <[email protected]>
+
+ [chromium] Port DrawingBufferChromium from TextureLayerChromium over to WebExternalTextureLayer
+ https://bugs.webkit.org/show_bug.cgi?id=86273
+
+ Reviewed by Adrienne Walker.
+
+ * Platform.gypi:
+ * chromium/public/WebExternalTextureLayer.h:
+ (WebKit):
+ (WebExternalTextureLayer):
+ * chromium/public/WebExternalTextureLayerClient.h: Copied from Source/WebKit/chromium/src/WebExternalTextureLayer.cpp.
+ (WebKit):
+ (WebTextureUpdater):
+ (WebKit::WebTextureUpdater::~WebTextureUpdater):
+ (WebExternalTextureLayerClient):
+ (WebKit::WebExternalTextureLayerClient::~WebExternalTextureLayerClient):
+
2012-06-11 Dana Jansens <[email protected]>
[chromium] Separate CCVideoDrawQuad and from the layer tree and video provider by removing ManagedTexture and WebVideoFrame pointers from the quad
Modified: trunk/Source/Platform/Platform.gypi (120022 => 120023)
--- trunk/Source/Platform/Platform.gypi 2012-06-12 00:32:10 UTC (rev 120022)
+++ trunk/Source/Platform/Platform.gypi 2012-06-12 00:39:18 UTC (rev 120023)
@@ -48,6 +48,7 @@
'chromium/public/WebData.h',
'chromium/public/WebDragData.h',
'chromium/public/WebExternalTextureLayer.h',
+ 'chromium/public/WebExternalTextureLayerClient.h',
'chromium/public/WebFileInfo.h',
'chromium/public/WebFileSystem.h',
'chromium/public/WebFileUtilities.h',
Modified: trunk/Source/Platform/chromium/public/WebExternalTextureLayer.h (120022 => 120023)
--- trunk/Source/Platform/chromium/public/WebExternalTextureLayer.h 2012-06-12 00:32:10 UTC (rev 120022)
+++ trunk/Source/Platform/chromium/public/WebExternalTextureLayer.h 2012-06-12 00:39:18 UTC (rev 120023)
@@ -36,6 +36,8 @@
namespace WebKit {
+class WebExternalTextureLayerClient;
+
// This class represents a layer that renders a texture that is generated
// externally (not managed by the WebLayerTreeView).
// The texture will be used by the WebLayerTreeView during compositing passes.
@@ -44,8 +46,15 @@
// the WebLayerTreeView is destroyed.
class WebExternalTextureLayer : public WebLayer {
public:
- WEBKIT_EXPORT static WebExternalTextureLayer create();
+ // The owner of this layer may optionally provide a client. This client will
+ // be called whenever the compositor wishes to produce a new frame and can
+ // provide a new front buffer texture ID. This is useful if the client wants to
+ // implement a double-buffering scheme that is synchronized with the compositor, for instance.
+ WEBKIT_EXPORT static WebExternalTextureLayer create(WebExternalTextureLayerClient* = 0);
+ // Indicates that the client for this layer is going away and shouldn't be used.
+ WEBKIT_EXPORT void clearClient();
+
WebExternalTextureLayer() { }
virtual ~WebExternalTextureLayer() { }
@@ -61,6 +70,12 @@
// bounds.
WEBKIT_EXPORT void setUVRect(const WebFloatRect&);
+ // Sets whether every pixel in this layer is opaque. Defaults to false.
+ WEBKIT_EXPORT void setOpaque(bool);
+
+ // Sets whether this layer's texture has premultiplied alpha or not. Defaults to true.
+ WEBKIT_EXPORT void setPremultipliedAlpha(bool);
+
private:
#if WEBKIT_IMPLEMENTATION
explicit WebExternalTextureLayer(PassRefPtr<WebCore::TextureLayerChromium>);
Copied: trunk/Source/Platform/chromium/public/WebExternalTextureLayerClient.h (from rev 120022, trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp) (0 => 120023)
--- trunk/Source/Platform/chromium/public/WebExternalTextureLayerClient.h (rev 0)
+++ trunk/Source/Platform/chromium/public/WebExternalTextureLayerClient.h 2012-06-12 00:39:18 UTC (rev 120023)
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+#ifndef WebExternalTextureLayerClient_h
+#define WebExternalTextureLayerClient_h
+
+#include "WebCommon.h"
+#include "WebSize.h"
+
+namespace WebKit {
+
+class WebGraphicsContext3D;
+
+class WebTextureUpdater {
+public:
+ virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize) = 0;
+
+protected:
+ virtual ~WebTextureUpdater() { }
+};
+
+class WebExternalTextureLayerClient {
+public:
+ virtual unsigned prepareTexture(WebTextureUpdater&) = 0;
+ virtual WebGraphicsContext3D* context() = 0;
+
+protected:
+ virtual ~WebExternalTextureLayerClient() { }
+};
+
+} // namespace WebKit
+
+#endif // WebExternalTextureLayerClient_h
Modified: trunk/Source/WebCore/ChangeLog (120022 => 120023)
--- trunk/Source/WebCore/ChangeLog 2012-06-12 00:32:10 UTC (rev 120022)
+++ trunk/Source/WebCore/ChangeLog 2012-06-12 00:39:18 UTC (rev 120023)
@@ -1,3 +1,28 @@
+2012-06-11 James Robinson <[email protected]>
+
+ [chromium] Port DrawingBufferChromium from TextureLayerChromium over to WebExternalTextureLayer
+ https://bugs.webkit.org/show_bug.cgi?id=86273
+
+ Reviewed by Adrienne Walker.
+
+ This converts more WebCore code over to using public APIs instead of internal compositor layer types.
+
+ Refactor only, no change in behavior thus no new tests.
+
+ * platform/graphics/chromium/DrawingBufferChromium.cpp:
+ (WebCore::DrawingBufferPrivate::DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::~DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::layer):
+ (DrawingBufferPrivate):
+ * platform/graphics/chromium/TextureLayerChromium.cpp:
+ (WebCore::TextureLayerChromium::~TextureLayerChromium):
+ (WebCore::TextureLayerChromium::setRateLimitContext):
+ (WebCore::TextureLayerChromium::setNeedsDisplayRect):
+ (WebCore::TextureLayerChromium::update):
+ * platform/graphics/chromium/TextureLayerChromium.h:
+ (WebKit):
+ (TextureLayerChromiumClient):
+
2012-06-11 Max Feil <[email protected]>
[BlackBerry] Seek calls are being unnecessarily delayed
Modified: trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp (120022 => 120023)
--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp 2012-06-12 00:32:10 UTC (rev 120022)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp 2012-06-12 00:39:18 UTC (rev 120023)
@@ -29,6 +29,7 @@
#include "GrContext.h"
#include "GraphicsContext3D.h"
+#include "GraphicsContext3DPrivate.h"
#include "LayerRendererChromium.h" // For GLC() macro.
#include "SkCanvas.h"
#include "SkDeferredCanvas.h"
@@ -138,9 +139,9 @@
return m_backBufferTexture;
}
-GraphicsContext3D* Canvas2DLayerBridge::context()
+WebKit::WebGraphicsContext3D* Canvas2DLayerBridge::context()
{
- return m_context.get();
+ return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_context.get());
}
LayerChromium* Canvas2DLayerBridge::layer() const
Modified: trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h (120022 => 120023)
--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h 2012-06-12 00:32:10 UTC (rev 120022)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h 2012-06-12 00:39:18 UTC (rev 120023)
@@ -35,6 +35,10 @@
class SkCanvas;
class SkDevice;
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
namespace WebCore {
class LayerChromium;
@@ -52,7 +56,7 @@
// TextureLayerChromiumClient implementation.
virtual unsigned prepareTexture(CCTextureUpdater&) OVERRIDE;
- virtual GraphicsContext3D* context() OVERRIDE;
+ virtual WebKit::WebGraphicsContext3D* context() OVERRIDE;
SkCanvas* skCanvas(SkDevice*);
LayerChromium* layer() const;
Modified: trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp (120022 => 120023)
--- trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp 2012-06-12 00:32:10 UTC (rev 120022)
+++ trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp 2012-06-12 00:39:18 UTC (rev 120023)
@@ -35,10 +35,13 @@
#include "CanvasRenderingContext.h"
#include "Extensions3DChromium.h"
#include "GraphicsContext3D.h"
-#include "TextureLayerChromium.h"
+#include "GraphicsContext3DPrivate.h"
#include "cc/CCProxy.h"
#include "cc/CCTextureUpdater.h"
#include <algorithm>
+#include <public/WebExternalTextureLayer.h>
+#include <public/WebExternalTextureLayerClient.h>
+#include <public/WebGraphicsContext3D.h>
using namespace std;
@@ -149,29 +152,29 @@
}
#endif
-class DrawingBufferPrivate : public TextureLayerChromiumClient {
+class DrawingBufferPrivate : public WebKit::WebExternalTextureLayerClient {
WTF_MAKE_NONCOPYABLE(DrawingBufferPrivate);
public:
explicit DrawingBufferPrivate(DrawingBuffer* drawingBuffer)
: m_drawingBuffer(drawingBuffer)
- , m_layer(TextureLayerChromium::create(this))
+ , m_layer(WebKit::WebExternalTextureLayer::create(this))
{
GraphicsContext3D::Attributes attributes = m_drawingBuffer->graphicsContext3D()->getContextAttributes();
- m_layer->setOpaque(!attributes.alpha);
- m_layer->setPremultipliedAlpha(attributes.premultipliedAlpha);
+ m_layer.setOpaque(!attributes.alpha);
+ m_layer.setPremultipliedAlpha(attributes.premultipliedAlpha);
}
virtual ~DrawingBufferPrivate()
{
- m_layer->clearClient();
+ m_layer.clearClient();
}
- virtual unsigned prepareTexture(CCTextureUpdater& updater) OVERRIDE
+ virtual unsigned prepareTexture(WebKit::WebTextureUpdater& updater) OVERRIDE
{
m_drawingBuffer->prepareBackBuffer();
- context()->flush();
- context()->markLayerComposited();
+ m_drawingBuffer->graphicsContext3D()->flush();
+ m_drawingBuffer->graphicsContext3D()->markLayerComposited();
unsigned textureId = m_drawingBuffer->frontColorBuffer();
if (m_drawingBuffer->requiresCopyFromBackToFrontBuffer())
@@ -180,16 +183,16 @@
return textureId;
}
- virtual GraphicsContext3D* context() OVERRIDE
+ virtual WebKit::WebGraphicsContext3D* context() OVERRIDE
{
- return m_drawingBuffer->graphicsContext3D();
+ return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_drawingBuffer->graphicsContext3D());
}
- LayerChromium* layer() const { return m_layer.get(); }
+ LayerChromium* layer() const { return m_layer.unwrap<LayerChromium>(); }
private:
DrawingBuffer* m_drawingBuffer;
- RefPtr<TextureLayerChromium> m_layer;
+ WebKit::WebExternalTextureLayer m_layer;
};
#if USE(ACCELERATED_COMPOSITING)
Modified: trunk/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.cpp (120022 => 120023)
--- trunk/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.cpp 2012-06-12 00:32:10 UTC (rev 120022)
+++ trunk/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.cpp 2012-06-12 00:39:18 UTC (rev 120023)
@@ -33,6 +33,7 @@
#include "GraphicsContext3DPrivate.h"
#include "cc/CCLayerTreeHost.h"
#include "cc/CCTextureLayerImpl.h"
+#include <public/WebGraphicsContext3D.h>
namespace WebCore {
@@ -59,7 +60,7 @@
if (m_textureId)
layerTreeHost()->acquireLayerTextures();
if (m_rateLimitContext && m_client)
- layerTreeHost()->stopRateLimiter(GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_client->context()));
+ layerTreeHost()->stopRateLimiter(m_client->context());
}
}
@@ -89,7 +90,7 @@
void TextureLayerChromium::setRateLimitContext(bool rateLimit)
{
if (!rateLimit && m_rateLimitContext && m_client && layerTreeHost())
- layerTreeHost()->stopRateLimiter(GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_client->context()));
+ layerTreeHost()->stopRateLimiter(m_client->context());
m_rateLimitContext = rateLimit;
}
@@ -115,7 +116,7 @@
LayerChromium::setNeedsDisplayRect(dirtyRect);
if (m_rateLimitContext && m_client && layerTreeHost())
- layerTreeHost()->startRateLimiter(GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_client->context()));
+ layerTreeHost()->startRateLimiter(m_client->context());
}
void TextureLayerChromium::setLayerTreeHost(CCLayerTreeHost* host)
@@ -134,7 +135,7 @@
{
if (m_client) {
m_textureId = m_client->prepareTexture(updater);
- m_contextLost = m_client->context()->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR;
+ m_contextLost = m_client->context()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR;
}
m_needsDisplay = false;
Modified: trunk/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.h (120022 => 120023)
--- trunk/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.h 2012-06-12 00:32:10 UTC (rev 120022)
+++ trunk/Source/WebCore/platform/graphics/chromium/TextureLayerChromium.h 2012-06-12 00:39:18 UTC (rev 120023)
@@ -31,6 +31,10 @@
#include "LayerChromium.h"
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
namespace WebCore {
class TextureLayerChromiumClient {
@@ -41,7 +45,7 @@
virtual unsigned prepareTexture(CCTextureUpdater&) = 0;
// Returns the context that is providing the texture. Used for rate limiting and detecting lost context.
- virtual GraphicsContext3D* context() = 0;
+ virtual WebKit::WebGraphicsContext3D* context() = 0;
protected:
virtual ~TextureLayerChromiumClient() { }
Modified: trunk/Source/WebKit/chromium/ChangeLog (120022 => 120023)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-06-12 00:32:10 UTC (rev 120022)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-06-12 00:39:18 UTC (rev 120023)
@@ -1,3 +1,21 @@
+2012-05-11 James Robinson <[email protected]>
+
+ [chromium] Port DrawingBufferChromium from TextureLayerChromium over to WebExternalTextureLayer
+ https://bugs.webkit.org/show_bug.cgi?id=86273
+
+ Reviewed by Adrienne Walker.
+
+ * src/WebExternalTextureLayer.cpp:
+ (WebTextureUpdaterImpl):
+ (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl):
+ (WebKit):
+ (WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayer::create):
+ (WebKit::WebExternalTextureLayer::clearClient):
+ (WebKit::WebExternalTextureLayer::setOpaque):
+ (WebKit::WebExternalTextureLayer::setPremultipliedAlpha):
+
2012-06-11 Dana Jansens <[email protected]>
[chromium] Separate CCVideoDrawQuad and from the layer tree and video provider by removing ManagedTexture and WebVideoFrame pointers from the quad
Modified: trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp (120022 => 120023)
--- trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp 2012-06-12 00:32:10 UTC (rev 120022)
+++ trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp 2012-06-12 00:39:18 UTC (rev 120023)
@@ -27,6 +27,8 @@
#include <public/WebExternalTextureLayer.h>
#include "TextureLayerChromium.h"
+#include "cc/CCTextureUpdater.h"
+#include <public/WebExternalTextureLayerClient.h>
#include <public/WebFloatRect.h>
#include <public/WebSize.h>
@@ -34,13 +36,57 @@
namespace WebKit {
-WebExternalTextureLayer WebExternalTextureLayer::create()
+class WebTextureUpdaterImpl : public WebTextureUpdater {
+public:
+ explicit WebTextureUpdaterImpl(CCTextureUpdater& updater)
+ : m_updater(updater)
+ {
+ }
+
+ virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE
+ {
+ m_updater.appendCopy(sourceTexture, destinationTexture, size);
+ }
+
+private:
+ CCTextureUpdater& m_updater;
+};
+
+class WebExternalTextureLayerImpl : public TextureLayerChromiumClient, public TextureLayerChromium {
+public:
+ explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client)
+ : TextureLayerChromium(client ? this : 0)
+ , m_client(client)
+ {
+ }
+
+ virtual unsigned prepareTexture(CCTextureUpdater& updater) OVERRIDE
+ {
+ WebTextureUpdaterImpl updaterImpl(updater);
+ return m_client->prepareTexture(updaterImpl);
+ }
+
+ virtual WebKit::WebGraphicsContext3D* context() OVERRIDE
+ {
+ return m_client->context();
+ }
+
+private:
+ WebExternalTextureLayerClient* m_client;
+};
+
+WebExternalTextureLayer WebExternalTextureLayer::create(WebExternalTextureLayerClient* client)
{
- RefPtr<TextureLayerChromium> layer = TextureLayerChromium::create(0);
+ RefPtr<TextureLayerChromium> layer = adoptRef(new WebExternalTextureLayerImpl(client));
layer->setIsDrawable(true);
return WebExternalTextureLayer(layer.release());
}
+void WebExternalTextureLayer::clearClient()
+{
+ unwrap<TextureLayerChromium>()->clearClient();
+}
+
void WebExternalTextureLayer::setTextureId(unsigned id)
{
unwrap<TextureLayerChromium>()->setTextureId(id);
@@ -56,6 +102,16 @@
unwrap<TextureLayerChromium>()->setUVRect(rect);
}
+void WebExternalTextureLayer::setOpaque(bool opaque)
+{
+ unwrap<TextureLayerChromium>()->setOpaque(opaque);
+}
+
+void WebExternalTextureLayer::setPremultipliedAlpha(bool premultipliedAlpha)
+{
+ unwrap<TextureLayerChromium>()->setPremultipliedAlpha(premultipliedAlpha);
+}
+
WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer)
: WebLayer(layer)
{