Title: [114335] trunk/Source
Revision
114335
Author
jam...@google.com
Date
2012-04-16 20:04:11 -0700 (Mon, 16 Apr 2012)

Log Message

[chromium] Expose WebVideoLayer to Platform API and port WebMediaPlayerClientImpl to using it
https://bugs.webkit.org/show_bug.cgi?id=83963

Reviewed by Adrienne Walker.

Source/Platform:

Adds a compositor layer type for video, WebVideoLayer, and a WebVideoProvider interface.

* Platform.gypi:
* chromium/public/WebContentLayer.h:
(WebContentLayer):
* chromium/public/WebLayer.h:
(WebLayer):
(WebKit::WebLayer::unwrap):
* chromium/public/WebVideoFrameProvider.h: Renamed from Source/WebCore/platform/graphics/chromium/VideoFrameProvider.h.
(WebKit):
(WebVideoFrameProvider):
(WebKit::WebVideoFrameProvider::~WebVideoFrameProvider):
(Client):
* chromium/public/WebVideoLayer.h: Copied from Source/WebKit/chromium/src/WebContentLayer.cpp.
(WebCore):
(WebKit):
(WebVideoLayer):
(WebKit::WebVideoLayer::WebVideoLayer):
(WebKit::WebVideoLayer::~WebVideoLayer):

Source/WebCore:

Converts VideoLayerChromium / CCVideoLayerImpl to use a Platform WebVideoFrameProvider interface instead of a
WebCore VideoFrameProvider.

* WebCore.gypi:
* platform/graphics/chromium/VideoLayerChromium.cpp:
(WebCore::VideoLayerChromium::create):
(WebCore::VideoLayerChromium::VideoLayerChromium):
* platform/graphics/chromium/VideoLayerChromium.h:
(WebKit):
(WebCore):
(VideoLayerChromium):
* platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
(WebCore::CCVideoLayerImpl::CCVideoLayerImpl):
* platform/graphics/chromium/cc/CCVideoLayerImpl.h:
(WebCore::CCVideoLayerImpl::create):
(CCVideoLayerImpl):

Source/WebKit/chromium:

Adds implementation of WebVideoLayer and ports WebMediaPlayerClientImpl over to using it.
WebMediaPlayerClientImpl still exposes a WebCore::VideoLayerChromium* to the compositor via the platformLayer()
interface, but this is temporary until we can change the PlatformLayer typedef over to WebLayer.

* WebKit.gyp:
* src/WebContentLayer.cpp:
* src/WebLayer.cpp:
(WebKit::WebLayer::invalidate):
(WebKit):
* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::readyStateChanged):
(WebKit::WebMediaPlayerClientImpl::repaint):
(WebKit::WebMediaPlayerClientImpl::setOpaque):
(WebKit::WebMediaPlayerClientImpl::platformLayer):
(WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):
(WebKit::WebMediaPlayerClientImpl::setVideoFrameProviderClient):
(WebKit::WebMediaPlayerClientImpl::supportsType):
* src/WebMediaPlayerClientImpl.h:
(WebMediaPlayerClientImpl):
* src/WebVideoLayer.cpp: Copied from Source/WebKit/chromium/src/WebContentLayer.cpp.
(WebKit):
(WebKit::WebVideoLayer::create):
(WebKit::WebVideoLayer::WebVideoLayer):
(WebKit::WebVideoLayer::active):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (114334 => 114335)


--- trunk/Source/Platform/ChangeLog	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/Platform/ChangeLog	2012-04-17 03:04:11 UTC (rev 114335)
@@ -1,3 +1,30 @@
+2012-04-13  James Robinson  <jam...@chromium.org>
+
+        [chromium] Expose WebVideoLayer to Platform API and port WebMediaPlayerClientImpl to using it
+        https://bugs.webkit.org/show_bug.cgi?id=83963
+
+        Reviewed by Adrienne Walker.
+
+        Adds a compositor layer type for video, WebVideoLayer, and a WebVideoProvider interface.
+
+        * Platform.gypi:
+        * chromium/public/WebContentLayer.h:
+        (WebContentLayer):
+        * chromium/public/WebLayer.h:
+        (WebLayer):
+        (WebKit::WebLayer::unwrap):
+        * chromium/public/WebVideoFrameProvider.h: Renamed from Source/WebCore/platform/graphics/chromium/VideoFrameProvider.h.
+        (WebKit):
+        (WebVideoFrameProvider):
+        (WebKit::WebVideoFrameProvider::~WebVideoFrameProvider):
+        (Client):
+        * chromium/public/WebVideoLayer.h: Copied from Source/WebKit/chromium/src/WebContentLayer.cpp.
+        (WebCore):
+        (WebKit):
+        (WebVideoLayer):
+        (WebKit::WebVideoLayer::WebVideoLayer):
+        (WebKit::WebVideoLayer::~WebVideoLayer):
+
 2012-04-11  James Robinson  <jam...@chromium.org>
 
         [chromium] Remove unused compositeToTexture / compositeOffscreen setting

