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 m_contentsTextureManager->updateBackingsInDrawingImplTree(); |
| 260 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); |
| 261 |
261 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI
mpl->detachLayerTree(), hostImpl)); | 262 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI
mpl->detachLayerTree(), hostImpl)); |
262 | 263 |
263 if (m_rootLayer && m_hudLayer) | 264 if (m_rootLayer && m_hudLayer) |
264 hostImpl->setHudLayer(static_cast<CCHeadsUpDisplayLayerImpl*>(CCLayerTre
eHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); | 265 hostImpl->setHudLayer(static_cast<CCHeadsUpDisplayLayerImpl*>(CCLayerTre
eHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); |
265 else | 266 else |
266 hostImpl->setHudLayer(0); | 267 hostImpl->setHudLayer(0); |
267 | 268 |
268 // We may have added an animation during the tree sync. This will cause both
layer tree hosts | 269 // We may have added an animation during the tree sync. This will cause both
layer tree hosts |
269 // to visit their controllers. | 270 // to visit their controllers. |
270 if (rootLayer() && m_needsAnimateLayers) | 271 if (rootLayer() && m_needsAnimateLayers) |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 } | 433 } |
433 | 434 |
434 void CCLayerTreeHost::setVisible(bool visible) | 435 void CCLayerTreeHost::setVisible(bool visible) |
435 { | 436 { |
436 if (m_visible == visible) | 437 if (m_visible == visible) |
437 return; | 438 return; |
438 m_visible = visible; | 439 m_visible = visible; |
439 m_proxy->setVisible(visible); | 440 m_proxy->setVisible(visible); |
440 } | 441 } |
441 | 442 |
442 void CCLayerTreeHost::reduceContentsTexturesMemoryOnImplThread(size_t limitBytes
, CCResourceProvider* resourceProvider) | |
443 { | |
444 ASSERT(CCProxy::isImplThread()); | |
445 ASSERT(m_contentsTextureManager.get()); | |
446 m_contentsTextureManager->reduceMemoryOnImplThread(limitBytes, resourceProvi
der); | |
447 } | |
448 | |
449 bool CCLayerTreeHost::evictedContentsTexturesBackingsExist() const | |
450 { | |
451 ASSERT(CCProxy::isImplThread()); | |
452 ASSERT(m_contentsTextureManager.get()); | |
453 return m_contentsTextureManager->evictedBackingsExist(); | |
454 } | |
455 | |
456 void CCLayerTreeHost::getEvictedContentTexturesBackings(CCPrioritizedTextureMana
ger::BackingVector& evictedBackings) | |
457 { | |
458 ASSERT(CCProxy::isImplThread()); | |
459 evictedBackings.clear(); | |
460 if (m_rendererInitialized) | |
461 m_contentsTextureManager->getEvictedBackings(evictedBackings); | |
462 } | |
463 | |
464 void CCLayerTreeHost::unlinkEvictedContentTexturesBackings(const CCPrioritizedTe
xtureManager::BackingVector& evictedBackings) | |
465 { | |
466 ASSERT(CCProxy::isMainThread()); | |
467 ASSERT(m_contentsTextureManager.get()); | |
468 m_contentsTextureManager->unlinkEvictedBackings(evictedBackings); | |
469 } | |
470 | |
471 bool CCLayerTreeHost::deleteEvictedContentTexturesBackings() | |
472 { | |
473 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); | |
474 ASSERT(m_contentsTextureManager.get()); | |
475 return m_contentsTextureManager->deleteEvictedBackings(); | |
476 } | |
477 | |
478 void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, boo
l useAnchor, float scale, double durationSec) | 443 void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, boo
l useAnchor, float scale, double durationSec) |
479 { | 444 { |
480 m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationS
ec); | 445 m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationS
ec); |
481 } | 446 } |
482 | 447 |
483 void CCLayerTreeHost::loseContext(int numTimes) | 448 void CCLayerTreeHost::loseContext(int numTimes) |
484 { | 449 { |
485 TRACE_EVENT1("cc", "CCLayerTreeHost::loseCompositorContext", "numTimes", num
Times); | 450 TRACE_EVENT1("cc", "CCLayerTreeHost::loseCompositorContext", "numTimes", num
Times); |
486 m_numTimesRecreateShouldFail = numTimes - 1; | 451 m_numTimesRecreateShouldFail = numTimes - 1; |
487 m_proxy->loseContext(); | 452 m_proxy->loseContext(); |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 else | 829 else |
865 layer->notifyAnimationFinished(wallClockTime); | 830 layer->notifyAnimationFinished(wallClockTime); |
866 } | 831 } |
867 } | 832 } |
868 | 833 |
869 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 834 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
870 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 835 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
871 } | 836 } |
872 | 837 |
873 } // namespace cc | 838 } // namespace cc |
OLD | NEW |