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

Unified Diff: cc/single_thread_proxy.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address code review comments and fix all cc_unittests 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/single_thread_proxy.cc
diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc
index 30d88ba74dba5c95835ee18681828fe73b9ec44d..dde8dcd15832ef9cc3fcfa3252c2914d27ea4e18 100644
--- a/cc/single_thread_proxy.cc
+++ b/cc/single_thread_proxy.cc
@@ -22,7 +22,8 @@ scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost)
}
SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layerTreeHost)
- : m_layerTreeHost(layerTreeHost)
+ : Proxy(0)
+ , m_layerTreeHost(layerTreeHost)
, m_contextLost(false)
, m_rendererInitialized(false)
, m_nextFrameIsNewlyCommittedFrame(false)
@@ -34,7 +35,7 @@ SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layerTreeHost)
void SingleThreadProxy::start()
{
- DebugScopedSetImplThread impl;
+ DebugScopedSetImplThread impl(this);
m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this);
}
@@ -73,7 +74,7 @@ void SingleThreadProxy::finishAllRendering()
{
DCHECK(Proxy::isMainThread());
{
- DebugScopedSetImplThread impl;
+ DebugScopedSetImplThread impl(this);
m_layerTreeHostImpl->finishAllRendering();
}
}
@@ -101,7 +102,7 @@ void SingleThreadProxy::setSurfaceReady()
void SingleThreadProxy::setVisible(bool visible)
{
- DebugScopedSetImplThread impl;
+ DebugScopedSetImplThread impl(this);
m_layerTreeHostImpl->setVisible(visible);
}
@@ -110,7 +111,7 @@ bool SingleThreadProxy::initializeRenderer()
DCHECK(Proxy::isMainThread());
DCHECK(m_contextBeforeInitialization.get());
{
- DebugScopedSetImplThread impl;
+ DebugScopedSetImplThread impl(this);
bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitialization.Pass());
if (ok) {
m_rendererInitialized = true;
@@ -133,8 +134,8 @@ bool SingleThreadProxy::recreateContext()
bool initialized;
{
- DebugScopedSetMainThreadBlocked mainThreadBlocked;
- DebugScopedSetImplThread impl;
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this);
+ DebugScopedSetImplThread impl(this);
if (!m_layerTreeHostImpl->contentsTexturesPurged())
m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
initialized = m_layerTreeHostImpl->initializeRenderer(context.Pass());
@@ -181,8 +182,8 @@ void SingleThreadProxy::doCommit(scoped_ptr<TextureUpdateQueue> queue)
DCHECK(Proxy::isMainThread());
// Commit immediately
{
- DebugScopedSetMainThreadBlocked mainThreadBlocked;
- DebugScopedSetImplThread impl;
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this);
+ DebugScopedSetImplThread impl(this);
base::TimeTicks startTime = base::TimeTicks::HighResNow();
m_layerTreeHostImpl->beginCommit();
@@ -195,7 +196,8 @@ void SingleThreadProxy::doCommit(scoped_ptr<TextureUpdateQueue> queue)
NULL,
Proxy::mainThread(),
queue.Pass(),
- m_layerTreeHostImpl->resourceProvider());
+ m_layerTreeHostImpl->resourceProvider(),
+ hasImplThread());
updateController->finalize();
m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get());
@@ -250,8 +252,8 @@ void SingleThreadProxy::stop()
TRACE_EVENT0("cc", "SingleThreadProxy::stop");
DCHECK(Proxy::isMainThread());
{
- DebugScopedSetMainThreadBlocked mainThreadBlocked;
- DebugScopedSetImplThread impl;
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this);
+ DebugScopedSetImplThread impl(this);
if (!m_layerTreeHostImpl->contentsTexturesPurged())
m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
@@ -273,7 +275,7 @@ void SingleThreadProxy::setNeedsCommitOnImplThread()
void SingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector> events, double wallClockTime)
{
DCHECK(Proxy::isImplThread());
- DebugScopedSetMainThread main;
+ DebugScopedSetMainThread main(this);
m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime);
}
@@ -298,7 +300,7 @@ void SingleThreadProxy::compositeImmediately()
void SingleThreadProxy::forceSerializeOnSwapBuffers()
{
{
- DebugScopedSetImplThread impl;
+ DebugScopedSetImplThread impl(this);
if (m_rendererInitialized)
m_layerTreeHostImpl->renderer()->doNoOp();
}
@@ -319,7 +321,7 @@ bool SingleThreadProxy::commitAndComposite()
// Unlink any texture backings that were deleted
PrioritizedTextureManager::BackingList evictedContentsTexturesBackings;
{
- DebugScopedSetImplThread implThread;
+ DebugScopedSetImplThread impl(this);
m_layerTreeHost->contentsTextureManager()->getEvictedBackings(evictedContentsTexturesBackings);
}
m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(evictedContentsTexturesBackings);
@@ -341,7 +343,7 @@ bool SingleThreadProxy::doComposite()
{
DCHECK(!m_contextLost);
{
- DebugScopedSetImplThread impl;
+ DebugScopedSetImplThread impl(this);
if (!m_layerTreeHostImpl->visible())
return false;

Powered by Google App Engine
This is Rietveld 408576698