summaryrefslogtreecommitdiffstats
path: root/cc/layer_tree_host_impl.cc
diff options
context:
space:
mode:
authoraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-04 03:25:55 +0000
committeraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-04 03:25:55 +0000
commitdb79992121c7627abc0855e655d91470ee3ac3ac (patch)
treec9e8cc8541c775dbe600fb299b56fb37b9e05227 /cc/layer_tree_host_impl.cc
parent8311a2b8ceea50b6bcd923cd709949cc082b865d (diff)
downloadchromium_src-db79992121c7627abc0855e655d91470ee3ac3ac.zip
chromium_src-db79992121c7627abc0855e655d91470ee3ac3ac.tar.gz
chromium_src-db79992121c7627abc0855e655d91470ee3ac3ac.tar.bz2
Remove static thread pointers from CC, attempt 2
BUG=152904 Review URL: https://chromiumcodereview.appspot.com/11232051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layer_tree_host_impl.cc')
-rw-r--r--cc/layer_tree_host_impl.cc27
1 files changed, 19 insertions, 8 deletions
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 73568ff..20606af 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -197,13 +197,14 @@ LayerTreeHostImpl::FrameData::~FrameData()
{
}
-scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::create(const LayerTreeSettings& settings, LayerTreeHostImplClient* client)
+scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::create(const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy)
{
- return make_scoped_ptr(new LayerTreeHostImpl(settings, client));
+ return make_scoped_ptr(new LayerTreeHostImpl(settings, client, proxy));
}
-LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTreeHostImplClient* client)
+LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy)
: m_client(client)
+ , m_proxy(proxy)
, m_sourceFrameNumber(-1)
, m_rootScrollLayerImpl(0)
, m_currentlyScrollingLayerImpl(0)
@@ -222,18 +223,18 @@ LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre
, m_hasTransparentBackground(false)
, m_needsAnimateLayers(false)
, m_pinchGestureActive(false)
- , m_fpsCounter(FrameRateCounter::create())
+ , m_fpsCounter(FrameRateCounter::create(m_proxy->hasImplThread()))
, m_debugRectHistory(DebugRectHistory::create())
, m_numImplThreadScrolls(0)
, m_numMainThreadScrolls(0)
{
- DCHECK(Proxy::isImplThread());
+ DCHECK(m_proxy->isImplThread());
didVisibilityChange(this, m_visible);
}
LayerTreeHostImpl::~LayerTreeHostImpl()
{
- DCHECK(Proxy::isImplThread());
+ DCHECK(m_proxy->isImplThread());
TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()");
if (m_rootLayerImpl)
@@ -500,7 +501,7 @@ void LayerTreeHostImpl::setBackgroundTickingEnabled(bool enabled)
{
// Lazily create the timeSource adapter so that we can vary the interval for testing.
if (!m_timeSourceClientAdapter)
- m_timeSourceClientAdapter = LayerTreeHostImplTimeSourceAdapter::create(this, DelayBasedTimeSource::create(lowFrequencyAnimationInterval(), Proxy::currentThread()));
+ m_timeSourceClientAdapter = LayerTreeHostImplTimeSourceAdapter::create(this, DelayBasedTimeSource::create(lowFrequencyAnimationInterval(), m_proxy->currentThread()));
m_timeSourceClientAdapter->setActive(enabled);
}
@@ -645,10 +646,20 @@ void LayerTreeHostImpl::enforceManagedMemoryPolicy(const ManagedMemoryPolicy& po
m_client->sendManagedMemoryStats();
}
+bool LayerTreeHostImpl::hasImplThread() const
+{
+ return m_proxy->hasImplThread();
+}
+
void LayerTreeHostImpl::setManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
{
if (m_managedMemoryPolicy == policy)
return;
+
+ // FIXME: In single-thread mode, this can be called on the main thread
+ // by GLRenderer::onMemoryAllocationChanged.
+ DebugScopedSetImplThread implThread(m_proxy);
+
m_managedMemoryPolicy = policy;
enforceManagedMemoryPolicy(m_managedMemoryPolicy);
// We always need to commit after changing the memory policy because the new
@@ -815,7 +826,7 @@ scoped_ptr<LayerImpl> LayerTreeHostImpl::detachLayerTree()
void LayerTreeHostImpl::setVisible(bool visible)
{
- DCHECK(Proxy::isImplThread());
+ DCHECK(m_proxy->isImplThread());
if (m_visible == visible)
return;