[chromium] Make WebViewImpl depend on WebLayerTreeView instead of CCLayerTreeHost
authorjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Feb 2012 02:55:37 +0000 (02:55 +0000)
committerjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Feb 2012 02:55:37 +0000 (02:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75591

Reviewed by Kenneth Russell.

This converts WebViewImpl from depending on CCLayerTreeHost to WebLayerTreeView in order to provide better
isolation and allow for future refactorings. The changes to WebViewImpl are mostly mechanical. The
WebLayerTreeView and WebLayerTreeViewClient interfaces have both grown and changed slightly:

- Setup path for WebLayerTreeView changed to expose an initialize() function instead of a create() factory
function. The new model is that a WebLayerTreeView when constructed is in a null state. Calling initialize()
attempts to re-initialize the WLTV, which can either fail or succeed.  All other functions must be called on a
successfully initialized view.

- WebLayerTreeView expanded to include functionality that CCLayerTreeHost exposes but WebLayerTreeView did not.
Some of this is only valid for the single thread case and will be removed when we invert the scheduling control
logic, these bits are commented.

- WebLayerTreeViewClient expanded with some flow-control related APIs.

Refactor only, no change in behavior.

* public/platform/WebLayerTreeView.h:
(WebKit::WebLayerTreeView::Settings::Settings):
(WebKit::WebLayerTreeView::isNull):
* public/platform/WebLayerTreeViewClient.h:
* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::scheduleCompositingLayerSync):
* src/WebLayerTreeView.cpp:
(WebKit::WebLayerTreeView::initialize):
(WebKit::WebLayerTreeView::compositorIdentifier):
(WebKit::WebLayerTreeView::setVisible):
(WebKit::WebLayerTreeView::setNeedsAnimate):
(WebKit::WebLayerTreeView::updateAnimations):
(WebKit::WebLayerTreeView::setNeedsRedraw):
(WebKit::WebLayerTreeView::setPageScaleFactorAndLimits):
(WebKit::WebLayerTreeView::startPageScaleAnimation):
(WebKit::WebLayerTreeView::finishAllRendering):
(WebKit::WebLayerTreeView::context):
(WebKit::WebLayerTreeView::loseCompositorContext):
* src/WebLayerTreeViewImpl.cpp:
(WebKit::WebLayerTreeViewImpl::didRecreateGraphicsContext):
(WebKit::WebLayerTreeViewImpl::didCommitAndDrawFrame):
(WebKit::WebLayerTreeViewImpl::didCompleteSwapBuffers):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::animate):
(WebKit::WebViewImpl::doPixelReadbackToCanvas):
(WebKit::WebViewImpl::paint):
(WebKit::WebViewImpl::composite):
(WebKit::WebViewImpl::loseCompositorContext):
(WebKit::WebViewImpl::computePageScaleFactorLimits):
(WebKit::WebViewImpl::addPageOverlay):
(WebKit::WebViewImpl::removePageOverlay):
(WebKit::WebViewImpl::setRootGraphicsLayer):
(WebKit::WebViewImpl::scheduleCompositingLayerSync):
(WebKit::WebViewImpl::scrollRootLayerRect):
(WebKit::WebViewImpl::invalidateRootLayerRect):
(WebKit::WebViewImpl::scheduleAnimation):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
(WebKit::WebViewImpl::createContext3D):
(WebKit::WebViewImpl::applyScrollAndScale):
(WebKit::WebViewImpl::didRebindGraphicsContext):
(WebKit::WebViewImpl::updateLayerTreeViewport):
(WebKit::WebViewImpl::graphicsContext3D):
(WebKit::WebViewImpl::setVisibilityState):
* src/WebViewImpl.h:
* tests/WebLayerTest.cpp:

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

Source/Platform/chromium/public/WebLayerTreeView.h
Source/Platform/chromium/public/WebLayerTreeViewClient.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/ChromeClientImpl.cpp
Source/WebKit/chromium/src/WebLayerTreeView.cpp
Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.h
Source/WebKit/chromium/tests/WebFrameTest.cpp
Source/WebKit/chromium/tests/WebLayerTest.cpp

index 17a876a9851ddfc0cf9a561c986adc23bbd6aab6..6837b19ecbdd2176db6d3d37eb99620284b00762 100644 (file)
@@ -35,8 +35,10 @@ struct CCSettings;
 }
 
 namespace WebKit {
+class WebGraphicsContext3D;
 class WebLayer;
 class WebLayerTreeViewClient;
+struct WebPoint;
 struct WebRect;
 struct WebSize;
 
@@ -51,7 +53,9 @@ public:
             , refreshRate(0)
             , perTilePainting(false)
             , partialSwapEnabled(false)
-            , threadedAnimationEnabled(false) { }
+            , threadedAnimationEnabled(false)
+        {
+        }
 
         bool acceleratePainting;
         bool compositeOffscreen;
@@ -66,8 +70,6 @@ public:
 #endif
     };
 
-    WEBKIT_EXPORT static WebLayerTreeView create(WebLayerTreeViewClient*, const WebLayer& root, const Settings&);
-
     WebLayerTreeView() { }
     WebLayerTreeView(const WebLayerTreeView& layer) { assign(layer); }
     ~WebLayerTreeView() { reset(); }
@@ -76,10 +78,57 @@ public:
         assign(layer);
         return *this;
     }
+
     WEBKIT_EXPORT void reset();
     WEBKIT_EXPORT void assign(const WebLayerTreeView&);
     WEBKIT_EXPORT bool equals(const WebLayerTreeView&) const;
 
