[chromium] Clean up WebWidget / WebLayerTreeView interactions

https://bugs.webkit.org/show_bug.cgi?id=109125

Patch by James Robinson <jamesr@chromium.org> on 2013-03-05
Reviewed by Adrienne Walker.

Source/Platform:

This deprecates most of the calls on WebLayerTreeViewClient since these interactions are handled
entirely on the embedder side of the interface now.

* chromium/public/WebLayerTreeView.h:
(WebLayerTreeView):
* chromium/public/WebLayerTreeViewClient.h:
(WebLayerTreeViewClient):
(WebKit::WebLayerTreeViewClient::willBeginFrame):
(WebKit::WebLayerTreeViewClient::didBeginFrame):
(WebKit::WebLayerTreeViewClient::applyScrollAndScale):
(WebKit::WebLayerTreeViewClient::layout):
(WebKit::WebLayerTreeViewClient::didRecreateOutputSurface):
(WebKit::WebLayerTreeViewClient::createInputHandler):
(WebKit::WebLayerTreeViewClient::createOutputSurface):
(WebKit::WebLayerTreeViewClient::willCommit):
(WebKit::WebLayerTreeViewClient::didCommit):
(WebKit::WebLayerTreeViewClient::didCommitAndDrawFrame):
(WebKit::WebLayerTreeViewClient::didCompleteSwapBuffers):

Source/WebKit/chromium:

This removes most of the compositing control flow logic from WebViewImpl since
it is now handled in the embedding layer (by the implementation of WebViewClient/WebWidgetClient).

