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

Unified Diff: cc/layer_tree_host.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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/layer_tree_host.cc
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index c6d3003279fe669bbd01f13c33a3db5e99ef2f29..46776213d42535e5e2c3fb40b0879e29818fe3e6 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -82,10 +82,10 @@ bool CCLayerTreeHost::anyLayerTreeHostInstanceExists()
return numLayerTreeInstances > 0;
}
-scoped_ptr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, const CCLayerTreeSettings& settings)
+scoped_ptr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, const CCLayerTreeSettings& settings, CompositorSupportState* compositorSupportState)
{
scoped_ptr<CCLayerTreeHost> layerTreeHost(new CCLayerTreeHost(client, settings));
- if (!layerTreeHost->initialize())
+ if (!layerTreeHost->initialize(compositorSupportState))
return scoped_ptr<CCLayerTreeHost>();
return layerTreeHost.Pass();
}
@@ -111,18 +111,17 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTre
, m_hasTransparentBackground(false)
, m_partialTextureUpdateRequests(0)
{
- DCHECK(CCProxy::isMainThread());
numLayerTreeInstances++;
}
-bool CCLayerTreeHost::initialize()
+bool CCLayerTreeHost::initialize(CompositorSupportState* compositorSupportState)
{
TRACE_EVENT0("cc", "CCLayerTreeHost::initialize");
- if (CCProxy::hasImplThread())
- m_proxy = CCThreadProxy::create(this);
+ if (compositorThread)
jamesr 2012/10/22 22:00:36 i can't tell where this bool is coming from
+ m_proxy = CCThreadProxy::create(this, compositorSupportState);
else
- m_proxy = CCSingleThreadProxy::create(this);
+ m_proxy = CCSingleThreadProxy::create(this); // TODO
m_proxy->start();
return m_proxy->initializeContext();
@@ -132,7 +131,7 @@ CCLayerTreeHost::~CCLayerTreeHost()
{
if (m_rootLayer)
m_rootLayer->setLayerTreeHost(0);
- DCHECK(CCProxy::isMainThread());
+ DCHECK(m_proxy->isMainThread());
TRACE_EVENT0("cc", "CCLayerTreeHost::~CCLayerTreeHost");
DCHECK(m_proxy.get());
m_proxy->stop();
@@ -163,7 +162,7 @@ void CCLayerTreeHost::initializeRenderer()
// Update m_settings based on partial update capability.
m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates());
- m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, CCRenderer::ContentPool);
+ m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, CCRenderer::ContentPool, m_proxy.get());
m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GL_RGBA);
m_rendererInitialized = true;
@@ -198,7 +197,7 @@ CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext()
// FIXME: The single thread does not self-schedule context
// recreation. So force another recreation attempt to happen by requesting
// another commit.
- if (!CCProxy::hasImplThread())
+ if (!m_proxy->hasImplThread())
setNeedsCommit();
return RecreateFailedButTryAgain;
}
@@ -211,14 +210,14 @@ CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext()
void CCLayerTreeHost::deleteContentsTexturesOnImplThread(CCResourceProvider* resourceProvider)
{
- DCHECK(CCProxy::isImplThread());
+ DCHECK(m_proxy->isImplThread());
if (m_rendererInitialized)
m_contentsTextureManager->clearAllMemory(resourceProvider);
}
void CCLayerTreeHost::acquireLayerTextures()
{
- DCHECK(CCProxy::isMainThread());
+ DCHECK(m_proxy->isMainThread());
m_proxy->acquireLayerTextures();
}
@@ -239,7 +238,7 @@ void CCLayerTreeHost::layout()
void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl)
{
- DCHECK(CCProxy::isImplThread());
+ DCHECK(m_proxy->isImplThread());
TRACE_EVENT0("cc", "CCLayerTreeHost::commitTo");
}
@@ -250,7 +249,7 @@ void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl)
// after the commit, but on the main thread.
void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl)
{
- DCHECK(CCProxy::isImplThread());
+ DCHECK(m_proxy->isImplThread());
m_contentsTextureManager->updateBackingsInDrawingImplTree();
m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider());
@@ -322,7 +321,7 @@ scoped_ptr<CCLayerTreeHostImpl> CCLayerTreeHost::createLayerTreeHostImpl(CCLayer
void CCLayerTreeHost::didLoseContext()
{
TRACE_EVENT0("cc", "CCLayerTreeHost::didLoseContext");
- DCHECK(CCProxy::isMainThread());
+ DCHECK(m_proxy->isMainThread());
m_contextLost = true;
m_numFailedRecreateAttempts = 0;
setNeedsCommit();
@@ -356,7 +355,7 @@ const RendererCapabilities& CCLayerTreeHost::rendererCapabilities() const
void CCLayerTreeHost::setNeedsAnimate()
{
- DCHECK(CCProxy::hasImplThread());
+ DCHECK(m_proxy->hasImplThread());
m_proxy->setNeedsAnimate();
}
@@ -368,7 +367,7 @@ void CCLayerTreeHost::setNeedsCommit()
void CCLayerTreeHost::setNeedsRedraw()
{
m_proxy->setNeedsRedraw();
- if (!CCThreadProxy::implThread())
+ if (!m_proxy->implThread())
m_client->scheduleComposite();
}
@@ -379,7 +378,7 @@ bool CCLayerTreeHost::commitRequested() const
void CCLayerTreeHost::setAnimationEvents(scoped_ptr<CCAnimationEventsVector> events, double wallClockTime)
{
- DCHECK(CCThreadProxy::isMainThread());
+ DCHECK(m_proxy->isMainThread());
setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime);
}
@@ -455,7 +454,7 @@ CCPrioritizedTextureManager* CCLayerTreeHost::contentsTextureManager() const
void CCLayerTreeHost::composite()
{
- DCHECK(!CCThreadProxy::implThread());
+ DCHECK(!m_proxy->implThread());
static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately();
}
@@ -725,7 +724,7 @@ void CCLayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context)
if (it != m_rateLimiters.end())
it->second->start();
else {
- scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, this);
+ scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, this, m_proxy.get());
m_rateLimiters[context] = rateLimiter;
rateLimiter->start();
}

Powered by Google App Engine
This is Rietveld 408576698