[chromium] Put compositor client interfaces in separate headers, normalize naming
authorjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Aug 2012 20:40:39 +0000 (20:40 +0000)
committerjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Aug 2012 20:40:39 +0000 (20:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95522

Reviewed by Adam Barth.

Source/WebCore:

Client interfaces should be in their own headers so code implementing these interfaces do not have to
transitively #include all of the compositor internals.

We call things 'clients' not 'delegates' in the compositor.

* WebCore.gypi:
* platform/graphics/chromium/ContentLayerChromium.cpp:
(WebCore::ContentLayerPainter::ContentLayerPainter):
(WebCore::ContentLayerPainter::create):
(WebCore::ContentLayerPainter::paint):
(WebCore::ContentLayerChromium::create):
(WebCore::ContentLayerChromium::ContentLayerChromium):
(WebCore::ContentLayerChromium::drawsContent):
(WebCore::ContentLayerChromium::createTextureUpdaterIfNeeded):
* platform/graphics/chromium/ContentLayerChromium.h:
(WebCore):
(ContentLayerPainter):
(ContentLayerChromium):
(WebCore::ContentLayerChromium::clearClient):
* platform/graphics/chromium/TextureLayerChromium.cpp:
* platform/graphics/chromium/TextureLayerChromium.h:
(WebCore):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(WebCore):

Source/WebKit/chromium:

* src/WebContentLayerImpl.cpp:
(WebKit::WebContentLayerImpl::~WebContentLayerImpl):
* src/WebContentLayerImpl.h:
(WebContentLayerImpl):
* src/WebExternalTextureLayerImpl.h:
* src/WebLayerTreeViewImpl.h:
(WebCore):
* tests/CCLayerTreeHostCommonTest.cpp:
* tests/CCLayerTreeHostTest.cpp:
(WebKitTests::ContentLayerChromiumWithUpdateTracking::create):
(WebKitTests::ContentLayerChromiumWithUpdateTracking::ContentLayerChromiumWithUpdateTracking):
(WebKitTests::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers):
(WebKitTests::CCLayerTreeHostTestAtomicCommit::CCLayerTreeHostTestAtomicCommit):
(WebKitTests::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::CCLayerTreeHostTestAtomicCommitWithPartialUpdate):
(WebKitTests::CCLayerTreeHostTestLostContextWhileUpdatingResources::CCLayerTreeHostTestLostContextWhileUpdatingResources):
(CCLayerTreeHostTestLostContextWhileUpdatingResources):
* tests/ContentLayerChromiumTest.cpp:
(WebKit::MockContentLayerChromiumClient::MockContentLayerChromiumClient):
(WebKit::TEST):

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

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h
Source/WebCore/platform/graphics/chromium/ContentLayerChromiumClient.h [new file with mode: 0644]
Source/WebCore/platform/graphics/chromium/TextureLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/TextureLayerChromium.h
Source/WebCore/platform/graphics/chromium/TextureLayerChromiumClient.h [new file with mode: 0644]
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostClient.h [new file with mode: 0644]
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebContentLayerImpl.cpp
Source/WebKit/chromium/src/WebContentLayerImpl.h
Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h
Source/WebKit/chromium/src/WebLayerTreeViewImpl.h
Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp

index 381a64d..787accc 100644 (file)
@@ -1,3 +1,36 @@
+2012-08-30  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Put compositor client interfaces in separate headers, normalize naming
+        https://bugs.webkit.org/show_bug.cgi?id=95522
+
+        Reviewed by Adam Barth.
+
+        Client interfaces should be in their own headers so code implementing these interfaces do not have to
+        transitively #include all of the compositor internals.
+
+        We call things 'clients' not 'delegates' in the compositor.
+
+        * WebCore.gypi:
+        * platform/graphics/chromium/ContentLayerChromium.cpp:
+        (WebCore::ContentLayerPainter::ContentLayerPainter):
+        (WebCore::ContentLayerPainter::create):
+        (WebCore::ContentLayerPainter::paint):
+        (WebCore::ContentLayerChromium::create):
+        (WebCore::ContentLayerChromium::ContentLayerChromium):
+        (WebCore::ContentLayerChromium::drawsContent):
+        (WebCore::ContentLayerChromium::createTextureUpdaterIfNeeded):
+        * platform/graphics/chromium/ContentLayerChromium.h:
+        (WebCore):
+        (ContentLayerPainter):
+        (ContentLayerChromium):
+        (WebCore::ContentLayerChromium::clearClient):
+        * platform/graphics/chromium/TextureLayerChromium.cpp:
+        * platform/graphics/chromium/TextureLayerChromium.h:
+        (WebCore):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (WebCore):
+
 2012-08-31  Benjamin Poulain  <bpoulain@apple.com>
 
         Fix the Debug builds after r127277
index 032fdba..7337609 100644 (file)
             'platform/graphics/chromium/CanvasLayerTextureUpdater.h',
             'platform/graphics/chromium/ContentLayerChromium.cpp',
             'platform/graphics/chromium/ContentLayerChromium.h',
+            'platform/graphics/chromium/ContentLayerChromiumClient.h',
             'platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp',
             'platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h',
             'platform/graphics/chromium/GeometryBinding.cpp',
             'platform/graphics/chromium/TextureCopier.h',
             'platform/graphics/chromium/TextureLayerChromium.cpp',
             'platform/graphics/chromium/TextureLayerChromium.h',
+            'platform/graphics/chromium/TextureLayerChromiumClient.h',
             'platform/graphics/chromium/TextureUploader.h',
             'platform/graphics/chromium/ThrottledTextureUploader.cpp',
             'platform/graphics/chromium/ThrottledTextureUploader.h',
             'platform/graphics/chromium/cc/CCLayerTilingData.h',
             'platform/graphics/chromium/cc/CCLayerTreeHost.cpp',
             'platform/graphics/chromium/cc/CCLayerTreeHost.h',
+            'platform/graphics/chromium/cc/CCLayerTreeHostClient.h',
             'platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp',
             'platform/graphics/chromium/cc/CCLayerTreeHostCommon.h',
             'platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp',
index c2bf45e..d578117 100644 (file)
@@ -38,6 +38,7 @@
 #include "BitmapSkPictureCanvasLayerTextureUpdater.h"
 #include "CCLayerTreeHost.h"
 #include "CCSettings.h"
+#include "ContentLayerChromiumClient.h"
 #include "FrameBufferSkPictureCanvasLayerTextureUpdater.h"
 #include "LayerPainterChromium.h"
 #include <public/Platform.h>
 
 namespace WebCore {
 
-ContentLayerPainter::ContentLayerPainter(ContentLayerDelegate* delegate)
-    : m_delegate(delegate)
+ContentLayerPainter::ContentLayerPainter(ContentLayerChromiumClient* client)
+    : m_client(client)
 {
 }
 
-PassOwnPtr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerDelegate* delegate)
+PassOwnPtr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerChromiumClient* client)
 {
-    return adoptPtr(new ContentLayerPainter(delegate));
+    return adoptPtr(new ContentLayerPainter(client));
 }
 
 void ContentLayerPainter::paint(SkCanvas* canvas, const IntRect& contentRect, FloatRect& opaque)
 {
     double paintStart = currentTime();
-    m_delegate->paintContents(canvas, contentRect, opaque);
+    m_client->paintContents(canvas, contentRect, opaque);
     double paintEnd = currentTime();
     double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart);
     WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30);
     WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
 }
 