* public/WebViewClient.h:
* public/WebWidget.h:
(WebKit):
(WebKit::WebWidget::animate):
(WebWidget):
(WebKit::WebWidget::didExitCompositingMode):
(WebKit::WebWidget::createInputHandler):
(WebKit::WebWidget::applyScrollAndScale):
(WebKit::WebWidget::instrumentBeginFrame):
(WebKit::WebWidget::instrumentWillBeginFrame):
(WebKit::WebWidget::instrumentDidCancelFrame):
(WebKit::WebWidget::instrumentDidBeginFrame):
(WebKit::WebWidget::instrumentWillComposite):
* src/WebHelperPluginImpl.cpp:
* src/WebHelperPluginImpl.h:
(WebHelperPluginImpl):
* src/WebPagePopupImpl.cpp:
* src/WebPagePopupImpl.h:
(WebPagePopupImpl):
* src/WebPopupMenuImpl.cpp:
* src/WebPopupMenuImpl.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::instrumentWillBeginFrame):
(WebKit::WebViewImpl::instrumentDidBeginFrame):
(WebKit::WebViewImpl::instrumentDidCancelFrame):
(WebKit::WebViewImpl::instrumentWillComposite):
(WebKit):
(WebKit::WebViewImpl::updateBatteryStatus):
(WebKit::WebViewImpl::animate):
(WebKit::WebViewImpl::didExitCompositingMode):
* src/WebViewImpl.h:
* tests/WebLayerTreeViewTestCommon.h:
(MockWebLayerTreeViewClient):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144784 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3663f584
2013-03-05 James Robinson <jamesr@chromium.org>
[chromium] Clean up WebWidget / WebLayerTreeView interactions
https://bugs.webkit.org/show_bug.cgi?id=109125
Reviewed by Adrienne Walker.
This deprecates most of the calls on WebLayerTreeViewClient since these interactions are handled
entirely on the embedder side of the interface now.
* chromium/public/WebLayerTreeView.h:
(WebLayerTreeView):
* chromium/public/WebLayerTreeViewClient.h:
(WebLayerTreeViewClient):
(WebKit::WebLayerTreeViewClient::willBeginFrame):
(WebKit::WebLayerTreeViewClient::didBeginFrame):
(WebKit::WebLayerTreeViewClient::applyScrollAndScale):
(WebKit::WebLayerTreeViewClient::layout):
(WebKit::WebLayerTreeViewClient::didRecreateOutputSurface):
(WebKit::WebLayerTreeViewClient::createInputHandler):
(WebKit::WebLayerTreeViewClient::createOutputSurface):
(WebKit::WebLayerTreeViewClient::willCommit):
(WebKit::WebLayerTreeViewClient::didCommit):
(WebKit::WebLayerTreeViewClient::didCommitAndDrawFrame):
(WebKit::WebLayerTreeViewClient::didCompleteSwapBuffers):
2013-03-05 Tommy Widenflycht <tommyw@google.com>
MediaStream API: Add the getStreamById method on RTCPeerConnection
......
......@@ -131,7 +131,7 @@ public:
// Flow control and scheduling ---------------------------------------
// Requests an updateAnimations() call.
// Indicates that an animation needs to be updated.
virtual void setNeedsAnimate() = 0;
// Indicates that the view needs to be redrawn. This is typically used when the frontbuffer is damaged.
......@@ -140,20 +140,6 @@ public:
// Indicates whether a commit is pending.
virtual bool commitRequested() const = 0;
// Triggers a compositing pass. If the compositor thread was not
// enabled via WebCompositorSupport::initialize, the compositing pass happens
// immediately. If it is enabled, the compositing pass will happen at a
// later time. Before the compositing pass happens (i.e. before composite()
// returns when the compositor thread is disabled), WebContentLayers will be
// asked to paint their dirty region, through
// WebContentLayerClient::paintContents.
virtual void composite() = 0;
// 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.
virtual void updateAnimations(double frameBeginTime) = 0;
// Relays the end of a fling animation.
virtual void didStopFlinging() { }
......
......@@ -37,44 +37,12 @@ struct WebSize;
class WebLayerTreeViewClient {
public:
// Indicates to the embedder that the compositor is about to begin a
// frame. This is is a signal to flow control mechanisms that a frame is
// beginning. This call will be followed by updateAnimations and then
// layout, which should be used for actual animation or tree manipulation
// tasks. FIXME: make pure virtual once upstream deps are satisfied.
virtual void willBeginFrame() { }
// Indicates that main thread tasks associated with frame rendering have completed.
// Issued unconditionally, even if the context was lost in the process.
virtual void didBeginFrame() { }
// Updates animation and layout. These are called before the compositing
// pass so that layers can be updated at the given frame time.
virtual void updateAnimations(double monotonicFrameBeginTime) = 0;
virtual void layout() = 0;
// Applies a scroll delta to the root layer, which is bundled with a page
// scale factor that may apply a CSS transform on the whole document (used
// for mobile-device pinch zooming). This is triggered by events sent to the
// compositor thread through the WebCompositor interface.
virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) = 0;
// Creates the output surface. This may be called more than once
// if the context gets lost.
virtual WebCompositorOutputSurface* createOutputSurface() { return 0; }
// Signals a successful recreation of the output surface (e.g. after a lost
// 3D context event).
// DEPRECATED - WILL BE REMOVED SOON
virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) { }
virtual void updateAnimations(double frameBeginTime) { }
virtual void didRecreateOutputSurface(bool success) { }
virtual WebInputHandler* createInputHandler() { return 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
// internally schedule a compositing pass when needed.
virtual void scheduleComposite() = 0;
protected:
virtual ~WebLayerTreeViewClient() { }
};
......
2013-03-05 James Robinson <jamesr@chromium.org>
[chromium] Clean up WebWidget / WebLayerTreeView interactions
https://bugs.webkit.org/show_bug.cgi?id=109125
Reviewed by Adrienne Walker.
This removes most of the compositing control flow logic from WebViewImpl since
it is now handled in the embedding layer (by the implementation of WebViewClient/WebWidgetClient).
* public/WebViewClient.h:
* public/WebWidget.h:
(WebKit):
(WebKit::WebWidget::animate):
(WebWidget):
(WebKit::WebWidget::didExitCompositingMode):
(WebKit::WebWidget::createInputHandler):
(WebKit::WebWidget::applyScrollAndScale):
(WebKit::WebWidget::instrumentBeginFrame):
(WebKit::WebWidget::instrumentWillBeginFrame):
(WebKit::WebWidget::instrumentDidCancelFrame):
(WebKit::WebWidget::instrumentDidBeginFrame):
(WebKit::WebWidget::instrumentWillComposite):
* src/WebHelperPluginImpl.cpp:
* src/WebHelperPluginImpl.h:
(WebHelperPluginImpl):
* src/WebPagePopupImpl.cpp:
* src/WebPagePopupImpl.h:
(WebPagePopupImpl):
* src/WebPopupMenuImpl.cpp:
* src/WebPopupMenuImpl.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::instrumentWillBeginFrame):
(WebKit::WebViewImpl::instrumentDidBeginFrame):
(WebKit::WebViewImpl::instrumentDidCancelFrame):
(WebKit::WebViewImpl::instrumentWillComposite):
(WebKit):
(WebKit::WebViewImpl::updateBatteryStatus):
(WebKit::WebViewImpl::animate):
(WebKit::WebViewImpl::didExitCompositingMode):
* src/WebViewImpl.h:
* tests/WebLayerTreeViewTestCommon.h:
(MockWebLayerTreeViewClient):
2013-03-05 Alexei Filippov <alph@chromium.org>
Web Inspector: Add a renderer process memory size test.
......
......@@ -123,11 +123,6 @@ public:
// Create a session storage namespace object associated with this WebView.
virtual WebStorageNamespace* createSessionStorageNamespace(unsigned quota) { return 0; }
// DEPRECATED: Creates a graphics context that renders to the client's WebView.
virtual WebGraphicsContext3D* createGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; }
// Creates the output surface that renders to the client's WebView.
virtual WebCompositorOutputSurface* createOutputSurface() { return 0; }
// Misc ----------------------------------------------------------------
......
......@@ -42,6 +42,7 @@
namespace WebKit {
class WebInputEvent;
class WebInputHandler;
class WebLayerTreeView;
class WebMouseEvent;
class WebString;
......@@ -80,7 +81,7 @@ public:
// Called to update imperative animation state. This should be called before
// paint, although the client can rate-limit these calls.
virtual void animate(double ignored) { }
virtual void animate(double monotonicFrameBeginTime) { }
// Called to layout the WebWidget. This MUST be called before Paint,
// and it may result in calls to WebWidgetClient::didInvalidateRect.
......@@ -90,6 +91,10 @@ public:
// should be called before paint.
virtual void enterForceCompositingMode(bool enter) { }
// Called to notify the WebWidget that the widget has exited compositing
// mode and cannot reenter.
virtual void didExitCompositingMode() { }
enum PaintOptions {
// Attempt to fulfill the painting request by reading back from the
// compositor, assuming we're using a compositor to render.
......@@ -114,16 +119,6 @@ public:
// warranted before painting again).
virtual void paint(WebCanvas*, const WebRect& viewPort, PaintOptions = ReadbackFromCompositorIfAvailable) { }
// In non-threaded compositing mode, triggers compositing of the current
// layers onto the screen. You MUST call Layout before calling this method,
// for the same reasons described in the paint method above
//
// In threaded compositing mode, indicates that the widget should update
// itself, for example due to window damage. The redraw will begin
// asynchronously and perform layout and animation internally. Do not call
// animate or layout in this case.
virtual void composite(bool finish) = 0;
// Returns true if we've started tracking repaint rectangles.
virtual bool isTrackingRepaints() const { return false; }
......@@ -148,6 +143,16 @@ public:
// Check whether the given point hits any registered touch event handlers.
virtual bool hasTouchEventHandlersAt(const WebPoint&) { return true; }
// Request that the WebWidget create an input handler for processing input
// events intended for this widget off of the main thread.
virtual WebInputHandler* createInputHandler() { return 0; }
// Applies a scroll delta to the root layer, which is bundled with a page
// scale factor that may apply a CSS transform on the whole document (used
// for mobile-device pinch zooming). This is triggered by events sent to the
// compositor thread through the WebInputHandler interface.
virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) { }
// Called to inform the WebWidget that mouse capture was lost.
virtual void mouseCaptureLost() { }
......
......@@ -101,9 +101,6 @@ public:
// process.
virtual void didCompleteSwapBuffers() { }
// Called when a call to WebWidget::composite is required
virtual void scheduleComposite() { }
// Called when a call to WebWidget::animate is required
virtual void scheduleAnimation() { }
......
......@@ -215,14 +215,6 @@ void WebHelperPluginImpl::destoryPage()
m_page.clear();
}
void WebHelperPluginImpl::setCompositorSurfaceReady()
{
}
void WebHelperPluginImpl::composite(bool)
{
}
void WebHelperPluginImpl::layout()
{
PageWidgetDelegate::layout(m_page.get());
......
......@@ -67,8 +67,6 @@ private:
void destoryPage();
// WebWidget methods:
virtual void setCompositorSurfaceReady() OVERRIDE;
virtual void composite(bool) OVERRIDE;
virtual void layout() OVERRIDE;
virtual void setFocus(bool) OVERRIDE;
virtual void close() OVERRIDE;
......
......@@ -246,14 +246,6 @@ void WebPagePopupImpl::animate(double)
PageWidgetDelegate::animate(m_page.get(), monotonicallyIncreasingTime());
}
void WebPagePopupImpl::setCompositorSurfaceReady()
{
}
void WebPagePopupImpl::composite(bool)
{
}
void WebPagePopupImpl::layout()
{
PageWidgetDelegate::layout(m_page.get());
......
......@@ -69,8 +69,6 @@ private:
// WebWidget functions
virtual WebSize size() OVERRIDE;
virtual void animate(double) OVERRIDE;
virtual void setCompositorSurfaceReady() OVERRIDE;
virtual void composite(bool) OVERRIDE;
virtual void layout() OVERRIDE;
virtual void paint(WebCanvas*, const WebRect&, PaintOptions = ReadbackFromCompositorIfAvailable) OVERRIDE;
virtual void resize(const WebSize&) OVERRIDE;
......
......@@ -211,16 +211,6 @@ void WebPopupMenuImpl::themeChanged()
notImplemented();
}
void WebPopupMenuImpl::setCompositorSurfaceReady()
{
notImplemented();
}
void WebPopupMenuImpl::composite(bool)
{
notImplemented();
}
bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent)
{
if (!m_widget)
......
......@@ -75,8 +75,6 @@ public:
virtual void layout() OVERRIDE;
virtual void paint(WebCanvas*, const WebRect&, PaintOptions = ReadbackFromCompositorIfAvailable) OVERRIDE;
virtual void themeChanged() OVERRIDE;
virtual void setCompositorSurfaceReady() OVERRIDE;
virtual void composite(bool finish) OVERRIDE;
virtual bool handleInputEvent(const WebInputEvent&) OVERRIDE;
virtual void mouseCaptureLost() OVERRIDE;
virtual void setFocus(bool enable) OVERRIDE;
......
......@@ -1816,28 +1816,11 @@ void WebViewImpl::updateBatteryStatus(const WebBatteryStatus& status)
void WebViewImpl::animate(double monotonicFrameBeginTime)
{
updateAnimations(monotonicFrameBeginTime);
}
void WebViewImpl::willBeginFrame()
{
m_client->willBeginCompositorFrame();
}
TRACE_EVENT0("webkit", "WebViewImpl::animate");
void WebViewImpl::didBeginFrame()
{
if (m_devToolsAgent)
m_devToolsAgent->didComposite();
}
void WebViewImpl::updateAnimations(double monotonicFrameBeginTime)
{
if (!monotonicFrameBeginTime)
monotonicFrameBeginTime = monotonicallyIncreasingTime();
#if ENABLE(REQUEST_ANIMATION_FRAME)
TRACE_EVENT0("webkit", "WebViewImpl::updateAnimations");
// Create synthetic wheel events as necessary for fling.
if (m_gestureAnimation) {
if (m_gestureAnimation->animate(monotonicFrameBeginTime))
......@@ -1854,13 +1837,17 @@ void WebViewImpl::updateAnimations(double monotonicFrameBeginTime)
if (!m_page)
return;
PageWidgetDelegate::animate(m_page.get(), monotonicFrameBeginTime);
if (m_continuousPaintingEnabled) {
ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageOverlays.get());
m_client->scheduleAnimation();
}
}
PageWidgetDelegate::animate(m_page.get(), monotonicFrameBeginTime);
#endif
void WebViewImpl::updateAnimations(double monotonicFrameBeginTime)
{
animate(monotonicFrameBeginTime);
}
void WebViewImpl::layout()
......@@ -1966,21 +1953,6 @@ void WebViewImpl::themeChanged()
view->invalidateRect(damagedRect);
}
void WebViewImpl::composite(bool)
{
#if USE(ACCELERATED_COMPOSITING)
if (Platform::current()->compositorSupport()->isThreadingEnabled())
m_layerTreeView->setNeedsRedraw();
else {
ASSERT(isAcceleratedCompositingActive());
if (!page())
return;
m_layerTreeView->composite();
}
#endif
}
void WebViewImpl::setNeedsRedraw()
{
#if USE(ACCELERATED_COMPOSITING)
......@@ -4207,11 +4179,6 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
#endif
WebCompositorOutputSurface* WebViewImpl::createOutputSurface()
{
return m_client->createOutputSurface();
}
WebInputHandler* WebViewImpl::createInputHandler()
{
WebCompositorInputHandlerImpl* handler = new WebCompositorInputHandlerImpl();
......@@ -4250,28 +4217,24 @@ void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScal
void WebViewImpl::didRecreateOutputSurface(bool success)
{
// Switch back to software rendering mode, if necessary
if (!success) {
ASSERT(m_isAcceleratedCompositingActive);
setIsAcceleratedCompositingActive(false);
m_compositorCreationFailed = true;
m_client->didInvalidateRect(IntRect(0, 0, m_size.width, m_size.height));
if (!success)
didExitCompositingMode();
}
// Force a style recalc to remove all the composited layers.
m_page->mainFrame()->document()->scheduleForcedStyleRecalc();
return;
}
void WebViewImpl::didExitCompositingMode()
{
ASSERT(m_isAcceleratedCompositingActive);
setIsAcceleratedCompositingActive(false);
m_compositorCreationFailed = true;
m_client->didInvalidateRect(IntRect(0, 0, m_size.width, m_size.height));
// Force a style recalc to remove all the composited layers.
m_page->mainFrame()->document()->scheduleForcedStyleRecalc();
if (m_pageOverlays)
m_pageOverlays->update();
}
void WebViewImpl::scheduleComposite()
{
ASSERT(!Platform::current()->compositorSupport()->isThreadingEnabled());
m_client->scheduleComposite();
}
void WebViewImpl::updateLayerTreeViewport()
{
if (!page() || !m_nonCompositedContentHost || !m_layerTreeView)
......
......@@ -144,15 +144,16 @@ public:
virtual void willExitFullScreen();
virtual void didExitFullScreen();
virtual void animate(double);
virtual void layout(); // Also implements WebLayerTreeViewClient::layout()
virtual void layout();
virtual void enterForceCompositingMode(bool enable) OVERRIDE;
virtual void paint(WebCanvas*, const WebRect&, PaintOptions = ReadbackFromCompositorIfAvailable);
virtual bool isTrackingRepaints() const OVERRIDE;
virtual void themeChanged();
virtual void composite(bool finish);
virtual void setNeedsRedraw();
virtual bool handleInputEvent(const WebInputEvent&);
virtual bool hasTouchEventHandlersAt(const WebPoint&);
virtual WebInputHandler* createInputHandler() OVERRIDE;
virtual void applyScrollAndScale(const WebSize&, float);
virtual void mouseCaptureLost();
virtual void setFocus(bool enable);
virtual bool setComposition(
......@@ -181,6 +182,7 @@ public:
virtual void didNotAcquirePointerLock();
virtual void didLosePointerLock();
virtual void didChangeWindowResizerRect();
virtual void didExitCompositingMode();
// WebView methods:
virtual void initializeMainFrame(WebFrameClient*);
......@@ -316,14 +318,8 @@ public:
virtual void setContinuousPaintingEnabled(bool);
// WebLayerTreeViewClient
virtual void willBeginFrame();
virtual void didBeginFrame();
virtual void updateAnimations(double monotonicFrameBeginTime);
virtual void applyScrollAndScale(const WebSize&, float);
virtual WebCompositorOutputSurface* createOutputSurface() OVERRIDE;
virtual void didRecreateOutputSurface(bool success) OVERRIDE;
virtual WebInputHandler* createInputHandler() OVERRIDE;
virtual void scheduleComposite();
virtual void didRecreateOutputSurface(bool success);
// WebViewImpl
......
......@@ -32,9 +32,9 @@
#include "RotateTransformOperation.h"
#include "ScrollableArea.h"
#include "TranslateTransformOperation.h"
#include "WebLayerTreeViewTestCommon.h"
#include <gtest/gtest.h>
#include <public/Platform.h>
#include <public/WebCompositorSupport.h>
#include <public/WebFloatAnimationCurve.h>
#include <public/WebGraphicsContext3D.h>
#include <public/WebLayerTreeView.h>
......@@ -85,7 +85,6 @@ protected:
OwnPtr<GraphicsLayerChromium> m_graphicsLayer;
private:
MockWebLayerTreeViewClient m_layerTreeViewClient;
OwnPtr<WebLayerTreeView> m_layerTreeView;
MockGraphicsLayerClient m_client;
};
......
......@@ -26,7 +26,6 @@
#include "ScrollingCoordinator.h"
#include "CompositorFakeWebGraphicsContext3D.h"
#include "FrameTestHelpers.h"
#include "GraphicsLayerChromium.h"
#include "RenderLayerBacking.h"
......@@ -41,8 +40,8 @@
#include "WebViewImpl.h"
#include <gtest/gtest.h>
#include <public/Platform.h>
#include <public/WebCompositorSupport.h>
#include <public/WebLayer.h>
#include <public/WebLayerTreeView.h>
#include <public/WebUnitTestSupport.h>
using namespace WebCore;
......@@ -52,11 +51,6 @@ namespace {
class FakeWebViewClient : public WebViewClient {
public:
virtual WebCompositorOutputSurface* createOutputSurface() OVERRIDE
{
return Platform::current()->compositorSupport()->createOutputSurfaceFor3D(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).leakPtr());
}
virtual void initializeLayerTreeView(WebLayerTreeViewClient* client, const WebLayer& rootLayer, const WebLayerTreeView::Settings& settings)
{
m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->createLayerTreeViewForTesting(WebUnitTestSupport::TestViewTypeUnitTest));
......@@ -80,9 +74,8 @@ class ScrollingCoordinatorChromiumTest : public testing::Test {
public:
ScrollingCoordinatorChromiumTest()
: m_baseURL("http://www.test.com/")
, m_compositorInitializer(0)
{
Platform::current()->compositorSupport()->initialize(0);
// We cannot reuse FrameTestHelpers::createWebViewAndLoad here because the compositing
// settings need to be set before the page is loaded.
m_webViewImpl = static_cast<WebViewImpl*>(WebView::create(&m_mockWebViewClient));
......@@ -102,8 +95,6 @@ public:
{
Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
m_webViewImpl->close();
Platform::current()->compositorSupport()->shutdown();
}
void navigateTo(const std::string& url)
......@@ -132,6 +123,7 @@ protected:
MockWebFrameClient m_mockWebFrameClient;
FakeWebViewClient m_mockWebViewClient;
WebViewImpl* m_webViewImpl;
WebKitTests::WebCompositorInitializer m_compositorInitializer;
};
TEST_F(ScrollingCoordinatorChromiumTest, fastScrollingByDefault)
......
/*
* 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 WebLayerTreeViewTestCommon_h
#define WebLayerTreeViewTestCommon_h
#include "CompositorFakeWebGraphicsContext3D.h"
#include <gmock/gmock.h>
#include <public/Platform.h>
#include <public/WebCompositorSupport.h>
#include <public/WebLayerTreeViewClient.h>
namespace WebKit {
class MockWebLayerTreeViewClient : public WebLayerTreeViewClient {
public:
MOCK_METHOD0(scheduleComposite, void());
virtual void updateAnimations(double frameBeginTime) OVERRIDE { }
MOCK_METHOD0(willBeginFrame, void());
MOCK_METHOD0(didBeginFrame, void());
virtual void layout() OVERRIDE { }
virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) OVERRIDE { }
virtual WebCompositorOutputSurface* createOutputSurface() OVERRIDE
{
return Platform::current()->compositorSupport()->createOutputSurfaceFor3D(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).leakPtr());
}
virtual void didRecreateOutputSurface(bool) OVERRIDE { }
};
}
#endif // WebLayerTreeViewTestCommon_h
......@@ -202,6 +202,9 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
// Pending task list, Note taht the method is referred from WebMethodTask class.
WebTestRunner::WebTaskList* taskList() { return &m_taskList; }
// Exposed for WebTestProxy.
void scheduleComposite() { }
private:
class HostMethodTask : public WebTestRunner::WebMethodTask<WebViewHost> {
......
Markdown is supported