| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "CCLayerTreeHost.h" | 7 #include "CCLayerTreeHost.h" |
| 8 | 8 |
| 9 #include "CCFontAtlas.h" | 9 #include "CCFontAtlas.h" |
| 10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 238 |
| 239 void CCLayerTreeHost::layout() | 239 void CCLayerTreeHost::layout() |
| 240 { | 240 { |
| 241 m_client->layout(); | 241 m_client->layout(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) | 244 void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) |
| 245 { | 245 { |
| 246 ASSERT(CCProxy::isImplThread()); | 246 ASSERT(CCProxy::isImplThread()); |
| 247 TRACE_EVENT0("cc", "CCLayerTreeHost::commitTo"); | 247 TRACE_EVENT0("cc", "CCLayerTreeHost::commitTo"); |
| 248 | |
| 249 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); | |
| 250 } | 248 } |
| 251 | 249 |
| 252 // This function commits the CCLayerTreeHost to an impl tree. When modifying | 250 // This function commits the CCLayerTreeHost to an impl tree. When modifying |
| 253 // this function, keep in mind that the function *runs* on the impl thread! Any | 251 // this function, keep in mind that the function *runs* on the impl thread! Any |
| 254 // code that is logically a main thread operation, e.g. deletion of a LayerChrom
ium, | 252 // code that is logically a main thread operation, e.g. deletion of a LayerChrom
ium, |
| 255 // should be delayed until the CCLayerTreeHost::commitComplete, which will run | 253 // should be delayed until the CCLayerTreeHost::commitComplete, which will run |
| 256 // after the commit, but on the main thread. | 254 // after the commit, but on the main thread. |
| 257 void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) | 255 void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) |
| 258 { | 256 { |
| 259 ASSERT(CCProxy::isImplThread()); | 257 ASSERT(CCProxy::isImplThread()); |
| 260 | 258 |
| 259 // We are about to synchronize trees, so it's now safe to delete textures |
| 260 // (that may be in use on the old impl tree). Also, before pushing, update |
| 261 // backing priorities so we know which textures to push. |
| 262 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); |
| 263 m_contentsTextureManager->updateBackingsPriorities(); |
| 264 |
| 261 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI
mpl->detachLayerTree(), hostImpl)); | 265 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI
mpl->detachLayerTree(), hostImpl)); |
| 262 | 266 |
| 263 if (m_rootLayer && m_hudLayer) | 267 if (m_rootLayer && m_hudLayer) |
| 264 hostImpl->setHudLayer(static_cast<CCHeadsUpDisplayLayerImpl*>(CCLayerTre
eHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); | 268 hostImpl->setHudLayer(static_cast<CCHeadsUpDisplayLayerImpl*>(CCLayerTre
eHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); |
| 265 else | 269 else |
| 266 hostImpl->setHudLayer(0); | 270 hostImpl->setHudLayer(0); |
| 267 | 271 |
| 268 // We may have added an animation during the tree sync. This will cause both
layer tree hosts | 272 // We may have added an animation during the tree sync. This will cause both
layer tree hosts |
| 269 // to visit their controllers. | 273 // to visit their controllers. |
| 270 if (rootLayer() && m_needsAnimateLayers) | 274 if (rootLayer() && m_needsAnimateLayers) |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 else | 858 else |
| 855 layer->notifyAnimationFinished(wallClockTime); | 859 layer->notifyAnimationFinished(wallClockTime); |
| 856 } | 860 } |
| 857 } | 861 } |
| 858 | 862 |
| 859 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 863 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 860 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 864 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 861 } | 865 } |
| 862 | 866 |
| 863 } // namespace cc | 867 } // namespace cc |
| OLD | NEW |