Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Unified Diff: cc/single_thread_proxy.cc

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restart with GrContext owned in cc Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/single_thread_proxy.cc
diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc
index 40b7ad2019677ff864d42c238e8f7b056bc63b71..39d5ea021a00d49f281e2ab770d41834adcccf54 100644
--- a/cc/single_thread_proxy.cc
+++ b/cc/single_thread_proxy.cc
@@ -139,6 +139,12 @@ bool SingleThreadProxy::recreateOutputSurface()
scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->createOutputSurface();
if (!outputSurface.get())
return false;
+ WebKit::WebGraphicsContext3D* offscreenContext3d = NULL;
+ if (m_RendererCapabilitiesForMainThread.usingOffscreenContext3d && m_layerTreeHost->needsOffscreenContext()) {
+ offscreenContext3d = m_layerTreeHost->client()->OffscreenContext3dForMainThread();
+ if (!offscreenContext3d)
+ return false;
+ }
bool initialized;
{
@@ -148,6 +154,7 @@ bool SingleThreadProxy::recreateOutputSurface()
initialized = m_layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
if (initialized) {
m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities();
+ m_layerTreeHostImpl->resourceProvider()->setContext3dForGrContext(offscreenContext3d);
}
}
@@ -196,8 +203,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 +374,11 @@ bool SingleThreadProxy::commitAndComposite()
if (!m_layerTreeHost->initializeRendererIfNeeded())
return false;
+ WebKit::WebGraphicsContext3D* offscreenContext3d = NULL;
+ if (m_RendererCapabilitiesForMainThread.usingOffscreenContext3d && m_layerTreeHost->needsOffscreenContext()) {
+ offscreenContext3d = m_layerTreeHost->client()->OffscreenContext3dForMainThread();
+ }
+
m_layerTreeHost->contentsTextureManager()->unlinkAndClearEvictedBackings();
scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQueue);
@@ -375,18 +386,20 @@ bool SingleThreadProxy::commitAndComposite()
m_layerTreeHost->willCommit();
doCommit(queue.Pass());
- bool result = doComposite();
+ bool result = doComposite(offscreenContext3d);
m_layerTreeHost->didBeginFrame();
return result;
}
-bool SingleThreadProxy::doComposite()
+ bool SingleThreadProxy::doComposite(WebKit::WebGraphicsContext3D* offscreenContext3d)
{
DCHECK(!m_outputSurfaceLost);
{
DebugScopedSetImplThread impl(this);
base::AutoReset<bool> markInside(&m_insideDraw, true);
+ m_layerTreeHostImpl->resourceProvider()->setContext3dForGrContext(offscreenContext3d);
+
if (!m_layerTreeHostImpl->visible())
return false;

Powered by Google App Engine
This is Rietveld 408576698