+    bool isNull() const { return m_private.isNull(); }
+
+#define WEBLAYERTREEVIEW_HAS_INITIALIZE
+    // Initialization and lifecycle --------------------------------------
+
+    // Attempts to initialize this WebLayerTreeView with the given client, root layer, and settings.
+    // If initialization fails, this will return false and .isNull() will return true.
+    // Must be called before any methods below.
+    WEBKIT_EXPORT bool initialize(WebLayerTreeViewClient*, const WebLayer& root, const Settings&);
+
+    // Sets the root of the tree. The root is set by way of the constructor.
+    // This is typically used to explicitly set the root to null to break
+    // cycles.
+    WEBKIT_EXPORT void setRootLayer(WebLayer*);
+
+    // Returns a unique identifier that can be used on the compositor thread to request a
+    // WebCompositorInputHandler instance.
+    WEBKIT_EXPORT int compositorIdentifier();
+
+
+    // View properties ---------------------------------------------------
+
+    WEBKIT_EXPORT void setViewportSize(const WebSize&);
+    WEBKIT_EXPORT WebSize viewportSize() const;
+
+    // Sets whether this view is visible. In threaded mode, a view that is not visible will not
+    // composite or trigger updateAnimations() or layout() calls until it becomes visible.
+    WEBKIT_EXPORT void setVisible(bool);
+
+    // Sets the current page scale factor and minimum / maximum limits. Both limits are initially 1 (no page scale allowed).
+    WEBKIT_EXPORT void setPageScaleFactorAndLimits(float pageScaleFactor, float minimum, float maximum);
+
+    // Starts an animation of the page scale to a target scale factor and scroll offset.
+    // If useAnchor is true, destination is a point on the screen that will remain fixed for the duration of the animation.
+    // If useAnchor is false, destination is the final top-left scroll position.
+    WEBKIT_EXPORT void startPageScaleAnimation(const WebPoint& destination, bool useAnchor, float newPageScale, double durationSec);
+
+
+    // Flow control and scheduling ---------------------------------------
+
+    // Requests an updateAnimations() call.
+    WEBKIT_EXPORT void setNeedsAnimate();
+
+    // Indicates that the view needs to be redrawn. This is typically used when the frontbuffer is damaged.
+    WEBKIT_EXPORT void setNeedsRedraw();
+
     // Triggers a compositing pass. If the compositor thread was not
     // enabled via WebCompositor::initialize, the compositing pass happens
     // immediately. If it is enabled, the compositing pass will happen at a
@@ -89,8 +138,10 @@ public:
     // WebContentLayerClient::paintContents.
     WEBKIT_EXPORT void composite();
 
-    WEBKIT_EXPORT void setViewportSize(const WebSize&);
-    WEBKIT_EXPORT WebSize viewportSize() const;
+    // Immediately update animations. This should only be used when frame scheduling is handled by
+    // the WebLayerTreeView user and not internally by the compositor, meaning only in single-threaded
+    // mode.
+    WEBKIT_EXPORT void updateAnimations(double frameBeginTime);
 
     // Composites and attempts to read back the result into the provided
     // buffer. If it wasn't possible, e.g. due to context lost, will return
@@ -100,18 +151,20 @@ public:
     // The buffer is not modified if the false is returned.
     WEBKIT_EXPORT bool compositeAndReadback(void *pixels, const WebRect&);
 
-    // Sets the root of the tree. The root is set by way of the constructor.
-    // This is typically used to explicitly set the root to null to break
-    // cycles.
-    WEBKIT_EXPORT void setRootLayer(WebLayer*);
+    // Blocks until the most recently composited frame has finished rendering on the GPU.
+    // This can have a significant performance impact and should be used with care.
+    WEBKIT_EXPORT void finishAllRendering();
 
-#if WEBKIT_IMPLEMENTATION
-    WebLayerTreeView(const WTF::PassRefPtr<WebCore::CCLayerTreeHost>&);
-    WebLayerTreeView& operator=(const WTF::PassRefPtr<WebCore::CCLayerTreeHost>&);
-    operator WTF::PassRefPtr<WebCore::CCLayerTreeHost>() const;
-#endif
 
-    WEBKIT_EXPORT void setNeedsRedraw();
+    // Debugging / dangerous ---------------------------------------------
+
+    // Returns the context being used for rendering this view. In threaded compositing mode, it is
+    // not safe to use this context at all on the main thread.
+    // FIXME: Remove this API as soon as possible, it's very bug-prone in threaded mode.
+    WEBKIT_EXPORT WebGraphicsContext3D* context();
+
+    // Simulates a lost context. For testing only.
+    WEBKIT_EXPORT void loseCompositorContext(int numTimes);
 
 protected:
     WebPrivatePtr<WebCore::CCLayerTreeHost> m_private;
index 9c4dfb77b77114b0ef67b017bfa4bd223b3ab6a6..5c0b9ef9a2a2c613b11900c13f898f22839b465b 100644 (file)
@@ -52,6 +52,9 @@ public:
     // context event).
     virtual void didRebindGraphicsContext(bool success) = 0;
 
+    virtual void didCommitAndDrawFrame() = 0;
+    virtual void didCompleteSwapBuffers() = 0;
+
     // Schedules a compositing pass, meaning the client should call
     // WebLayerTreeView::composite at a later time. This is only called if the
     // compositor thread is disabled; when enabled, the compositor will