-PassRefPtr<ContentLayerChromium> ContentLayerChromium::create(ContentLayerDelegate* delegate)
+PassRefPtr<ContentLayerChromium> ContentLayerChromium::create(ContentLayerChromiumClient* client)
 {
-    return adoptRef(new ContentLayerChromium(delegate));
+    return adoptRef(new ContentLayerChromium(client));
 }
 
-ContentLayerChromium::ContentLayerChromium(ContentLayerDelegate* delegate)
+ContentLayerChromium::ContentLayerChromium(ContentLayerChromiumClient* client)
     : TiledLayerChromium()
-    , m_delegate(delegate)
+    , m_client(client)
 {
 }
 
@@ -82,7 +83,7 @@ ContentLayerChromium::~ContentLayerChromium()
 
 bool ContentLayerChromium::drawsContent() const
 {
-    return TiledLayerChromium::drawsContent() && m_delegate;
+    return TiledLayerChromium::drawsContent() && m_client;
 }
 
 void ContentLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc)
@@ -110,11 +111,11 @@ void ContentLayerChromium::createTextureUpdaterIfNeeded()
     if (m_textureUpdater)
         return;
     if (layerTreeHost()->settings().acceleratePainting)
-        m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate));
+        m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_client));
     else if (CCSettings::perTilePaintingEnabled())