Modified: trunk/Source/Platform/Platform.gypi (114334 => 114335)


--- trunk/Source/Platform/Platform.gypi	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/Platform/Platform.gypi	2012-04-17 03:04:11 UTC (rev 114335)
@@ -90,6 +90,8 @@
             'chromium/public/WebURLRequest.h',
             'chromium/public/WebURLResponse.h',
             'chromium/public/WebVector.h',
+            'chromium/public/WebVideoFrame.h',
+            'chromium/public/WebVideoFrameProvider.h',
             'chromium/src/Platform.cpp',
             'chromium/src/WebCString.cpp',
             'chromium/src/WebFloatQuad.cpp',

Modified: trunk/Source/Platform/chromium/public/WebContentLayer.h (114334 => 114335)


--- trunk/Source/Platform/chromium/public/WebContentLayer.h	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/Platform/chromium/public/WebContentLayer.h	2012-04-17 03:04:11 UTC (rev 114335)
@@ -56,9 +56,6 @@
     // WebContentLayerClient::paintContents before the compositing pass occurs.
     WEBKIT_EXPORT void invalidateRect(const WebFloatRect&);
 
-    // Sets the entire layer as invalid, i.e. needs to update its content.
-    WEBKIT_EXPORT void invalidate();
-
 #if WEBKIT_IMPLEMENTATION
     WebContentLayer(const WTF::PassRefPtr<WebContentLayerImpl>&);
     WebContentLayer& operator=(const WTF::PassRefPtr<WebContentLayerImpl>&);

Modified: trunk/Source/Platform/chromium/public/WebLayer.h (114334 => 114335)


--- trunk/Source/Platform/chromium/public/WebLayer.h	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/Platform/chromium/public/WebLayer.h	2012-04-17 03:04:11 UTC (rev 114335)
@@ -54,6 +54,9 @@
     WEBKIT_EXPORT void assign(const WebLayer&);
     WEBKIT_EXPORT bool equals(const WebLayer&) const;
 
+    // Sets the entire layer as invalid, i.e. needs to update its content.
+    WEBKIT_EXPORT void invalidate();
+
     WEBKIT_EXPORT WebLayer rootLayer() const;
     WEBKIT_EXPORT WebLayer parent() const;
     WEBKIT_EXPORT void addChild(const WebLayer&);
@@ -113,7 +116,7 @@
     WebLayer(const WTF::PassRefPtr<WebCore::LayerChromium>&);
     WebLayer& operator=(const WTF::PassRefPtr<WebCore::LayerChromium>&);
     operator WTF::PassRefPtr<WebCore::LayerChromium>() const;
-    template<typename T> T* unwrap()
+    template<typename T> T* unwrap() const
     {
         return static_cast<T*>(m_private.get());
     }

Copied: trunk/Source/Platform/chromium/public/WebVideoFrameProvider.h (from rev 114334, trunk/Source/WebCore/platform/graphics/chromium/VideoFrameProvider.h) (0 => 114335)


