WebLayerTreeViewImpl.cpp [plain text]
#include "config.h"
#include "WebLayerTreeViewImpl.h"
#include "CCThreadImpl.h"
#include "GraphicsContext3DPrivate.h"
#include "LayerChromium.h"
#include "cc/CCThreadProxy.h"
#include "platform/WebGraphicsContext3D.h"
#include "platform/WebLayer.h"
#include "platform/WebLayerTreeView.h"
#include "platform/WebLayerTreeViewClient.h"
#include "platform/WebSize.h"
#include "platform/WebThread.h"
using namespace WebCore;
namespace WebKit {
PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
{
OwnPtr<WebLayerTreeViewImpl> host = adoptPtr(new WebLayerTreeViewImpl(client, settings));
if (!host->initialize())
return nullptr;
host->setRootLayer(root);
return host.release();
}
WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client, const WebLayerTreeView::Settings& settings)
: CCLayerTreeHost(this, settings)
, m_client(client)
{
}
WebLayerTreeViewImpl::~WebLayerTreeViewImpl()
{
}
void WebLayerTreeViewImpl::willBeginFrame()
{
m_client->willBeginFrame();
}
void WebLayerTreeViewImpl::updateAnimations(double monotonicFrameBeginTime)
{
m_client->updateAnimations(monotonicFrameBeginTime);
}
void WebLayerTreeViewImpl::layout()
{
m_client->layout();
}
void WebLayerTreeViewImpl::applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale)
{
m_client->applyScrollAndScale(WebSize(scrollDelta), pageScale);
}
PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createContext()
{
OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(m_client->createContext3D());
if (!webContext)
return 0;
return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow, false );
}
void WebLayerTreeViewImpl::didRecreateContext(bool success)
{
m_client->didRebindGraphicsContext(success);
}
void WebLayerTreeViewImpl::didCommit()
{
m_client->didCommit();
}
void WebLayerTreeViewImpl::didCommitAndDrawFrame()
{
m_client->didCommitAndDrawFrame();
}
void WebLayerTreeViewImpl::didCompleteSwapBuffers()
{
m_client->didCompleteSwapBuffers();
}
void WebLayerTreeViewImpl::scheduleComposite()
{
m_client->scheduleComposite();
}
}