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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 void CCLayerTreeHost::layout() | 235 void CCLayerTreeHost::layout() |
236 { | 236 { |
237 m_client->layout(); | 237 m_client->layout(); |
238 } | 238 } |
239 | 239 |
240 void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) | 240 void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) |
241 { | 241 { |
242 ASSERT(CCProxy::isImplThread()); | 242 ASSERT(CCProxy::isImplThread()); |
243 TRACE_EVENT0("cc", "CCLayerTreeHost::commitTo"); | 243 TRACE_EVENT0("cc", "CCLayerTreeHost::commitTo"); |
244 | |
245 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); | |
246 } | 244 } |
247 | 245 |
248 // This function commits the CCLayerTreeHost to an impl tree. When modifying | 246 // This function commits the CCLayerTreeHost to an impl tree. When modifying |
249 // this function, keep in mind that the function *runs* on the impl thread! Any | 247 // this function, keep in mind that the function *runs* on the impl thread! Any |
250 // code that is logically a main thread operation, e.g. deletion of a LayerChrom
ium, | 248 // code that is logically a main thread operation, e.g. deletion of a LayerChrom
ium, |
251 // should be delayed until the CCLayerTreeHost::commitComplete, which will run | 249 // should be delayed until the CCLayerTreeHost::commitComplete, which will run |
252 // after the commit, but on the main thread. | 250 // after the commit, but on the main thread. |
253 void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) | 251 void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) |
254 { | 252 { |
255 ASSERT(CCProxy::isImplThread()); | 253 ASSERT(CCProxy::isImplThread()); |
256 | 254 |
| 255 m_contentsTextureManager->updateBackingsInDrawingImplTree(); |
| 256 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); |
| 257 |
257 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI
mpl->detachLayerTree(), hostImpl)); | 258 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI
mpl->detachLayerTree(), hostImpl)); |
258 | 259 |
259 if (m_rootLayer && m_hudLayer) | 260 if (m_rootLayer && m_hudLayer) |
260 hostImpl->setHudLayer(static_cast<CCHeadsUpDisplayLayerImpl*>(CCLayerTre
eHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); | 261 hostImpl->setHudLayer(static_cast<CCHeadsUpDisplayLayerImpl*>(CCLayerTre
eHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); |
261 else | 262 else |
262 hostImpl->setHudLayer(0); | 263 hostImpl->setHudLayer(0); |
263 | 264 |
264 // We may have added an animation during the tree sync. This will cause both
layer tree hosts | 265 // We may have added an animation during the tree sync. This will cause both
layer tree hosts |
265 // to visit their controllers. | 266 // to visit their controllers. |
266 if (rootLayer() && m_needsAnimateLayers) | 267 if (rootLayer() && m_needsAnimateLayers) |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } | 429 } |
429 | 430 |
430 void CCLayerTreeHost::setVisible(bool visible) | 431 void CCLayerTreeHost::setVisible(bool visible) |
431 { | 432 { |
432 if (m_visible == visible) | 433 if (m_visible == visible) |
433 return; | 434 return; |
434 m_visible = visible; | 435 m_visible = visible; |
435 m_proxy->setVisible(visible); | 436 m_proxy->setVisible(visible); |
436 } | 437 } |
437 | 438 |
438 void CCLayerTreeHost::reduceContentsTexturesMemoryOnImplThread(size_t limitBytes
, CCResourceProvider* resourceProvider) | |
439 { | |
440 ASSERT(CCProxy::isImplThread()); | |
441 ASSERT(m_contentsTextureManager.get()); | |
442 m_contentsTextureManager->reduceMemoryOnImplThread(limitBytes, resourceProvi
der); | |
443 } | |
444 | |
445 bool CCLayerTreeHost::evictedContentsTexturesBackingsExist() const | |
446 { | |
447 ASSERT(CCProxy::isImplThread()); | |
448 ASSERT(m_contentsTextureManager.get()); | |
449 return m_contentsTextureManager->evictedBackingsExist(); | |
450 } | |
451 | |
452 void CCLayerTreeHost::getEvictedContentTexturesBackings(CCPrioritizedTextureMana
ger::BackingVector& evictedBackings) | |
453 { | |
454 ASSERT(CCProxy::isImplThread()); | |
455 evictedBackings.clear(); | |
456 if (m_rendererInitialized) | |
457 m_contentsTextureManager->getEvictedBackings(evictedBackings); | |
458 } | |
459 | |
460 void CCLayerTreeHost::unlinkEvictedContentTexturesBackings(const CCPrioritizedTe
xtureManager::BackingVector& evictedBackings) | |
461 { | |
462 ASSERT(CCProxy::isMainThread()); | |
463 ASSERT(m_contentsTextureManager.get()); | |
464 m_contentsTextureManager->unlinkEvictedBackings(evictedBackings); | |
465 } | |
466 | |
467 bool CCLayerTreeHost::deleteEvictedContentTexturesBackings() | |
468 { | |
469 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); | |
470 ASSERT(m_contentsTextureManager.get()); | |
471 return m_contentsTextureManager->deleteEvictedBackings(); | |
472 } | |
473 | |
474 void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, boo
l useAnchor, float scale, double durationSec) | 439 void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, boo
l useAnchor, float scale, double durationSec) |
475 { | 440 { |
476 m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationS
ec); | 441 m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationS
ec); |
477 } | 442 } |
478 | 443 |
479 void CCLayerTreeHost::loseContext(int numTimes) | 444 void CCLayerTreeHost::loseContext(int numTimes) |
480 { | 445 { |
481 TRACE_EVENT1("cc", "CCLayerTreeHost::loseCompositorContext", "numTimes", num
Times); | 446 TRACE_EVENT1("cc", "CCLayerTreeHost::loseCompositorContext", "numTimes", num
Times); |
482 m_numTimesRecreateShouldFail = numTimes - 1; | 447 m_numTimesRecreateShouldFail = numTimes - 1; |
483 m_proxy->loseContext(); | 448 m_proxy->loseContext(); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 else | 817 else |
853 layer->notifyAnimationFinished(wallClockTime); | 818 layer->notifyAnimationFinished(wallClockTime); |
854 } | 819 } |
855 } | 820 } |
856 | 821 |
857 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 822 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
858 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 823 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
859 } | 824 } |
860 | 825 |
861 } // namespace cc | 826 } // namespace cc |
OLD | NEW |