Chromium Code Reviews| Index: cc/layer_tree_host.cc |
| diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc |
| index ebc998ed856ed26077d979a67eb4c0e403b75039..1323ce7d97f2a41c101bb1eee2dbfb214dbbaa7b 100644 |
| --- a/cc/layer_tree_host.cc |
| +++ b/cc/layer_tree_host.cc |
| @@ -110,6 +110,7 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting |
| , m_backgroundColor(SK_ColorWHITE) |
| , m_hasTransparentBackground(false) |
| , m_partialTextureUpdateRequests(0) |
| + , m_deferCommits(false) |
|
jamesr
2012/10/23 17:50:44
There's no reason to shadow state here on LayerTre
jonathan.backer
2012/10/23 19:26:42
Done.
|
| { |
| DCHECK(Proxy::isMainThread()); |
| numLayerTreeInstances++; |
| @@ -330,6 +331,9 @@ void LayerTreeHost::didLoseContext() |
| bool LayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) |
| { |
| + // Clear any pending commits. |
| + setDeferCommits(false); |
|
jamesr
2012/10/23 17:50:44
This doesn't look right at all - what this will do
jonathan.backer
2012/10/23 19:26:42
We're more than happy to bail out of non-deferred
|
| + |
| m_triggerIdleUpdates = false; |
| bool ret = m_proxy->compositeAndReadback(pixels, rect); |
| m_triggerIdleUpdates = true; |
| @@ -340,9 +344,27 @@ void LayerTreeHost::finishAllRendering() |
| { |
| if (!m_rendererInitialized) |
| return; |
| + |
| + // Clear any pending commits. |
| + setDeferCommits(false); |
|
jamesr
2012/10/23 17:50:44
There are the same sorts of problems here as with
jonathan.backer
2012/10/23 19:26:42
'git gs' says no. Just doing it for completeness.
|
| + |
| m_proxy->finishAllRendering(); |
| } |
| +void LayerTreeHost::setDeferCommits(bool deferCommits) |
| +{ |
| + if (m_deferCommits == deferCommits) |
| + return; |
| + m_deferCommits = deferCommits; |
| + |
| + if (deferCommits) |
| + TRACE_EVENT_ASYNC_BEGIN0("cc", "LayerTreeHost::setDeferCommits", this); |
| + else |
| + TRACE_EVENT_ASYNC_END0("cc", "LayerTreeHost::setDeferCommits", this); |
| + |
| + m_proxy->setDeferCommits(deferCommits); |
| +} |
| + |
| void LayerTreeHost::renderingStats(RenderingStats* stats) const |
| { |
| *stats = m_renderingStats; |