index 1fd78c41ed69ca11d37944e7ca08e03a9d7ec1bd..9400d1a6f5cdae2d94032b4adb7fa2c4cedfd34b 100644 (file)
@@ -1,3 +1,73 @@
+2012-02-08  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Make WebViewImpl depend on WebLayerTreeView instead of CCLayerTreeHost
+        https://bugs.webkit.org/show_bug.cgi?id=75591
+
+        Reviewed by Kenneth Russell.
+
+        This converts WebViewImpl from depending on CCLayerTreeHost to WebLayerTreeView in order to provide better
+        isolation and allow for future refactorings. The changes to WebViewImpl are mostly mechanical. The
+        WebLayerTreeView and WebLayerTreeViewClient interfaces have both grown and changed slightly:
+
+        - Setup path for WebLayerTreeView changed to expose an initialize() function instead of a create() factory
+        function. The new model is that a WebLayerTreeView when constructed is in a null state. Calling initialize()
+        attempts to re-initialize the WLTV, which can either fail or succeed.  All other functions must be called on a
+        successfully initialized view.
+
+        - WebLayerTreeView expanded to include functionality that CCLayerTreeHost exposes but WebLayerTreeView did not.
+        Some of this is only valid for the single thread case and will be removed when we invert the scheduling control
+        logic, these bits are commented.
+
+        - WebLayerTreeViewClient expanded with some flow-control related APIs.
+
+        Refactor only, no change in behavior.
+
+        * public/platform/WebLayerTreeView.h:
+        (WebKit::WebLayerTreeView::Settings::Settings):
+        (WebKit::WebLayerTreeView::isNull):
+        * public/platform/WebLayerTreeViewClient.h:
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::scheduleCompositingLayerSync):
+        * src/WebLayerTreeView.cpp:
+        (WebKit::WebLayerTreeView::initialize):
+        (WebKit::WebLayerTreeView::compositorIdentifier):
+        (WebKit::WebLayerTreeView::setVisible):
+        (WebKit::WebLayerTreeView::setNeedsAnimate):
+        (WebKit::WebLayerTreeView::updateAnimations):
+        (WebKit::WebLayerTreeView::setNeedsRedraw):
+        (WebKit::WebLayerTreeView::setPageScaleFactorAndLimits):
+        (WebKit::WebLayerTreeView::startPageScaleAnimation):
+        (WebKit::WebLayerTreeView::finishAllRendering):
+        (WebKit::WebLayerTreeView::context):
+        (WebKit::WebLayerTreeView::loseCompositorContext):
+        * src/WebLayerTreeViewImpl.cpp:
+        (WebKit::WebLayerTreeViewImpl::didRecreateGraphicsContext):
+        (WebKit::WebLayerTreeViewImpl::didCommitAndDrawFrame):
+        (WebKit::WebLayerTreeViewImpl::didCompleteSwapBuffers):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::animate):
+        (WebKit::WebViewImpl::doPixelReadbackToCanvas):
+        (WebKit::WebViewImpl::paint):
+        (WebKit::WebViewImpl::composite):
+        (WebKit::WebViewImpl::loseCompositorContext):
+        (WebKit::WebViewImpl::computePageScaleFactorLimits):
+        (WebKit::WebViewImpl::addPageOverlay):
+        (WebKit::WebViewImpl::removePageOverlay):
+        (WebKit::WebViewImpl::setRootGraphicsLayer):
+        (WebKit::WebViewImpl::scheduleCompositingLayerSync):
+        (WebKit::WebViewImpl::scrollRootLayerRect):
+        (WebKit::WebViewImpl::invalidateRootLayerRect):
+        (WebKit::WebViewImpl::scheduleAnimation):
+        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+        (WebKit::WebViewImpl::createContext3D):
+        (WebKit::WebViewImpl::applyScrollAndScale):
+        (WebKit::WebViewImpl::didRebindGraphicsContext):
+        (WebKit::WebViewImpl::updateLayerTreeViewport):
+        (WebKit::WebViewImpl::graphicsContext3D):
+        (WebKit::WebViewImpl::setVisibilityState):
+        * src/WebViewImpl.h:
+        * tests/WebLayerTest.cpp:
+
 2012-02-24  Ian Vollick  <vollick@chromium.org>
 
         [chromium] Plumb animation started notifications from CCLayerTreeHost to GraphicsLayerChromium
index 45a81385944ce8abdbc7bb994aeb3cc9df2240bf..e08c07450c07ef107c7e9665c4a0505375a41faf 100644 (file)
@@ -890,7 +890,7 @@ void ChromeClientImpl::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* grap
 
 void ChromeClientImpl::scheduleCompositingLayerSync()
 {
-    m_webView->setRootLayerNeedsDisplay();
+    m_webView->scheduleCompositingLayerSync();
 }
 
 ChromeClient::CompositingTriggerFlags ChromeClientImpl::allowedCompositingTriggers() const
index d2c0f0c121a7c0d5e5bfe1e505ed7beabbb27baf..25ef77af522cb4e085e2b35a39fc2f3acfbc732a 100644 (file)
 #include "config.h"
 #include "platform/WebLayerTreeView.h"
 
+#include "GraphicsContext3DPrivate.h"
 #include "WebLayerTreeViewImpl.h"
 #include "cc/CCLayerTreeHost.h"
 #include "platform/WebLayer.h"
+#include "platform/WebPoint.h"
 #include "platform/WebRect.h"
 #include "platform/WebSize.h"
 
@@ -51,11 +53,6 @@ WebLayerTreeView::Settings::operator CCSettings() const
     return settings;
 }
 
-WebLayerTreeView WebLayerTreeView::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
-{
-    return WebLayerTreeView(WebLayerTreeViewImpl::create(client, root, settings));
-}
-
 void WebLayerTreeView::reset()
 {
     m_private.reset();
@@ -71,12 +68,23 @@ bool WebLayerTreeView::equals(const WebLayerTreeView& n) const
     return (m_private.get() == n.m_private.get());
 }
 
-void WebLayerTreeView::composite()
+bool WebLayerTreeView::initialize(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
 {
-    if (CCProxy::hasImplThread())
-        m_private->setNeedsCommit();
+    m_private = WebLayerTreeViewImpl::create(client, root, settings);
+    return !isNull();
+}
+
+void WebLayerTreeView::setRootLayer(WebLayer *root)
+{
+    if (root)
+        m_private->setRootLayer(*root);
     else
-        m_private->composite();
+        m_private->setRootLayer(PassRefPtr<LayerChromium>());
+}
+
+int WebLayerTreeView::compositorIdentifier()
+{
+    return m_private->compositorIdentifier();
 }
 
 void WebLayerTreeView::setViewportSize(const WebSize& viewportSize)
@@ -89,38 +97,62 @@ WebSize WebLayerTreeView::viewportSize() const
     return WebSize(m_private->viewportSize());
 }
 