-        m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate));
+        m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_client));
     else
-        m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate));
+        m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_client));
     m_textureUpdater->setOpaque(opaque());
 
     GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat;
index 6c068b3..7eb459c 100644 (file)
@@ -41,39 +41,32 @@ class SkCanvas;
 
 namespace WebCore {
 
+class ContentLayerChromiumClient;
 class FloatRect;
 class IntRect;
 class LayerTextureUpdater;
 
-class ContentLayerDelegate {
-public:
-    virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) = 0;
-
-protected:
-    virtual ~ContentLayerDelegate() { }
-};
-
 class ContentLayerPainter : public LayerPainterChromium {
     WTF_MAKE_NONCOPYABLE(ContentLayerPainter);
 public:
-    static PassOwnPtr<ContentLayerPainter> create(ContentLayerDelegate*);
+    static PassOwnPtr<ContentLayerPainter> create(ContentLayerChromiumClient*);
 
     virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) OVERRIDE;
 
 private:
-    explicit ContentLayerPainter(ContentLayerDelegate*);
+    explicit ContentLayerPainter(ContentLayerChromiumClient*);
 
-    ContentLayerDelegate* m_delegate;
+    ContentLayerChromiumClient* m_client;
 };
 
 // A layer that renders its contents into an SkCanvas.
 class ContentLayerChromium : public TiledLayerChromium {
 public:
-    static PassRefPtr<ContentLayerChromium> create(ContentLayerDelegate*);
+    static PassRefPtr<ContentLayerChromium> create(ContentLayerChromiumClient*);
 
     virtual ~ContentLayerChromium();
 
-    void clearDelegate() { m_delegate = 0; }
+    void clearClient() { m_client = 0; }
 
     virtual bool drawsContent() const OVERRIDE;
     virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
@@ -83,14 +76,14 @@ public:
     virtual void setOpaque(bool) OVERRIDE;
 
 protected:
-    explicit ContentLayerChromium(ContentLayerDelegate*);
+    explicit ContentLayerChromium(ContentLayerChromiumClient*);
 
 
 private:
     virtual LayerTextureUpdater* textureUpdater() const OVERRIDE { return m_textureUpdater.get(); }
     virtual void createTextureUpdaterIfNeeded() OVERRIDE;
 
-    ContentLayerDelegate* m_delegate;
+    ContentLayerChromiumClient* m_client;
     RefPtr<LayerTextureUpdater> m_textureUpdater;
 };
 
diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromiumClient.h b/Source/WebCore/platform/graphics/chromium/ContentLayerChromiumClient.h
new file mode 100644 (file)
index 0000000..d956a5d
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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 INC. 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 INC. 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 ContentLayerChromiumClient_h
+#define ContentLayerChromiumClient_h
+
+class SkCanvas;
+
+namespace WebCore {
+class FloatRect;
+class IntRect;
+
+class ContentLayerChromiumClient {
+public:
+    virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) = 0;
+
+protected:
+    virtual ~ContentLayerChromiumClient() { }
+};
+
+}
+
+#endif // ContentLayerChromiumClient_h
index d2f469e..34fd026 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "CCLayerTreeHost.h"
 #include "CCTextureLayerImpl.h"