--- trunk/Source/Platform/chromium/public/WebVideoFrameProvider.h	                        (rev 0)
+++ trunk/Source/Platform/chromium/public/WebVideoFrameProvider.h	2012-04-17 03:04:11 UTC (rev 114335)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2010 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+#ifndef WebVideoFrameProvider_h
+#define WebVideoFrameProvider_h
+
+#include "WebCommon.h"
+#include "WebVideoFrame.h"
+
+namespace WebKit {
+
+// Threading notes: This class may be used in a multi threaded manner. Specifically, the implementation
+// may call getCurrentFrame() / putCurrentFrame() from a non-main thread. If so, the caller is responsible
+// for making sure Client::didReceiveFrame and Client::didUpdateMatrix are only called from this thread.
+class WebVideoFrameProvider {
+public:
+    virtual ~WebVideoFrameProvider() { }
+
+    class Client {
+    public:
+        // Provider will call this method to tell the client to stop using it.
+        // stopUsingProvider() may be called from any thread.
+        virtual void stopUsingProvider() = 0;
+
+        // Notifies the provider's client that a call to getCurrentFrame() will return new data.
+        virtual void didReceiveFrame() = 0;
+
+        // Notifies the provider's client of a new UV transform matrix to be used when drawing frames
+        // of type WebVideoFrame::FormatStreamTexture.
+        virtual void didUpdateMatrix(const float*) = 0;
+    };
+
+    // May be called from any thread.
+    virtual void setVideoFrameProviderClient(Client*) = 0;
+
+    // This function places a lock on the current frame and returns a pointer to it.
+    // Calls to this method should always be followed with a call to putCurrentFrame().
+    // The ownership of the object is not transferred to the caller and
+    // the caller should not free the returned object.
+    virtual WebVideoFrame* getCurrentFrame() = 0;
+    // This function releases the lock on the video frame in chromium. It should
+    // always be called after getCurrentFrame(). Frames passed into this method
+    // should no longer be referenced after the call is made.
+    virtual void putCurrentFrame(WebVideoFrame*) = 0;
+};
+
+} // namespace WebKit
+
+#endif

Property changes: trunk/Source/Platform/chromium/public/WebVideoFrameProvider.h


Added: svn:eol-style

Copied: trunk/Source/Platform/chromium/public/WebVideoLayer.h (from rev 114334, trunk/Source/WebKit/chromium/src/WebContentLayer.cpp) (0 => 114335)