-bool WebLayerTreeView::compositeAndReadback(void *pixels, const WebRect& rect)
+void WebLayerTreeView::setVisible(bool visible)
 {
-    return m_private->compositeAndReadback(pixels, rect);
+    m_private->setVisible(visible);
 }
 
-void WebLayerTreeView::setRootLayer(WebLayer *root)
+void WebLayerTreeView::setPageScaleFactorAndLimits(float pageScaleFactor, float minimum, float maximum)
 {
-    if (root)
-        m_private->setRootLayer(*root);
+    m_private->setPageScaleFactorAndLimits(pageScaleFactor, minimum, maximum);
+}
+
+void WebLayerTreeView::startPageScaleAnimation(const WebPoint& scroll, bool useAnchor, float newPageScale, double durationSec)
+{
+    m_private->startPageScaleAnimation(IntSize(scroll.x, scroll.y), useAnchor, newPageScale, durationSec);
+}
+
+void WebLayerTreeView::setNeedsAnimate()
+{
+    m_private->setNeedsAnimate();
+}
+
+void WebLayerTreeView::setNeedsRedraw()
+{
+    m_private->setNeedsRedraw();
+}
+
+void WebLayerTreeView::composite()
+{
+    if (CCProxy::hasImplThread())
+        m_private->setNeedsCommit();
     else
-        m_private->setRootLayer(PassRefPtr<LayerChromium>());
+        m_private->composite();
+}
+
+void WebLayerTreeView::updateAnimations(double frameBeginTime)
+{
+    m_private->updateAnimations(frameBeginTime);
 }
 
-WebLayerTreeView::WebLayerTreeView(const PassRefPtr<CCLayerTreeHost>& node)
-    : m_private(node)
+bool WebLayerTreeView::compositeAndReadback(void *pixels, const WebRect& rect)
 {
+    return m_private->compositeAndReadback(pixels, rect);
 }
 
-WebLayerTreeView& WebLayerTreeView::operator=(const PassRefPtr<CCLayerTreeHost>& node)
+void WebLayerTreeView::finishAllRendering()
 {
-    m_private = node;
-    return *this;
+    m_private->finishAllRendering();
 }
 
-WebLayerTreeView::operator PassRefPtr<CCLayerTreeHost>() const
+WebGraphicsContext3D* WebLayerTreeView::context()
 {
-    return m_private.get();
+    return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_private->context());
 }
 
-void WebLayerTreeView::setNeedsRedraw()
+void WebLayerTreeView::loseCompositorContext(int numTimes)
 {
-    m_private->setNeedsRedraw();
+    m_private->loseCompositorContext(numTimes);
 }
 
 } // namespace WebKit
index 29d03321530b69213adf151f0a50a8c8a075d232..3597cf4f5c40c63ff682a008afe27fb2d667ad71 100644 (file)
@@ -89,20 +89,22 @@ PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createLayerTreeHostContext3D
     return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow, false /* preserveDrawingBuffer */ );
 }
 
-void WebLayerTreeViewImpl::didCommitAndDrawFrame()
+void WebLayerTreeViewImpl::didRecreateGraphicsContext(bool success)
 {
-    // FIXME: route this up to the WebLayerTreeView client
+    if (m_client)
+        m_client->didRebindGraphicsContext(success);
 }
 
-void WebLayerTreeViewImpl::didCompleteSwapBuffers()
+void WebLayerTreeViewImpl::didCommitAndDrawFrame()
 {
-    // FIXME: route this up to the WebLayerTreeView client
+    if (m_client)
+        m_client->didCommitAndDrawFrame();
 }
 
-void WebLayerTreeViewImpl::didRecreateGraphicsContext(bool success)
+void WebLayerTreeViewImpl::didCompleteSwapBuffers()
 {
     if (m_client)
-        m_client->didRebindGraphicsContext(success);
+        m_client->didCompleteSwapBuffers();
 }
 
 void WebLayerTreeViewImpl::scheduleComposite()
index 55a2052a44d6ce04bdc518aede618f2e3ed91a37..f1530229e48b401f31a2c5f61475aac25818a25b 100644 (file)
@@ -34,6 +34,7 @@
 #include "AutofillPopupMenuClient.h"
 #include "AXObjectCache.h"
 #include "BackForwardListChromium.h"
+#include "cc/CCProxy.h"
 #include "CSSStyleSelector.h"
 #include "CSSValueKeywords.h"
 #include "Chrome.h"
 #include "WebInputEventConversion.h"
 #include "WebKit.h"
 #include "platform/WebKitPlatformSupport.h"
+#include "platform/WebLayer.h"
+#include "platform/WebLayerTreeView.h"
 #include "WebMediaPlayerAction.h"
 #include "WebNode.h"
 #include "WebPlugin.h"
 #include "platform/WebString.h"
 #include "platform/WebVector.h"
 #include "WebViewClient.h"
-#include "cc/CCProxy.h"
 #include <wtf/ByteArray.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/MainThread.h>
@@ -627,8 +629,8 @@ bool WebViewImpl::gestureEvent(const WebGestureEvent& event)
 
 void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec)
 {
-    if (m_layerTreeHost)
-        m_layerTreeHost->startPageScaleAnimation(IntSize(scroll.x(), scroll.y()), useAnchor, newScale, durationSec);
+    if (!m_layerTreeView.isNull())
+        m_layerTreeView.startPageScaleAnimation(scroll, useAnchor, newScale, durationSec);
 }
 #endif
 