+#include "TextureLayerChromiumClient.h"
 #include <public/WebGraphicsContext3D.h>
 
 namespace WebCore {
index 4b6721b..fd639f6 100644 (file)
@@ -23,7 +23,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-
 #ifndef TextureLayerChromium_h
 #define TextureLayerChromium_h
 
@@ -37,19 +36,7 @@ class WebGraphicsContext3D;
 
 namespace WebCore {
 
-class TextureLayerChromiumClient {
-public:
-    // Called to prepare this layer's texture for compositing. The client may queue a texture
-    // upload or copy on the CCTextureUpdateQueue.
-    // Returns the texture ID to be used for compositing.
-    virtual unsigned prepareTexture(CCTextureUpdateQueue&) = 0;
-
-    // Returns the context that is providing the texture. Used for rate limiting and detecting lost context.
-    virtual WebKit::WebGraphicsContext3D* context() = 0;
-
-protected:
-    virtual ~TextureLayerChromiumClient() { }
-};
+class TextureLayerChromiumClient;
 
 // A Layer containing a the rendered output of a plugin instance.
 class TextureLayerChromium : public LayerChromium {
diff --git a/Source/WebCore/platform/graphics/chromium/TextureLayerChromiumClient.h b/Source/WebCore/platform/graphics/chromium/TextureLayerChromiumClient.h
new file mode 100644 (file)
index 0000000..f32cf16
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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 TextureLayerChromiumClient_h
+#define TextureLayerChromiumClient_h
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace WebCore {
+class CCTextureUpdateQueue;
+
+class TextureLayerChromiumClient {
+public:
+    // Called to prepare this layer's texture for compositing. The client may queue a texture
+    // upload or copy on the CCTextureUpdateQueue.
+    // Returns the texture ID to be used for compositing.
+    virtual unsigned prepareTexture(CCTextureUpdateQueue&) = 0;
+
+    // Returns the context that is providing the texture. Used for rate limiting and detecting lost context.
+    virtual WebKit::WebGraphicsContext3D* context() = 0;
+
+protected:
+    virtual ~TextureLayerChromiumClient() { }
+};
+
+}
+
+#endif // TextureLayerChromiumClient_h
index 570d156..08474a1 100644 (file)
@@ -31,6 +31,7 @@
 #include "CCHeadsUpDisplayLayerImpl.h"
 #include "CCLayerAnimationController.h"
 #include "CCLayerIterator.h"
+#include "CCLayerTreeHostClient.h"
 #include "CCLayerTreeHostCommon.h"
 #include "CCLayerTreeHostImpl.h"
 #include "CCOcclusionTracker.h"
index 52302d3..742788c 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "CCAnimationEvents.h"
 #include "CCGraphicsContext.h"
+#include "CCLayerTreeHostClient.h"
 #include "CCLayerTreeHostCommon.h"
 #include "CCOcclusionTracker.h"
 #include "CCPrioritizedTextureManager.h"
@@ -53,28 +54,6 @@ class HeadsUpDisplayLayerChromium;
 class Region;
 struct CCScrollAndScaleSet;
 
-class CCLayerTreeHostClient {
-public:
-    virtual void willBeginFrame() = 0;
-    // Marks finishing compositing-related tasks on the main thread. In threaded mode, this corresponds to didCommit().
-    virtual void didBeginFrame() = 0;
-    virtual void animate(double frameBeginTime) = 0;
-    virtual void layout() = 0;
-    virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
-    virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface() = 0;
-    virtual void didRecreateOutputSurface(bool success) = 0;
-    virtual void willCommit() = 0;
-    virtual void didCommit() = 0;
-    virtual void didCommitAndDrawFrame() = 0;
-    virtual void didCompleteSwapBuffers() = 0;
-
-    // Used only in the single-threaded path.
-    virtual void scheduleComposite() = 0;
-
-protected:
-    virtual ~CCLayerTreeHostClient() { }
-};
-
 struct CCLayerTreeSettings {
     CCLayerTreeSettings()
             : acceleratePainting(false)
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostClient.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostClient.h
new file mode 100644 (file)
index 0000000..8d96679
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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 INC. 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 INC. 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 CCLayerTreeHostClient_h
+#define CCLayerTreeHostClient_h
+
+#include <wtf/PassOwnPtr.h>
+
+namespace WebKit {
+class WebCompositorOutputSurface;
+}
+
+namespace WebCore {
+class IntSize;
+
+class CCLayerTreeHostClient {
+public:
+    virtual void willBeginFrame() = 0;
+    // Marks finishing compositing-related tasks on the main thread. In threaded mode, this corresponds to didCommit().
+    virtual void didBeginFrame() = 0;
+    virtual void animate(double frameBeginTime) = 0;
+    virtual void layout() = 0;
+    virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
+    virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface() = 0;
+    virtual void didRecreateOutputSurface(bool success) = 0;
+    virtual void willCommit() = 0;
+    virtual void didCommit() = 0;
+    virtual void didCommitAndDrawFrame() = 0;
+    virtual void didCompleteSwapBuffers() = 0;
+
+    // Used only in the single-threaded path.
+    virtual void scheduleComposite() = 0;
+
+protected:
+    virtual ~CCLayerTreeHostClient() { }
+};
+
+}
+
+#endif // CCLayerTreeHostClient_h
index ecf6472..f23d462 100644 (file)
@@ -1,3 +1,30 @@
+2012-08-30  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Put compositor client interfaces in separate headers, normalize naming
+        https://bugs.webkit.org/show_bug.cgi?id=95522
+
+        Reviewed by Adam Barth.
+
+        * src/WebContentLayerImpl.cpp:
+        (WebKit::WebContentLayerImpl::~WebContentLayerImpl):
+        * src/WebContentLayerImpl.h:
+        (WebContentLayerImpl):
+        * src/WebExternalTextureLayerImpl.h:
+        * src/WebLayerTreeViewImpl.h:
+        (WebCore):
+        * tests/CCLayerTreeHostCommonTest.cpp:
+        * tests/CCLayerTreeHostTest.cpp:
+        (WebKitTests::ContentLayerChromiumWithUpdateTracking::create):
+        (WebKitTests::ContentLayerChromiumWithUpdateTracking::ContentLayerChromiumWithUpdateTracking):
+        (WebKitTests::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers):
+        (WebKitTests::CCLayerTreeHostTestAtomicCommit::CCLayerTreeHostTestAtomicCommit):
+        (WebKitTests::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::CCLayerTreeHostTestAtomicCommitWithPartialUpdate):
+        (WebKitTests::CCLayerTreeHostTestLostContextWhileUpdatingResources::CCLayerTreeHostTestLostContextWhileUpdatingResources):
+        (CCLayerTreeHostTestLostContextWhileUpdatingResources):
+        * tests/ContentLayerChromiumTest.cpp:
+        (WebKit::MockContentLayerChromiumClient::MockContentLayerChromiumClient):
+        (WebKit::TEST):
+
 2012-08-31  Gavin Peters  <gavinp@chromium.org>
 
         [chromium] DEPS roll with a test skip.
index fa21e89..70d1571 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "WebContentLayerImpl.h"
 
+#include "ContentLayerChromium.h"
 #include "SkMatrix44.h"
 #include <public/WebContentLayerClient.h>
 #include <public/WebFloatPoint.h>
@@ -51,7 +52,7 @@ WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client)
 
 WebContentLayerImpl::~WebContentLayerImpl()
 {
-    static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearDelegate();
+    static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearClient();
 }
 
 WebLayer* WebContentLayerImpl::layer()
index 511f8e0..78d30f9 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef WebContentLayerImpl_h
 #define WebContentLayerImpl_h
 
-#include "ContentLayerChromium.h"
+#include "ContentLayerChromiumClient.h"
 #include "WebLayerImpl.h"
 #include <public/WebContentLayer.h>
 #include <wtf/PassRefPtr.h>
@@ -35,7 +35,7 @@ namespace WebKit {
 class WebContentLayerClient;
 
 class WebContentLayerImpl : public WebContentLayer,
-                            public WebCore::ContentLayerDelegate {
+                            public WebCore::ContentLayerChromiumClient {
 public:
     explicit WebContentLayerImpl(WebContentLayerClient*);
 
@@ -49,7 +49,7 @@ public:
 protected:
     virtual ~WebContentLayerImpl();
 
-    // ContentLayerDelegate implementation.
+    // ContentLayerChromiumClient implementation.
     virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::FloatRect& opaque) OVERRIDE;
 
     OwnPtr<WebLayerImpl> m_webLayerImpl;
index 5348895..6c03c23 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef WebExternalTextureLayerImpl_h
 #define WebExternalTextureLayerImpl_h
 
-#include "TextureLayerChromium.h"
+#include "TextureLayerChromiumClient.h"
 #include <public/WebExternalTextureLayer.h>
 
 namespace WebKit {
index 71aded5..593962a 100644 (file)
 #ifndef WebLayerTreeViewImpl_h
 #define WebLayerTreeViewImpl_h
 
-#include "CCLayerTreeHost.h"
+#include "CCLayerTreeHostClient.h"
 #include <public/WebLayerTreeView.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 
+namespace WebCore {
+class CCLayerTreeHost;
+}
+
 namespace WebKit {
 class WebLayer;
 class WebLayerTreeViewClient;
index dbf28e4..f72884f 100644 (file)
@@ -36,6 +36,7 @@
 #include "CCSingleThreadProxy.h"
 #include "CCThread.h"
 #include "ContentLayerChromium.h"
+#include "ContentLayerChromiumClient.h"
 #include "LayerChromium.h"
 
 #include <gmock/gmock.h>
@@ -3380,14 +3381,14 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
     EXPECT_EQ(4, resultLayer->id());
 }
 
-class MockContentLayerDelegate : public ContentLayerDelegate {
+class MockContentLayerChromiumClient : public ContentLayerChromiumClient {
 public:
-    MockContentLayerDelegate() { }
-    virtual ~MockContentLayerDelegate() { }
+    MockContentLayerChromiumClient() { }
+    virtual ~MockContentLayerChromiumClient() { }
     virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) OVERRIDE { }
 };
 
-PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayerDelegate* delegate)
+PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayerChromiumClient* delegate)
 {
     RefPtr<ContentLayerChromium> toReturn = ContentLayerChromium::create(delegate);
     toReturn->setIsDrawable(true);
@@ -3397,7 +3398,7 @@ PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayer
 TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
 {
     // Verify draw and screen space transforms of layers not in a surface.
-    MockContentLayerDelegate delegate;
+    MockContentLayerChromiumClient delegate;
     WebTransformationMatrix identityMatrix;
 
     RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate);
@@ -3469,7 +3470,7 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
 
 TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
 {
-    MockContentLayerDelegate delegate;
+    MockContentLayerChromiumClient delegate;
     WebTransformationMatrix identityMatrix;
 
     RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate);
index 777d60f..36be5a5 100644 (file)
@@ -35,6 +35,7 @@
 #include "CCThreadedTest.h"
 #include "CCTimingFunction.h"
 #include "ContentLayerChromium.h"
+#include "ContentLayerChromiumClient.h"
 #include "Extensions3DChromium.h"
 #include "FakeWebCompositorOutputSurface.h"
 #include <gmock/gmock.h>
@@ -1189,7 +1190,7 @@ TEST_F(CCLayerTreeHostTestSetVisible, runMultiThread)
     runTest(true);
 }
 
-class TestOpacityChangeLayerDelegate : public ContentLayerDelegate {
+class TestOpacityChangeLayerDelegate : public ContentLayerChromiumClient {
 public:
     TestOpacityChangeLayerDelegate(CCLayerTreeHostTest* test)
         : m_test(test)
@@ -1208,7 +1209,7 @@ private:
 
 class ContentLayerChromiumWithUpdateTracking : public ContentLayerChromium {
 public:
-    static PassRefPtr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerDelegate *delegate) { return adoptRef(new ContentLayerChromiumWithUpdateTracking(delegate)); }
+    static PassRefPtr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerChromiumClient* client) { return adoptRef(new ContentLayerChromiumWithUpdateTracking(client)); }
 
     int paintContentsCount() { return m_paintContentsCount; }
     void resetPaintContentsCount() { m_paintContentsCount = 0; }
@@ -1220,8 +1221,8 @@ public:
     }
 
 private:
-    explicit ContentLayerChromiumWithUpdateTracking(ContentLayerDelegate* delegate)
-        : ContentLayerChromium(delegate)
+    explicit ContentLayerChromiumWithUpdateTracking(ContentLayerChromiumClient* client)
+        : ContentLayerChromium(client)
         , m_paintContentsCount(0)
     {
         setAnchorPoint(FloatPoint(0, 0));
@@ -1273,7 +1274,7 @@ TEST_F(CCLayerTreeHostTestOpacityChange, runMultiThread)
     runTest(true);
 }
 
-class MockContentLayerDelegate : public ContentLayerDelegate {
+class MockContentLayerChromiumClient : public ContentLayerChromiumClient {
 public:
     bool drawsContent() const { return true; }
     MOCK_CONST_METHOD0(preserves3D, bool());
@@ -1285,8 +1286,8 @@ class CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public CCLay
 public:
 
     CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers()
-        : m_rootLayer(ContentLayerChromium::create(&m_delegate))
-        , m_childLayer(ContentLayerChromium::create(&m_delegate))
+        : m_rootLayer(ContentLayerChromium::create(&m_client))
+        , m_childLayer(ContentLayerChromium::create(&m_client))
     {
     }
 
@@ -1376,7 +1377,7 @@ public:
     }
 
 private:
-    MockContentLayerDelegate m_delegate;
+    MockContentLayerChromiumClient m_client;
     RefPtr<ContentLayerChromium> m_rootLayer;
     RefPtr<ContentLayerChromium> m_childLayer;
 };
@@ -1390,7 +1391,7 @@ TEST_F(CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers, runMultiThre
 class CCLayerTreeHostTestAtomicCommit : public CCLayerTreeHostTest {
 public:
     CCLayerTreeHostTestAtomicCommit()
-        : m_layer(ContentLayerChromiumWithUpdateTracking::create(&m_delegate))
+        : m_layer(ContentLayerChromiumWithUpdateTracking::create(&m_client))
     {
         // Make sure partial texture updates are turned off.
         m_settings.maxPartialTextureUpdates = 0;
@@ -1464,7 +1465,7 @@ public:
     }
 
 private:
-    MockContentLayerDelegate m_delegate;
+    MockContentLayerChromiumClient m_client;
     RefPtr<ContentLayerChromiumWithUpdateTracking> m_layer;
 };
 
@@ -1488,8 +1489,8 @@ static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* pa
 class CCLayerTreeHostTestAtomicCommitWithPartialUpdate : public CCLayerTreeHostTest {
 public:
     CCLayerTreeHostTestAtomicCommitWithPartialUpdate()
-        : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_delegate))
-        , m_child(ContentLayerChromiumWithUpdateTracking::create(&m_delegate))
+        : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_client))
+        , m_child(ContentLayerChromiumWithUpdateTracking::create(&m_client))
         , m_numCommits(0)
     {
         // Allow one partial texture update.
@@ -1611,7 +1612,7 @@ public:
     }
 
 private:
-    MockContentLayerDelegate m_delegate;
+    MockContentLayerChromiumClient m_client;
     RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent;
     RefPtr<ContentLayerChromiumWithUpdateTracking> m_child;
     int m_numCommits;
@@ -2290,7 +2291,7 @@ public:
 private:
     const IntSize m_scrollAmount;
     IntSize m_reportedScrollAmount;
-    MockContentLayerDelegate m_mockDelegate;
+    MockContentLayerChromiumClient m_mockDelegate;
     RefPtr<LayerChromium> m_childLayer;
     RefPtr<LayerChromium> m_rootScrollLayer;
 };
@@ -2392,7 +2393,7 @@ public:
     }
 
 private:
-    MockContentLayerDelegate m_mockDelegate;
+    MockContentLayerChromiumClient m_mockDelegate;
     RefPtr<ContentLayerChromiumWithUpdateTracking> m_rootLayer;
     RefPtr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer1;
     RefPtr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer1;
@@ -2640,7 +2641,7 @@ public:
     }
 
 private:
-    MockContentLayerDelegate m_delegate;
+    MockContentLayerChromiumClient m_client;
     RefPtr<EvictionTestLayer> m_layer;
     CCLayerTreeHostImpl* m_implForEvictTextures;
     int m_numCommits;
@@ -2736,7 +2737,7 @@ public:
     }
 
 private:
-    MockContentLayerDelegate m_delegate;
+    MockContentLayerChromiumClient m_client;
     RefPtr<EvictionTestLayer> m_layer;
     CCLayerTreeHostImpl* m_implForEvictTextures;
     int m_numCommits;
@@ -2783,11 +2784,11 @@ private:
 class CCLayerTreeHostTestLostContextWhileUpdatingResources : public CCLayerTreeHostTest {
 public:
     CCLayerTreeHostTestLostContextWhileUpdatingResources()
-        : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_delegate))
+        : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_client))
         , m_numChildren(50)
     {
         for (int i = 0; i < m_numChildren; i++)
-            m_children.append(ContentLayerChromiumWithUpdateTracking::create(&m_delegate));
+            m_children.append(ContentLayerChromiumWithUpdateTracking::create(&m_client));
     }
 
     virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface()
