Chromium Code Reviews| Index: cc/single_thread_proxy.cc |
| diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc |
| index 40b7ad2019677ff864d42c238e8f7b056bc63b71..d28416cedac6ae8a513d59e896c27ff851ee8e94 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,14 @@ bool SingleThreadProxy::recreateOutputSurface() |
| scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->createOutputSurface(); |
| if (!outputSurface.get()) |
| return false; |
| + WebKit::WebGraphicsContext3D* offscreenContext3d = NULL; |
| + GrContext* offscreenGrContext = NULL; |
| + if (m_RendererCapabilitiesForMainThread.usingOffscreenContext3d && m_layerTreeHost->needsOffscreenContext()) { |
| + offscreenContext3d = m_layerTreeHost->client()->OffscreenContext3dForMainThread(); |
|
piman
2013/02/11 18:45:33
ForCompositorThread, no?
danakj
2013/02/11 18:58:13
No, this is single thread proxy, so it wants the m
|
| + if (!offscreenContext3d || !offscreenContext3d->makeContextCurrent()) |
| + return false; |
| + offscreenGrContext = m_layerTreeHost->client()->OffscreenGrContextForMainThread(); |
| + } |
| bool initialized; |
| { |
| @@ -148,6 +157,7 @@ bool SingleThreadProxy::recreateOutputSurface() |
| initialized = m_layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); |
| if (initialized) { |
| m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities(); |
| + m_layerTreeHostImpl->resourceProvider()->setGaneshContexts(offscreenContext3d, offscreenGrContext); |
| } |
| } |
| @@ -196,8 +206,7 @@ void SingleThreadProxy::doCommit(scoped_ptr<ResourceUpdateQueue> queue) |
| NULL, |
| Proxy::mainThread(), |
| queue.Pass(), |
| - m_layerTreeHostImpl->resourceProvider(), |
| - hasImplThread()); |
| + m_layerTreeHostImpl->resourceProvider()); |
| updateController->finalize(); |
| m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); |
| @@ -368,6 +377,13 @@ bool SingleThreadProxy::commitAndComposite() |
| if (!m_layerTreeHost->initializeRendererIfNeeded()) |
| return false; |
| + WebKit::WebGraphicsContext3D* offscreenContext3d = NULL; |
| + GrContext* offscreenGrContext = NULL; |
| + if (m_RendererCapabilitiesForMainThread.usingOffscreenContext3d && m_layerTreeHost->needsOffscreenContext()) { |
| + offscreenContext3d = m_layerTreeHost->client()->OffscreenContext3dForMainThread(); |
| + offscreenGrContext = m_layerTreeHost->client()->OffscreenGrContextForMainThread(); |
| + } |
| + |
| m_layerTreeHost->contentsTextureManager()->unlinkAndClearEvictedBackings(); |
| scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQueue); |
| @@ -375,18 +391,20 @@ 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()->setGaneshContexts(offscreenContext3d, offscreenGrContext); |
| + |
| if (!m_layerTreeHostImpl->visible()) |
| return false; |