@@ -1276,7 +1278,7 @@ void WebViewImpl::animate(double frameBeginTime)
     // In composited mode, we always go through the compositor so it can apply
     // appropriate flow-control mechanisms.
     if (isAcceleratedCompositingActive())
-        m_layerTreeHost->updateAnimations(frameBeginTime);
+        m_layerTreeView.updateAnimations(frameBeginTime);
     else
 #endif
         updateAnimations(frameBeginTime);
@@ -1324,6 +1326,7 @@ void WebViewImpl::layout()
 #if USE(ACCELERATED_COMPOSITING)
 void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect)
 {
+    ASSERT(!m_layerTreeView.isNull());
 #if USE(SKIA)
     PlatformContextSkia context(canvas);
 
@@ -1342,7 +1345,7 @@ void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect
     OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(rect.size()));
     RefPtr<ByteArray> pixelArray(ByteArray::create(rect.width() * rect.height() * 4));
     if (imageBuffer && pixelArray) {
-        m_layerTreeHost->compositeAndReadback(pixelArray->data(), invertRect);
+        m_layerTreeView.compositeAndReadback(pixelArray->data(), invertRect);
         imageBuffer->putByteArray(Premultiplied, pixelArray.get(), rect.size(), IntRect(IntPoint(), rect.size()), IntPoint());
         gc.save();
         gc.translate(IntSize(0, bitmapHeight));
@@ -1364,7 +1367,7 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
         if (canvas) {
             // Clip rect to the confines of the rootLayerTexture.
             IntRect resizeRect(rect);
-            resizeRect.intersect(IntRect(IntPoint(0, 0), m_layerTreeHost->viewportSize()));
+            resizeRect.intersect(IntRect(IntPoint(0, 0), m_layerTreeView.viewportSize()));
             doPixelReadbackToCanvas(canvas, resizeRect);
         }
 #endif
@@ -1394,7 +1397,7 @@ void WebViewImpl::composite(bool)
 {
 #if USE(ACCELERATED_COMPOSITING)
     if (CCProxy::hasImplThread())
-        m_layerTreeHost->setNeedsRedraw();
+        m_layerTreeView.setNeedsRedraw();
     else {
         ASSERT(isAcceleratedCompositingActive());
         if (!page())
@@ -1403,7 +1406,7 @@ void WebViewImpl::composite(bool)
         if (m_pageOverlays)
             m_pageOverlays->update();
 
-        m_layerTreeHost->composite();
+        m_layerTreeView.composite();
     }
 #endif
 }
@@ -1411,16 +1414,16 @@ void WebViewImpl::composite(bool)
 void WebViewImpl::setNeedsRedraw()
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_layerTreeHost && isAcceleratedCompositingActive())
-        m_layerTreeHost->setNeedsRedraw();
+    if (!m_layerTreeView.isNull() && isAcceleratedCompositingActive())
+        m_layerTreeView.setNeedsRedraw();
 #endif
 }
 
 void WebViewImpl::loseCompositorContext(int numTimes)
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_layerTreeHost)
-        m_layerTreeHost->loseCompositorContext(numTimes);
+    if (!m_layerTreeView.isNull())
+        m_layerTreeView.loseCompositorContext(numTimes);
 #endif
 }
 
@@ -2302,8 +2305,8 @@ bool WebViewImpl::computePageScaleFactorLimits()
 
     float clampedScale = clampPageScaleFactorToLimits(pageScaleFactor());
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_layerTreeHost)
-        m_layerTreeHost->setPageScaleFactorAndLimits(clampedScale, m_minimumPageScaleFactor, m_maximumPageScaleFactor);
+    if (!m_layerTreeView.isNull())
+        m_layerTreeView.setPageScaleFactorAndLimits(clampedScale, m_minimumPageScaleFactor, m_maximumPageScaleFactor);
 #endif
     if (clampedScale != pageScaleFactor()) {
         setPageScaleFactorPreservingScrollOffset(clampedScale);
@@ -2929,17 +2932,12 @@ void WebViewImpl::addPageOverlay(WebPageOverlay* overlay, int zOrder)
         m_pageOverlays = PageOverlayList::create(this);
 
     m_pageOverlays->add(overlay, zOrder);
-    setRootLayerNeedsDisplay();
 }
 
 void WebViewImpl::removePageOverlay(WebPageOverlay* overlay)
 {
-    if (m_pageOverlays && m_pageOverlays->remove(overlay)) {
-        setRootLayerNeedsDisplay();
-
-        if (m_pageOverlays->empty())
-            m_pageOverlays = nullptr;
-    }
+    if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->empty())
+        m_pageOverlays = nullptr;
 }
 
 void WebViewImpl::setOverlayLayer(WebCore::GraphicsLayer* layer)
@@ -3047,29 +3045,31 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
         }
         m_nonCompositedContentHost->setScrollLayer(scrollLayer);
     }
-    if (m_layerTreeHost)
-        m_layerTreeHost->setRootLayer(layer ? layer->platformLayer() : 0);
+
+    if (layer)
+        m_rootLayer = WebLayer(layer->platformLayer());
+
+    if (!m_layerTreeView.isNull())
+        m_layerTreeView.setRootLayer(layer ? &m_rootLayer : 0);
 
     IntRect damagedRect(0, 0, m_size.width, m_size.height);
     if (!m_isAcceleratedCompositingActive)
         m_client->didInvalidateRect(damagedRect);
 }
 
-void WebViewImpl::setRootLayerNeedsDisplay()
+void WebViewImpl::scheduleCompositingLayerSync()
 {
-    if (m_layerTreeHost)
-        m_layerTreeHost->setNeedsCommit();
+    m_layerTreeView.setNeedsRedraw();
 }
 
