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

Side by Side Diff: cc/CCLayerTreeHost.cpp

Issue 11048004: Only recycle and evict textures not in-use on the impl thread. (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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/CCPrioritizedTexture.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | cc/CCPrioritizedTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698