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

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: 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 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;

Powered by Google App Engine
This is Rietveld 408576698