-void WebViewImpl::scrollRootLayerRect(const IntSize& scrollDelta, const IntRect& clipRect)
+void WebViewImpl::scrollRootLayerRect(const IntSize&, const IntRect&)
 {
     updateLayerTreeViewport();
-    setRootLayerNeedsDisplay();
 }
 
 void WebViewImpl::invalidateRootLayerRect(const IntRect& rect)
 {
-    ASSERT(m_layerTreeHost);
+    ASSERT(!m_layerTreeView.isNull());
 
     if (!page())
         return;
@@ -3078,7 +3078,6 @@ void WebViewImpl::invalidateRootLayerRect(const IntRect& rect)
     IntRect dirtyRect = view->windowToContents(rect);
     updateLayerTreeViewport();
     m_nonCompositedContentHost->invalidateRect(dirtyRect);
-    setRootLayerNeedsDisplay();
 }
 
 NonCompositedContentHost* WebViewImpl::nonCompositedContentHost()
@@ -3091,8 +3090,8 @@ void WebViewImpl::scheduleAnimation()
 {
     if (isAcceleratedCompositingActive()) {
         if (CCProxy::hasImplThread()) {
-            ASSERT(m_layerTreeHost);
-            m_layerTreeHost->setNeedsAnimate();
+            ASSERT(!m_layerTreeView.isNull());
+            m_layerTreeView.setNeedsAnimate();
         } else
             m_client->scheduleAnimation();
     } else
@@ -3145,26 +3144,26 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
         m_isAcceleratedCompositingActive = false;
         // We need to finish all GL rendering before sending didDeactivateCompositor() to prevent
         // flickering when compositing turns off.
-        if (m_layerTreeHost)
-            m_layerTreeHost->finishAllRendering();
+        if (!m_layerTreeView.isNull())
+            m_layerTreeView.finishAllRendering();
         m_client->didDeactivateCompositor();
-    } else if (m_layerTreeHost) {
+    } else if (!m_layerTreeView.isNull()) {
         m_isAcceleratedCompositingActive = true;
         updateLayerTreeViewport();
 
-        m_client->didActivateCompositor(m_layerTreeHost->compositorIdentifier());
+        m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier());
     } else {
         TRACE_EVENT("WebViewImpl::setIsAcceleratedCompositingActive(true)", this, 0);
 
-        WebCore::CCSettings ccSettings;
-        ccSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled();
-        ccSettings.compositeOffscreen = settings()->compositeToTextureEnabled();
-        ccSettings.showFPSCounter = settings()->showFPSCounter();
-        ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree();
+        WebLayerTreeView::Settings layerTreeViewSettings;
+        layerTreeViewSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled();
+        layerTreeViewSettings.compositeOffscreen = settings()->compositeToTextureEnabled();
+        layerTreeViewSettings.showFPSCounter = settings()->showFPSCounter();
+        layerTreeViewSettings.showPlatformLayerTree = settings()->showPlatformLayerTree();
 
-        ccSettings.perTilePainting = page()->settings()->perTileDrawingEnabled();
-        ccSettings.partialSwapEnabled = page()->settings()->partialSwapEnabled();
-        ccSettings.threadedAnimationEnabled = page()->settings()->threadedAnimationEnabled();
+        layerTreeViewSettings.perTilePainting = page()->settings()->perTileDrawingEnabled();
+        layerTreeViewSettings.partialSwapEnabled = page()->settings()->partialSwapEnabled();
+        layerTreeViewSettings.threadedAnimationEnabled = page()->settings()->threadedAnimationEnabled();
 
         m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this));
         m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders());
@@ -3172,17 +3171,16 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
         if (page() && page()->mainFrame()->view())
             m_nonCompositedContentHost->setBackgroundColor(page()->mainFrame()->view()->documentBackgroundColor());
 
-        m_layerTreeHost = CCLayerTreeHost::create(this, ccSettings);
-        if (m_layerTreeHost) {
-            m_layerTreeHost->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
+        m_layerTreeView.initialize(this, m_rootLayer, layerTreeViewSettings);
+        if (!m_layerTreeView.isNull()) {
+            m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
             updateLayerTreeViewport();
-            m_client->didActivateCompositor(m_layerTreeHost->compositorIdentifier());
+            m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier());
             m_isAcceleratedCompositingActive = true;
             m_compositorCreationFailed = false;
             if (m_pageOverlays)
                 m_pageOverlays->update();
         } else {
-            m_layerTreeHost.clear();
             m_nonCompositedContentHost.clear();
             m_isAcceleratedCompositingActive = false;
             m_client->didDeactivateCompositor();
@@ -3195,29 +3193,31 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
 
 #endif
 
-PassRefPtr<GraphicsContext3D> WebViewImpl::createCompositorGraphicsContext3D()
+PassOwnPtr<WebKit::WebGraphicsContext3D> WebViewImpl::createCompositorGraphicsContext3D()
 {
     WebKit::WebGraphicsContext3D::Attributes attributes = getCompositorContextAttributes(CCProxy::hasImplThread());
     OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(client()->createGraphicsContext3D(attributes, true /* renderDirectlyToHostWindow */));
     if (!webContext)
-        return 0;
+        return nullptr;
 
-    return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow);
+    return webContext.release();
 }
 
-PassRefPtr<GraphicsContext3D> WebViewImpl::createLayerTreeHostContext3D()
+WebKit::WebGraphicsContext3D* WebViewImpl::createContext3D()
 {
-    RefPtr<GraphicsContext3D> context;
+    OwnPtr<WebKit::WebGraphicsContext3D> webContext;
 
     // If we've already created an onscreen context for this view, return that.
     if (m_temporaryOnscreenGraphicsContext3D)
-        context = m_temporaryOnscreenGraphicsContext3D.release();
+        webContext = m_temporaryOnscreenGraphicsContext3D.release();
     else // Otherwise make a new one.
-        context = createCompositorGraphicsContext3D();
-    return context;
+        webContext = createCompositorGraphicsContext3D();
+    // The caller takes ownership of this object, but since there's no equivalent of PassOwnPtr<> in the WebKit API
+    // we return a raw pointer.
+    return webContext.leakPtr();
 }
 