@@ -2825,7 +2826,7 @@ public:
     }
 
 private:
-    MockContentLayerDelegate m_delegate;
+    MockContentLayerChromiumClient m_client;
     RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent;
     int m_numChildren;
     Vector<RefPtr<ContentLayerChromiumWithUpdateTracking> > m_children;
index fd35e22..05cd4c7 100644 (file)
@@ -29,6 +29,7 @@
 #include "BitmapCanvasLayerTextureUpdater.h"
 #include "CCLayerTreeTestCommon.h"
 #include "CCRenderingStats.h"
+#include "ContentLayerChromiumClient.h"
 #include "GraphicsContext.h"
 #include "OpaqueRectTrackingContentLayerDelegate.h"
 #include "skia/ext/platform_canvas.h"
@@ -69,9 +70,9 @@ private:
     IntRect m_contentRect;
 };
 
-class MockContentLayerDelegate : public ContentLayerDelegate {
+class MockContentLayerChromiumClient : public ContentLayerChromiumClient {
 public:
-    explicit MockContentLayerDelegate(OpaqueRectTrackingContentLayerDelegate* client)
+    explicit MockContentLayerChromiumClient(OpaqueRectTrackingContentLayerDelegate* client)
         : m_client(client)
     {
     }
@@ -98,8 +99,8 @@ TEST(ContentLayerChromiumTest, ContentLayerPainterWithDeviceScale)
     OwnPtr<SkCanvas> canvas = adoptPtr(skia::CreateBitmapCanvas(contentRect.width(), contentRect.height(), false));
     OpaqueRectDrawingGraphicsContextPainter painter(opaqueRectInLayerSpace, contentRect);
     OpaqueRectTrackingContentLayerDelegate opaqueRectTrackingContentLayerDelegate(&painter);
-    MockContentLayerDelegate delegate(&opaqueRectTrackingContentLayerDelegate);
-    RefPtr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&delegate));
+    MockContentLayerChromiumClient client(&opaqueRectTrackingContentLayerDelegate);
+    RefPtr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&client));
 
     IntRect resultingOpaqueRect;
     CCRenderingStats stats;