--- trunk/Source/Platform/chromium/public/WebVideoLayer.h	                        (rev 0)
+++ trunk/Source/Platform/chromium/public/WebVideoLayer.h	2012-04-17 03:04:11 UTC (rev 114335)
@@ -0,0 +1,57 @@
+/*
+ * 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 WebVideoLayer_h
+#define WebVideoLayer_h
+
+#include "WebCommon.h"
+#include "WebLayer.h"
+
+namespace WebCore {
+class VideoLayerChromium;
+}
+
+namespace WebKit {
+
+class WebVideoFrameProvider;
+
+class WebVideoLayer : public WebLayer {
+public:
+    WEBKIT_EXPORT static WebVideoLayer create(WebVideoFrameProvider*);
+
+    WebVideoLayer() { }
+    virtual ~WebVideoLayer() { }
+
+    // Returns true if this layer is actively rendering (e.g. currently attached to a WebLayerTreeView).
+    WEBKIT_EXPORT bool active() const;
+
+#if WEBKIT_IMPLEMENTATION
+    explicit WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium>);
+#endif
+};
+
+} // namespace WebKit
+
+#endif // WebVideoLayer_h

Modified: trunk/Source/WebCore/ChangeLog (114334 => 114335)


--- trunk/Source/WebCore/ChangeLog	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebCore/ChangeLog	2012-04-17 03:04:11 UTC (rev 114335)
@@ -1,3 +1,27 @@
+2012-04-13  James Robinson  <jam...@chromium.org>
+
+        [chromium] Expose WebVideoLayer to Platform API and port WebMediaPlayerClientImpl to using it
+        https://bugs.webkit.org/show_bug.cgi?id=83963
+
+        Reviewed by Adrienne Walker.
+
+        Converts VideoLayerChromium / CCVideoLayerImpl to use a Platform WebVideoFrameProvider interface instead of a
+        WebCore VideoFrameProvider.
+
+        * WebCore.gypi:
+        * platform/graphics/chromium/VideoLayerChromium.cpp:
+        (WebCore::VideoLayerChromium::create):
+        (WebCore::VideoLayerChromium::VideoLayerChromium):
+        * platform/graphics/chromium/VideoLayerChromium.h:
+        (WebKit):
+        (WebCore):
+        (VideoLayerChromium):
+        * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
+        (WebCore::CCVideoLayerImpl::CCVideoLayerImpl):
+        * platform/graphics/chromium/cc/CCVideoLayerImpl.h:
+        (WebCore::CCVideoLayerImpl::create):
+        (CCVideoLayerImpl):
+
 2012-04-16  Takashi Sakamoto  <ta...@google.com>
 
         [Shadow DOM] InsertionPoint should have isActive() member function.

Modified: trunk/Source/WebCore/WebCore.gypi (114334 => 114335)


--- trunk/Source/WebCore/WebCore.gypi	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebCore/WebCore.gypi	2012-04-17 03:04:11 UTC (rev 114335)
@@ -3588,7 +3588,6 @@
             'platform/graphics/chromium/UniscribeHelperTextRun.h',
             'platform/graphics/chromium/VDMXParser.cpp',
             'platform/graphics/chromium/VDMXParser.h',
-            'platform/graphics/chromium/VideoFrameProvider.h',
             'platform/graphics/chromium/VideoLayerChromium.cpp',
             'platform/graphics/chromium/VideoLayerChromium.h',
             'platform/graphics/chromium/WebGLLayerChromium.cpp',

Deleted: trunk/Source/WebCore/platform/graphics/chromium/VideoFrameProvider.h (114334 => 114335)


--- trunk/Source/WebCore/platform/graphics/chromium/VideoFrameProvider.h	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebCore/platform/graphics/chromium/VideoFrameProvider.h	2012-04-17 03:04:11 UTC (rev 114335)
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2010 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:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * 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.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER 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.
- */
-
-#ifndef VideoFrameProvider_h
-#define VideoFrameProvider_h
-
-#include <public/WebVideoFrame.h>
-
-namespace WebCore {
-
-class VideoFrameProvider {
-public:
-    virtual ~VideoFrameProvider() { }
-
-    class Client {
-    public:
-        // Provider will call this method to tell the client to stop using it.
-        virtual void stopUsingProvider() = 0;
-        virtual void didReceiveFrame() = 0;
-        virtual void didUpdateMatrix(const float*) = 0;
-    };
-
-    virtual void setVideoFrameProviderClient(Client*) = 0;
-
-    // This function places a lock on the current frame and returns a pointer to it.
-    // Calls to this method should always be followed with a call to putCurrentFrame().
-    // The ownership of the object is not transferred to the caller and
-    // the caller should not free the returned object.
-    virtual WebKit::WebVideoFrame* getCurrentFrame() = 0;
-    // This function releases the lock on the video frame in chromium. It should
-    // always be called after getCurrentFrame(). Frames passed into this method
-    // should no longer be referenced after the call is made.
-    virtual void putCurrentFrame(WebKit::WebVideoFrame*) = 0;
-};
-
-} // namespace WebCore
-
-#endif

Modified: trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp (114334 => 114335)


--- trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp	2012-04-17 03:04:11 UTC (rev 114335)
@@ -36,12 +36,12 @@
 
 namespace WebCore {
 
-PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(VideoFrameProvider* provider)
+PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(WebKit::WebVideoFrameProvider* provider)
 {
     return adoptRef(new VideoLayerChromium(provider));
 }
 
-VideoLayerChromium::VideoLayerChromium(VideoFrameProvider* provider)
+VideoLayerChromium::VideoLayerChromium(WebKit::WebVideoFrameProvider* provider)
     : LayerChromium()
     , m_provider(provider)
 {

Modified: trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h (114334 => 114335)


--- trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h	2012-04-17 03:04:11 UTC (rev 114335)
@@ -36,25 +36,28 @@
 
 #include "LayerChromium.h"
 
+namespace WebKit {
+class WebVideoFrameProvider;
+}
+
 namespace WebCore {
 
 class CCVideoLayerImpl;
-class VideoFrameProvider;
 
 // A Layer that contains a Video element.
 class VideoLayerChromium : public LayerChromium {
 public:
 
-    static PassRefPtr<VideoLayerChromium> create(VideoFrameProvider* = 0);
+    static PassRefPtr<VideoLayerChromium> create(WebKit::WebVideoFrameProvider*);
     virtual ~VideoLayerChromium();
 
     virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
 
 private:
-    explicit VideoLayerChromium(VideoFrameProvider*);
+    explicit VideoLayerChromium(WebKit::WebVideoFrameProvider*);
 
     // This pointer is only for passing to CCVideoLayerImpl's constructor. It should never be dereferenced by this class.
-    VideoFrameProvider* m_provider;
+    WebKit::WebVideoFrameProvider* m_provider;
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp (114334 => 114335)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp	2012-04-17 03:04:11 UTC (rev 114335)
@@ -73,7 +73,7 @@
     0, 1, 0, 1,
 };
 
-CCVideoLayerImpl::CCVideoLayerImpl(int id, VideoFrameProvider* provider)
+CCVideoLayerImpl::CCVideoLayerImpl(int id, WebKit::WebVideoFrameProvider* provider)
     : CCLayerImpl(id)
     , m_provider(provider)
     , m_layerTreeHostImpl(0)

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h (114334 => 114335)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h	2012-04-17 03:04:11 UTC (rev 114335)
@@ -28,9 +28,9 @@
 
 #include "ManagedTexture.h"
 #include "ShaderChromium.h"
-#include "VideoFrameProvider.h"
 #include "VideoLayerChromium.h"
 #include "cc/CCLayerImpl.h"
+#include <public/WebVideoFrameProvider.h>
 
 namespace WebKit {
 class WebVideoFrame;
@@ -44,9 +44,9 @@
 template<class VertexShader, class FragmentShader> class ProgramBinding;
 
 class CCVideoLayerImpl : public CCLayerImpl
-                       , public VideoFrameProvider::Client {
+                       , public WebKit::WebVideoFrameProvider::Client {
 public:
-    static PassOwnPtr<CCVideoLayerImpl> create(int id, VideoFrameProvider* provider)
+    static PassOwnPtr<CCVideoLayerImpl> create(int id, WebKit::WebVideoFrameProvider* provider)
     {
         return adoptPtr(new CCVideoLayerImpl(id, provider));
     }
@@ -64,9 +64,8 @@
     virtual void dumpLayerProperties(TextStream&, int indent) const OVERRIDE;
 
     Mutex& providerMutex() { return m_providerMutex; }
-    VideoFrameProvider* provider() const { return m_provider; }
 
-    // VideoFrameProvider::Client implementation.
+    // WebKit::WebVideoFrameProvider::Client implementation.
     virtual void stopUsingProvider(); // Callable on any thread.
     virtual void didReceiveFrame(); // Callable on impl thread.
     virtual void didUpdateMatrix(const float*); // Callable on impl thread.
@@ -84,7 +83,7 @@
     enum { MaxPlanes = 3 };
 
 private:
-    explicit CCVideoLayerImpl(int, VideoFrameProvider*);
+    CCVideoLayerImpl(int, WebKit::WebVideoFrameProvider*);
 
     static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned plane);
     virtual const char* layerTypeAsString() const OVERRIDE { return "VideoLayer"; }
@@ -92,7 +91,7 @@
     bool reserveTextures(const WebKit::WebVideoFrame&, GC3Denum format, LayerRendererChromium*);
 
     Mutex m_providerMutex; // Guards m_provider below.
-    VideoFrameProvider* m_provider;
+    WebKit::WebVideoFrameProvider* m_provider;
 
     Texture m_textures[MaxPlanes];
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (114334 => 114335)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-04-17 03:04:11 UTC (rev 114335)
@@ -1,3 +1,35 @@
+2012-04-13  James Robinson  <jam...@chromium.org>
+
+        [chromium] Expose WebVideoLayer to Platform API and port WebMediaPlayerClientImpl to using it
+        https://bugs.webkit.org/show_bug.cgi?id=83963
+
+        Reviewed by Adrienne Walker.
+
+        Adds implementation of WebVideoLayer and ports WebMediaPlayerClientImpl over to using it.
+        WebMediaPlayerClientImpl still exposes a WebCore::VideoLayerChromium* to the compositor via the platformLayer()
+        interface, but this is temporary until we can change the PlatformLayer typedef over to WebLayer.
+
+        * WebKit.gyp:
+        * src/WebContentLayer.cpp:
+        * src/WebLayer.cpp:
+        (WebKit::WebLayer::invalidate):
+        (WebKit):
+        * src/WebMediaPlayerClientImpl.cpp:
+        (WebKit::WebMediaPlayerClientImpl::readyStateChanged):
+        (WebKit::WebMediaPlayerClientImpl::repaint):
+        (WebKit::WebMediaPlayerClientImpl::setOpaque):
+        (WebKit::WebMediaPlayerClientImpl::platformLayer):
+        (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):
+        (WebKit::WebMediaPlayerClientImpl::setVideoFrameProviderClient):
+        (WebKit::WebMediaPlayerClientImpl::supportsType):
+        * src/WebMediaPlayerClientImpl.h:
+        (WebMediaPlayerClientImpl):
+        * src/WebVideoLayer.cpp: Copied from Source/WebKit/chromium/src/WebContentLayer.cpp.
+        (WebKit):
+        (WebKit::WebVideoLayer::create):
+        (WebKit::WebVideoLayer::WebVideoLayer):
+        (WebKit::WebVideoLayer::active):
+
 2012-04-16  Aaron Colwell  <acolw...@chromium.org>
 
         Fix WebKit style violations in Chromium WebMediaPlayer.h & WebMediaPlayerClient.h

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (114334 => 114335)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2012-04-17 03:04:11 UTC (rev 114335)
@@ -663,6 +663,7 @@
                 'src/WebURLLoadTiming.cpp',
                 'src/WebScopedUserGesture.cpp',
                 'src/WebUserMediaRequest.cpp',
+                'src/WebVideoLayer.cpp',
                 'src/WebViewImpl.cpp',
                 'src/WebViewImpl.h',
                 'src/WebWorkerBase.cpp',

Modified: trunk/Source/WebKit/chromium/src/WebContentLayer.cpp (114334 => 114335)


--- trunk/Source/WebKit/chromium/src/WebContentLayer.cpp	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebKit/chromium/src/WebContentLayer.cpp	2012-04-17 03:04:11 UTC (rev 114335)
@@ -51,11 +51,6 @@
     unwrap<WebContentLayerImpl>()->setNeedsDisplayRect(dirtyRect);
 }
 
-void WebContentLayer::invalidate()
-{
-    unwrap<WebContentLayerImpl>()->setNeedsDisplay();
-}
-
 WebContentLayer::WebContentLayer(const PassRefPtr<WebContentLayerImpl>& node)
     : WebLayer(node)
 {

Modified: trunk/Source/WebKit/chromium/src/WebLayer.cpp (114334 => 114335)


--- trunk/Source/WebKit/chromium/src/WebLayer.cpp	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebKit/chromium/src/WebLayer.cpp	2012-04-17 03:04:11 UTC (rev 114335)
@@ -94,6 +94,11 @@
     return (m_private.get() == n.m_private.get());
 }
 
+void WebLayer::invalidate()
+{
+    m_private->setNeedsDisplay();
+}
+
 WebLayer WebLayer::rootLayer() const
 {
     return WebLayer(const_cast<LayerChromium*>(m_private->rootLayer()));

Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (114334 => 114335)


--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp	2012-04-17 03:04:11 UTC (rev 114335)
@@ -109,9 +109,9 @@
     ASSERT(m_mediaPlayer);
     m_mediaPlayer->readyStateChanged();
 #if USE(ACCELERATED_COMPOSITING)
-    if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) {
-        m_videoLayer = VideoLayerChromium::create(this);
-        m_videoLayer->setOpaque(m_opaque);
+    if (hasVideo() && supportsAcceleratedRendering() && m_videoLayer.isNull()) {
+        m_videoLayer = WebVideoLayer::create(this);
+        m_videoLayer.setOpaque(m_opaque);
     }
 #endif
 }
@@ -138,8 +138,8 @@
 {
     ASSERT(m_mediaPlayer);
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_videoLayer && supportsAcceleratedRendering())
-        m_videoLayer->setNeedsDisplay();
+    if (!m_videoLayer.isNull() && supportsAcceleratedRendering())
+        m_videoLayer.invalidate();
 #endif
     m_mediaPlayer->repaint();
 }
@@ -166,8 +166,8 @@
 {
 #if USE(ACCELERATED_COMPOSITING)
     m_opaque = opaque;
-    if (m_videoLayer)
-        m_videoLayer->setOpaque(m_opaque);
+    if (!m_videoLayer.isNull())
+        m_videoLayer.setOpaque(m_opaque);
 #endif
 }
 
@@ -315,7 +315,7 @@
 PlatformLayer* WebMediaPlayerClientImpl::platformLayer() const
 {
     ASSERT(m_supportsAcceleratedCompositing);
-    return m_videoLayer.get();
+    return m_videoLayer.unwrap<VideoLayerChromium>();
 }
 #endif
 
@@ -650,10 +650,10 @@
 
 bool WebMediaPlayerClientImpl::acceleratedRenderingInUse()
 {
-    return m_videoLayer && m_videoLayer->layerTreeHost();
+    return !m_videoLayer.isNull() && m_videoLayer.active();
 }
 
-void WebMediaPlayerClientImpl::setVideoFrameProviderClient(VideoFrameProvider::Client* client)
+void WebMediaPlayerClientImpl::setVideoFrameProviderClient(WebVideoFrameProvider::Client* client)
 {
     MutexLocker locker(m_compositingMutex);
     m_videoFrameProviderClient = client;
@@ -764,7 +764,6 @@
     , m_delayingLoad(false)
     , m_preload(MediaPlayer::MetaData)
 #if USE(ACCELERATED_COMPOSITING)
-    , m_videoLayer(0)
     , m_supportsAcceleratedCompositing(false)
     , m_opaque(false)
     , m_videoFrameProviderClient(0)

Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h (114334 => 114335)


--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h	2012-04-17 02:55:40 UTC (rev 114334)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h	2012-04-17 03:04:11 UTC (rev 114335)
@@ -35,11 +35,11 @@
 
 #include "AudioSourceProvider.h"
 #include "MediaPlayerPrivate.h"
-#include "VideoFrameProvider.h"
-#include "VideoLayerChromium.h"
 #include "WebAudioSourceProviderClient.h"
 #include "WebMediaPlayerClient.h"
 #include "WebStreamTextureClient.h"
+#include <public/WebVideoFrameProvider.h>
+#include <public/WebVideoLayer.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 
@@ -54,7 +54,7 @@
 // WebKit::WebMediaPlayer.
 class WebMediaPlayerClientImpl : public WebCore::MediaPlayerPrivateInterface
 #if USE(ACCELERATED_COMPOSITING)
-                               , public WebCore::VideoFrameProvider
+                               , public WebVideoFrameProvider
 #endif
                                , public WebMediaPlayerClient
                                , public WebStreamTextureClient {
@@ -142,8 +142,8 @@
 #if USE(ACCELERATED_COMPOSITING)
     virtual bool supportsAcceleratedRendering() const;
 
-    // VideoFrameProvider methods:
-    virtual void setVideoFrameProviderClient(VideoFrameProvider::Client*);
+    // WebVideoFrameProvider methods:
+    virtual void setVideoFrameProviderClient(WebVideoFrameProvider::Client*);
     virtual WebVideoFrame* getCurrentFrame();
     virtual void putCurrentFrame(WebVideoFrame*);
 #endif
@@ -189,10 +189,10 @@
     bool m_delayingLoad;
     WebCore::MediaPlayer::Preload m_preload;
 #if USE(ACCELERATED_COMPOSITING)
-    RefPtr<WebCore::VideoLayerChromium> m_videoLayer;
+    WebVideoLayer m_videoLayer;
     bool m_supportsAcceleratedCompositing;
     bool m_opaque;
-    VideoFrameProvider::Client* m_videoFrameProviderClient;
+    WebVideoFrameProvider::Client* m_videoFrameProviderClient;
 #endif
     static bool m_isEnabled;
 

Copied: trunk/Source/WebKit/chromium/src/WebVideoLayer.cpp (from rev 114334, trunk/Source/WebKit/chromium/src/WebContentLayer.cpp) (0 => 114335)


--- trunk/Source/WebKit/chromium/src/WebVideoLayer.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebVideoLayer.cpp	2012-04-17 03:04:11 UTC (rev 114335)
@@ -0,0 +1,47 @@
+/*
+ * 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 "VideoLayerChromium.h"
+#include <public/WebVideoLayer.h>
+
+namespace WebKit {
+
+WebVideoLayer WebVideoLayer::create(WebVideoFrameProvider* provider)
+{
+    return WebVideoLayer(WebCore::VideoLayerChromium::create(provider));
+}
+
+WebVideoLayer::WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium> layer)
+    : WebLayer(layer)
+{
+}
+
+bool WebVideoLayer::active() const
+{
+    return m_private->layerTreeHost();
+}
+
+} // namespace WebKit
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to