-void WebViewImpl::applyScrollAndScale(const IntSize& scrollDelta, float pageScaleDelta)
+void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScaleDelta)
 {
     if (!mainFrameImpl() || !mainFrameImpl()->frameView())
         return;
@@ -3230,8 +3230,8 @@ void WebViewImpl::applyScrollAndScale(const IntSize& scrollDelta, float pageScal
         // in the old coordinate space, so we first need to multiply them
         // by the page scale delta.
         WebSize scrollOffset = mainFrame()->scrollOffset();
-        scrollOffset.width += scrollDelta.width();
-        scrollOffset.height += scrollDelta.height();
+        scrollOffset.width += scrollDelta.width;
+        scrollOffset.height += scrollDelta.height;
         WebPoint scaledScrollOffset(scrollOffset.width * pageScaleDelta,
                                     scrollOffset.height * pageScaleDelta);
         setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scaledScrollOffset);
@@ -3250,7 +3250,7 @@ void WebViewImpl::didCompleteSwapBuffers()
         m_client->didCompleteSwapBuffers();
 }
 
-void WebViewImpl::didRecreateGraphicsContext(bool success)
+void WebViewImpl::didRebindGraphicsContext(bool success)
 {
 
     // Switch back to software rendering mode, if necessary
@@ -3277,7 +3277,7 @@ void WebViewImpl::scheduleComposite()
 
 void WebViewImpl::updateLayerTreeViewport()
 {
-    if (!page() || !m_nonCompositedContentHost || !m_layerTreeHost)
+    if (!page() || !m_nonCompositedContentHost || m_layerTreeView.isNull())
         return;
 
     FrameView* view = page()->mainFrame()->view();
@@ -3293,18 +3293,18 @@ void WebViewImpl::updateLayerTreeViewport()
         layerAdjustX = -view->contentsSize().width() + view->visibleContentRect(false).width();
     }
     m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, pageScaleFactor(), layerAdjustX);
-    m_layerTreeHost->setViewportSize(visibleRect.size());
-    m_layerTreeHost->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
+    m_layerTreeView.setViewportSize(visibleRect.size());
+    m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
 }
 
 WebGraphicsContext3D* WebViewImpl::graphicsContext3D()
 {
 #if USE(ACCELERATED_COMPOSITING)
     if (m_page->settings()->acceleratedCompositingEnabled() && allowsAcceleratedCompositing()) {
-        if (m_layerTreeHost) {
-            WebGraphicsContext3D* webContext = GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_layerTreeHost->context());
-            if (webContext && !webContext->isContextLost())
-                return webContext;
+        if (!m_layerTreeView.isNull()) {
+            WebGraphicsContext3D* context = m_layerTreeView.context();
+            if (context && !context->isContextLost())
+                return context;
         }
         // If we get here it means that some system needs access to the context the compositor will use but the compositor itself
         // hasn't requested a context or it was unable to successfully instantiate a context.
@@ -3313,7 +3313,7 @@ WebGraphicsContext3D* WebViewImpl::graphicsContext3D()
         if (!m_temporaryOnscreenGraphicsContext3D)
             m_temporaryOnscreenGraphicsContext3D = createCompositorGraphicsContext3D();
 
-        WebGraphicsContext3D* webContext = GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_temporaryOnscreenGraphicsContext3D.get());
+        WebGraphicsContext3D* webContext = m_temporaryOnscreenGraphicsContext3D.get();
         if (webContext && !webContext->isContextLost())
             return webContext;
     }
@@ -3338,7 +3338,7 @@ void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
         bool visible = visibilityState == WebPageVisibilityStateVisible;
         if (!visible)
             m_nonCompositedContentHost->protectVisibleTileTextures();
-        m_layerTreeHost->setVisible(visible);
+        m_layerTreeView.setVisible(visible);
     }
 #endif
 }
index bc7a53d0447da7d321e06bb70269120525994dc0..cac6d48828caf10ffe4468fa2d9debd811b9515a 100644 (file)
@@ -32,6 +32,9 @@
 #define WebViewImpl_h
 
 #include "WebNavigationPolicy.h"
+#include "platform/WebLayer.h"
+#include "platform/WebLayerTreeView.h"
+#include "platform/WebLayerTreeViewClient.h"
 #include "platform/WebPoint.h"
 #include "platform/WebRect.h"
 #include "platform/WebSize.h"
@@ -50,7 +53,6 @@
 #include "NotificationPresenterImpl.h"
 #include "PageOverlayList.h"
 #include "UserMediaClientImpl.h"
-#include "cc/CCLayerTreeHost.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/RefCounted.h>
 
@@ -94,7 +96,7 @@ class WebMouseWheelEvent;
 class WebSettingsImpl;
 class WebTouchEvent;
 
