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 "CCThreadProxy.h" | 7 #include "CCThreadProxy.h" |
8 | 8 |
9 #include "CCDelayBasedTimeSource.h" | 9 #include "CCDelayBasedTimeSource.h" |
10 #include "CCDrawQuad.h" | 10 #include "CCDrawQuad.h" |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 m_commitRequested = false; | 522 m_commitRequested = false; |
523 m_commitRequestSentToImplThread = false; | 523 m_commitRequestSentToImplThread = false; |
524 m_forcedCommitRequested = false; | 524 m_forcedCommitRequested = false; |
525 | 525 |
526 if (!m_layerTreeHost->initializeRendererIfNeeded()) { | 526 if (!m_layerTreeHost->initializeRendererIfNeeded()) { |
527 TRACE_EVENT0("cc", "EarlyOut_InitializeFailed"); | 527 TRACE_EVENT0("cc", "EarlyOut_InitializeFailed"); |
528 return; | 528 return; |
529 } | 529 } |
530 | 530 |
531 if (request->contentsTexturesWereDeleted) | 531 if (request->contentsTexturesWereDeleted) |
532 m_layerTreeHost->evictAllContentTextures(); | 532 m_layerTreeHost->unlinkAllContentTextures(); |
533 | 533 |
534 OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue); | 534 OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue); |
535 m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimit
Bytes); | 535 m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimit
Bytes); |
536 | 536 |
537 // Once single buffered layers are committed, they cannot be modified until | 537 // Once single buffered layers are committed, they cannot be modified until |
538 // they are drawn by the impl thread. | 538 // they are drawn by the impl thread. |
539 m_texturesAcquired = false; | 539 m_texturesAcquired = false; |
540 | 540 |
541 m_layerTreeHost->willCommit(); | 541 m_layerTreeHost->willCommit(); |
542 // Before applying scrolls and calling animate, we set m_animateRequested to | 542 // Before applying scrolls and calling animate, we set m_animateRequested to |
(...skipping 21 matching lines...) Expand all Loading... |
564 } | 564 } |
565 | 565 |
566 m_layerTreeHost->commitComplete(); | 566 m_layerTreeHost->commitComplete(); |
567 m_layerTreeHost->didBeginFrame(); | 567 m_layerTreeHost->didBeginFrame(); |
568 } | 568 } |
569 | 569 |
570 void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
, PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted) | 570 void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
, PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted) |
571 { | 571 { |
572 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); | 572 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); |
573 ASSERT(!m_commitCompletionEventOnImplThread); | 573 ASSERT(!m_commitCompletionEventOnImplThread); |
574 ASSERT(isImplThread()); | 574 ASSERT(isImplThread() && isMainThreadBlocked()); |
575 ASSERT(m_schedulerOnImplThread); | 575 ASSERT(m_schedulerOnImplThread); |
576 ASSERT(m_schedulerOnImplThread->commitPending()); | 576 ASSERT(m_schedulerOnImplThread->commitPending()); |
577 | 577 |
578 if (!m_layerTreeHostImpl) { | 578 if (!m_layerTreeHostImpl) { |
579 TRACE_EVENT0("cc", "EarlyOut_NoLayerTree"); | 579 TRACE_EVENT0("cc", "EarlyOut_NoLayerTree"); |
580 completion->signal(); | 580 completion->signal(); |
581 return; | 581 return; |
582 } | 582 } |
583 | 583 |
584 if (!contentsTexturesWereDeleted && m_layerTreeHostImpl->contentsTexturesPur
ged()) { | 584 if (contentsTexturesWereDeleted) { |
| 585 ASSERT(m_layerTreeHostImpl->contentsTexturesPurged()); |
| 586 // We unlinked all textures on the main thread, delete them now. |
| 587 m_layerTreeHost->deleteUnlinkedTextures(); |
| 588 // Mark that we can start drawing again when this commit is complete. |
| 589 m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; |
| 590 } else if (m_layerTreeHostImpl->contentsTexturesPurged()) { |
585 // We purged the content textures on the impl thread between the time we | 591 // We purged the content textures on the impl thread between the time we |
586 // posted the beginFrame task and now, meaning we have a bunch of | 592 // posted the beginFrame task and now, meaning we have a bunch of |
587 // uploads that are now invalid. Clear the uploads (they all go to | 593 // uploads that are now invalid. Clear the uploads (they all go to |
588 // content textures), and kick another commit to fill them again. | 594 // content textures), and kick another commit to fill them again. |
589 queue->clearUploads(); | 595 queue->clearUploads(); |
590 setNeedsCommitOnImplThread(); | 596 setNeedsCommitOnImplThread(); |
591 } else | 597 } |
592 m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; | |
593 | 598 |
594 m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::cr
eate(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_la
yerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->t
extureUploader()); | 599 m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::cr
eate(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_la
yerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->t
extureUploader()); |
595 m_commitCompletionEventOnImplThread = completion; | 600 m_commitCompletionEventOnImplThread = completion; |
596 | 601 |
597 m_schedulerOnImplThread->beginFrameComplete(); | 602 m_schedulerOnImplThread->beginFrameComplete(); |
598 } | 603 } |
599 | 604 |
600 void CCThreadProxy::beginFrameAbortedOnImplThread() | 605 void CCThreadProxy::beginFrameAbortedOnImplThread() |
601 { | 606 { |
602 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread"); | 607 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread"); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 } | 916 } |
912 | 917 |
913 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple
tion, CCRenderingStats* stats) | 918 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple
tion, CCRenderingStats* stats) |
914 { | 919 { |
915 ASSERT(isImplThread()); | 920 ASSERT(isImplThread()); |
916 m_layerTreeHostImpl->renderingStats(*stats); | 921 m_layerTreeHostImpl->renderingStats(*stats); |
917 completion->signal(); | 922 completion->signal(); |
918 } | 923 } |
919 | 924 |
920 } // namespace WebCore | 925 } // namespace WebCore |
OLD | NEW |