| Index: cc/thread_proxy.cc
|
| diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc
|
| index adb9d016d020f8acb2c046493c0daf03fb706fc4..7d36cbb84c210751d72056b7cb4f0f08e44fcf72 100644
|
| --- a/cc/thread_proxy.cc
|
| +++ b/cc/thread_proxy.cc
|
| @@ -17,9 +17,7 @@
|
| #include "cc/prioritized_resource_manager.h"
|
| #include "cc/scheduler.h"
|
| #include "cc/thread.h"
|
| -#include "third_party/WebKit/Source/Platform/chromium/public/WebSharedGraphicsContext3D.h"
|
| -
|
| -using WebKit::WebSharedGraphicsContext3D;
|
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
|
|
|
| namespace {
|
|
|
| @@ -228,9 +226,14 @@ bool ThreadProxy::recreateOutputSurface()
|
| scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->createOutputSurface();
|
| if (!outputSurface.get())
|
| return false;
|
| - if (m_layerTreeHost->needsSharedContext())
|
| - if (!WebSharedGraphicsContext3D::createCompositorThreadContext())
|
| + WebKit::WebGraphicsContext3D* offscreenContext3d = NULL;
|
| + GrContext* offscreenGrContext = NULL;
|
| + if (m_RendererCapabilitiesMainThreadCopy.usingOffscreenContext3d && m_layerTreeHost->needsOffscreenContext()) {
|
| + offscreenContext3d = m_layerTreeHost->client()->offscreenContext3dForCompositorThread();
|
| + if (!offscreenContext3d || !offscreenContext3d->makeContextCurrent())
|
| return false;
|
| + offscreenGrContext = m_layerTreeHost->client()->offscreenGrContextForCompositorThread();
|
| + }
|
|
|
| // Make a blocking call to recreateOutputSurfaceOnImplThread. The results of that
|
| // call are pushed into the recreateSucceeded and capabilities local
|
| @@ -243,6 +246,8 @@ bool ThreadProxy::recreateOutputSurface()
|
| m_implThreadWeakPtr,
|
| &completion,
|
| base::Passed(&outputSurface),
|
| + offscreenContext3d,
|
| + offscreenGrContext,
|
| &recreateSucceeded,
|
| &capabilities));
|
| completion.wait();
|
| @@ -599,9 +604,6 @@ void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat
|
| return;
|
| }
|
|
|
| - if (m_layerTreeHost->needsSharedContext() && !WebSharedGraphicsContext3D::haveCompositorThreadContext())
|
| - WebSharedGraphicsContext3D::createCompositorThreadContext();
|
| -
|
| // Do not notify the impl thread of commit requests that occur during
|
| // the apply/animate/layout part of the beginFrameAndCommit process since
|
| // those commit requests will get painted immediately. Once we have done
|
| @@ -671,6 +673,13 @@ void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat
|
| setNeedsAnimate();
|
| }
|
|
|
| + WebKit::WebGraphicsContext3D* offscreenContext3d = NULL;
|
| + GrContext* offscreenGrContext = NULL;
|
| + if (m_RendererCapabilitiesMainThreadCopy.usingOffscreenContext3d && m_layerTreeHost->needsOffscreenContext()) {
|
| + offscreenContext3d = m_layerTreeHost->client()->offscreenContext3dForCompositorThread();
|
| + offscreenGrContext = m_layerTreeHost->client()->offscreenGrContextForCompositorThread();
|
| + }
|
| +
|
| // Notify the impl thread that the beginFrame has completed. This will
|
| // begin the commit process, which is blocking from the main thread's
|
| // point of view, but asynchronously performed on the impl thread,
|
| @@ -682,7 +691,7 @@ void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat
|
|
|
| base::TimeTicks startTime = base::TimeTicks::HighResNow();
|
| CompletionEvent completion;
|
| - Proxy::implThread()->postTask(base::Bind(&ThreadProxy::beginFrameCompleteOnImplThread, m_implThreadWeakPtr, &completion, queue.release()));
|
| + Proxy::implThread()->postTask(base::Bind(&ThreadProxy::beginFrameCompleteOnImplThread, m_implThreadWeakPtr, &completion, queue.release(), offscreenContext3d, offscreenGrContext));
|
| completion.wait();
|
| base::TimeTicks endTime = base::TimeTicks::HighResNow();
|
|
|
| @@ -694,7 +703,7 @@ void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat
|
| m_layerTreeHost->didBeginFrame();
|
| }
|
|
|
| -void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, ResourceUpdateQueue* rawQueue)
|
| +void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, ResourceUpdateQueue* rawQueue, WebKit::WebGraphicsContext3D* offscreenContext3d, GrContext* offscreenGrContext)
|
| {
|
| scoped_ptr<ResourceUpdateQueue> queue(rawQueue);
|
|
|
| @@ -710,6 +719,8 @@ void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, Re
|
| return;
|
| }
|
|
|
| + m_layerTreeHostImpl->resourceProvider()->setGaneshContexts(offscreenContext3d, offscreenGrContext);
|
| +
|
| if (m_layerTreeHost->contentsTextureManager()->linkedEvictedBackingsExist()) {
|
| // Clear any uploads we were making to textures linked to evicted
|
| // resources
|
| @@ -721,7 +732,7 @@ void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, Re
|
|
|
| m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackings();
|
|
|
| - m_currentResourceUpdateControllerOnImplThread = ResourceUpdateController::create(this, Proxy::implThread(), queue.Pass(), m_layerTreeHostImpl->resourceProvider(), hasImplThread());
|
| + m_currentResourceUpdateControllerOnImplThread = ResourceUpdateController::create(this, Proxy::implThread(), queue.Pass(), m_layerTreeHostImpl->resourceProvider());
|
| m_currentResourceUpdateControllerOnImplThread->performMoreUpdates(
|
| m_schedulerOnImplThread->anticipatedDrawTime());
|
|
|
| @@ -1059,7 +1070,7 @@ size_t ThreadProxy::maxPartialTextureUpdates() const
|
| return ResourceUpdateController::maxPartialTextureUpdates();
|
| }
|
|
|
| -void ThreadProxy::recreateOutputSurfaceOnImplThread(CompletionEvent* completion, scoped_ptr<OutputSurface> outputSurface, bool* recreateSucceeded, RendererCapabilities* capabilities)
|
| +void ThreadProxy::recreateOutputSurfaceOnImplThread(CompletionEvent* completion, scoped_ptr<OutputSurface> outputSurface, WebKit::WebGraphicsContext3D* offscreenContext3d, GrContext* offscreenGrContext, bool* recreateSucceeded, RendererCapabilities* capabilities)
|
| {
|
| TRACE_EVENT0("cc", "ThreadProxy::recreateOutputSurfaceOnImplThread");
|
| DCHECK(isImplThread());
|
| @@ -1067,6 +1078,7 @@ void ThreadProxy::recreateOutputSurfaceOnImplThread(CompletionEvent* completion,
|
| *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
|
| if (*recreateSucceeded) {
|
| *capabilities = m_layerTreeHostImpl->rendererCapabilities();
|
| + m_layerTreeHostImpl->resourceProvider()->setGaneshContexts(offscreenContext3d, offscreenGrContext);
|
| m_schedulerOnImplThread->didRecreateOutputSurface();
|
| }
|
| completion->signal();
|
|
|