Chromium Code Reviews| Index: cc/single_thread_proxy.cc |
| diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc |
| index 3d223a073b2726bfbea3bb65d4fc73f933a03e92..7c7b3fbbf6be96878608ed7f0264c627da3cf910 100644 |
| --- a/cc/single_thread_proxy.cc |
| +++ b/cc/single_thread_proxy.cc |
| @@ -13,6 +13,7 @@ |
| #include "cc/prioritized_resource_manager.h" |
| #include "cc/resource_update_controller.h" |
| #include "cc/thread.h" |
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h" |
| namespace cc { |
| @@ -139,6 +140,18 @@ bool SingleThreadProxy::recreateOutputSurface() |
| scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->createOutputSurface(); |
| if (!outputSurface.get()) |
| return false; |
| + WebKit::WebGraphicsContext3D* offscreenContext3d = NULL; |
| + GrContext* offscreenGrContext = NULL; |
| + if (m_layerTreeHost->needsOffscreenContext()) { |
| + offscreenContext3d = m_layerTreeHost->client()->createOrGetOffscreenContext3dForMainThread(); |
| + if (!offscreenContext3d || |
| + !offscreenContext3d->makeContextCurrent() || |
| + offscreenContext3d->getGraphicsResetStatusARB()) |
| + { |
|
piman
2013/02/05 22:42:48
nit: { on previous line
danakj
2013/02/05 22:56:00
Oh gosh this file has become a frankenstyle. :X
|
| + return false; |
| + } |
| + offscreenGrContext = m_layerTreeHost->client()->createOrGetOffscreenGrContextForMainThread(); |
| + } |
| bool initialized; |
| { |
| @@ -148,6 +161,8 @@ bool SingleThreadProxy::recreateOutputSurface() |
| initialized = m_layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); |
| if (initialized) { |
| m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities(); |
| + m_layerTreeHostImpl->resourceProvider()->setOffscreenContexts( |
| + offscreenContext3d, offscreenGrContext); |
| } |
| } |
| @@ -368,6 +383,13 @@ bool SingleThreadProxy::commitAndComposite() |
| if (!m_layerTreeHost->initializeRendererIfNeeded()) |
| return false; |
| + WebKit::WebGraphicsContext3D* offscreenContext3d = NULL; |
| + GrContext* offscreenGrContext = NULL; |
| + if (m_layerTreeHost->needsOffscreenContext()) { |
| + offscreenContext3d = m_layerTreeHost->client()->createOrGetOffscreenContext3dForMainThread(); |
| + offscreenGrContext = m_layerTreeHost->client()->createOrGetOffscreenGrContextForMainThread(); |
| + } |
| + |
| m_layerTreeHost->contentsTextureManager()->unlinkAndClearEvictedBackings(); |
| scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQueue); |
| @@ -375,18 +397,21 @@ bool SingleThreadProxy::commitAndComposite() |
| m_layerTreeHost->willCommit(); |
| doCommit(queue.Pass()); |
| - bool result = doComposite(); |
| + bool result = doComposite(offscreenContext3d, offscreenGrContext); |
| m_layerTreeHost->didBeginFrame(); |
| return result; |
| } |
| -bool SingleThreadProxy::doComposite() |
| + bool SingleThreadProxy::doComposite(WebKit::WebGraphicsContext3D* offscreenContext3d, GrContext* offscreenGrContext) |
| { |
| DCHECK(!m_outputSurfaceLost); |
| { |
| DebugScopedSetImplThread impl(this); |
| base::AutoReset<bool> markInside(&m_insideDraw, true); |
| + m_layerTreeHostImpl->resourceProvider()->setOffscreenContexts( |
| + offscreenContext3d, offscreenGrContext); |
| + |
| if (!m_layerTreeHostImpl->visible()) |
| return false; |