-class WebViewImpl : public WebView, public WebCore::CCLayerTreeHostClient, public RefCounted<WebViewImpl> {
+class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl> {
 public:
     enum AutoZoomType {
         DoubleTap,
@@ -246,13 +248,13 @@ public:
     virtual void addPageOverlay(WebPageOverlay*, int /* zOrder */);
     virtual void removePageOverlay(WebPageOverlay*);
 
-    // CCLayerTreeHostClient
+    // WebLayerTreeViewClient
     virtual void updateAnimations(double frameBeginTime);
-    virtual void applyScrollAndScale(const WebCore::IntSize&, float);
-    virtual PassRefPtr<WebCore::GraphicsContext3D> createLayerTreeHostContext3D();
+    virtual void applyScrollAndScale(const WebSize&, float);
+    virtual WebGraphicsContext3D* createContext3D();
+    virtual void didRebindGraphicsContext(bool);
     virtual void didCommitAndDrawFrame();
     virtual void didCompleteSwapBuffers();
-    virtual void didRecreateGraphicsContext(bool success);
     virtual void scheduleComposite();
 
     // WebViewImpl
@@ -434,7 +436,7 @@ public:
     bool allowsAcceleratedCompositing();
     bool pageHasRTLStyle() const;
     void setRootGraphicsLayer(WebCore::GraphicsLayer*);
-    void setRootLayerNeedsDisplay();
+    void scheduleCompositingLayerSync();
     void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect);
     void invalidateRootLayerRect(const WebCore::IntRect&);
     NonCompositedContentHost* nonCompositedContentHost();
@@ -450,7 +452,7 @@ public:
     // we could not successfully instantiate a context.
     virtual WebGraphicsContext3D* graphicsContext3D();
 
-    PassRefPtr<WebCore::GraphicsContext3D> createCompositorGraphicsContext3D();
+    PassOwnPtr<WebGraphicsContext3D> createCompositorGraphicsContext3D();
 
     virtual void setVisibilityState(WebPageVisibilityState, bool);
 
@@ -688,7 +690,8 @@ private:
 #if USE(ACCELERATED_COMPOSITING)
     WebCore::IntRect m_rootLayerScrollDamage;
     OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost;
-    RefPtr<WebCore::CCLayerTreeHost> m_layerTreeHost;
+    WebLayerTreeView m_layerTreeView;
+    WebLayer m_rootLayer;
     WebCore::GraphicsLayer* m_rootGraphicsLayer;
     bool m_isAcceleratedCompositingActive;
     bool m_compositorCreationFailed;
@@ -703,7 +706,7 @@ private:
     // If we attempt to fetch the on-screen GraphicsContext3D before
     // the compositor has been turned on, we need to instantiate it
     // early. This member holds on to the GC3D in this case.
-    RefPtr<WebCore::GraphicsContext3D> m_temporaryOnscreenGraphicsContext3D;
+    OwnPtr<WebGraphicsContext3D> m_temporaryOnscreenGraphicsContext3D;
     OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy;
     OwnPtr<GeolocationClientProxy> m_geolocationClientProxy;
 
index f61e9864886eb735decf07dfe3d12415fffbbb9a..dc1dfe5342ba0cf4c2347a59bd66e66c3750e5e7 100644 (file)
@@ -186,27 +186,27 @@ TEST_F(WebFrameTest, DivAutoZoomParamsTest)
     EXPECT_EQ(vScroll, scroll.y);
 
     // Test zoom out to overview scale.
-    webViewImpl->applyScrollAndScale(WebCore::IntSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor());
+    webViewImpl->applyScrollAndScale(WebSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor());
     webViewImpl->computeScaleAndScrollForHitRect(doubleTapPoint, WebViewImpl::DoubleTap, scale, scroll);
     EXPECT_FLOAT_EQ(1, scale);
     EXPECT_EQ(WebPoint(0, 0), scroll);
 
     // Tests for clamped scaling.
     // Test clamp to device scale:
-    webViewImpl->applyScrollAndScale(WebCore::IntSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor());
+    webViewImpl->applyScrollAndScale(WebSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor());
     webViewImpl->setDeviceScaleFactor(2.5);
     webViewImpl->computeScaleAndScrollForHitRect(doubleTapPoint, WebViewImpl::DoubleTap, scale, scroll);
     EXPECT_FLOAT_EQ(2.5, scale);
 
     // Test clamp to minimum scale:
-    webViewImpl->applyScrollAndScale(WebCore::IntSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor());
+    webViewImpl->applyScrollAndScale(WebSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor());
     webViewImpl->setPageScaleFactorLimits(1.5 / webViewImpl->deviceScaleFactor(), 4 / webViewImpl->deviceScaleFactor());
     webViewImpl->computeScaleAndScrollForHitRect(doubleTapPoint, WebViewImpl::DoubleTap, scale, scroll);
     EXPECT_FLOAT_EQ(1.5, scale);
     EXPECT_EQ(WebPoint(0, 0), scroll);
 
     // Test clamp to maximum scale:
-    webViewImpl->applyScrollAndScale(WebCore::IntSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor());
+    webViewImpl->applyScrollAndScale(WebSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor());
     webViewImpl->setDeviceScaleFactor(4);
     webViewImpl->setPageScaleFactorLimits(0, 3 / webViewImpl->deviceScaleFactor());
     webViewImpl->computeScaleAndScrollForHitRect(doubleTapPoint, WebViewImpl::DoubleTap, scale, scroll);
index e0cab87bdf55ba28fb72667096826b2d03c67c46..1eed81aea416c90b14eeeec4a3d72816ed1ee3e1 100644 (file)
@@ -57,6 +57,8 @@ public:
     virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) { }
     virtual WebGraphicsContext3D* createContext3D() { return CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).leakPtr(); }
     virtual void didRebindGraphicsContext(bool success) { }
+    virtual void didCommitAndDrawFrame() { }
+    virtual void didCompleteSwapBuffers() { }
 };
 
 class MockWebContentLayerClient : public WebContentLayerClient {
@@ -72,7 +74,7 @@ public:
         WebKit::WebCompositor::initialize(0);
         m_rootLayer = WebLayer::create();
         EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
-        m_view = WebLayerTreeView::create(&m_client, m_rootLayer, WebLayerTreeView::Settings());
+        EXPECT_TRUE(m_view.initialize(&m_client, m_rootLayer, WebLayerTreeView::Settings()));
         Mock::VerifyAndClearExpectations(&m_client);
     }