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 "cc/thread_proxy.h" | 5 #include "cc/thread_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "cc/delay_based_time_source.h" | 9 #include "cc/delay_based_time_source.h" |
10 #include "cc/draw_quad.h" | 10 #include "cc/draw_quad.h" |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 712 |
713 if (newImplTreeHasNoEvictedResources) { | 713 if (newImplTreeHasNoEvictedResources) { |
714 if (m_layerTreeHostImpl->contentsTexturesPurged()) | 714 if (m_layerTreeHostImpl->contentsTexturesPurged()) |
715 m_layerTreeHostImpl->resetContentsTexturesPurged(); | 715 m_layerTreeHostImpl->resetContentsTexturesPurged(); |
716 } | 716 } |
717 | 717 |
718 m_layerTreeHostImpl->commitComplete(); | 718 m_layerTreeHostImpl->commitComplete(); |
719 | 719 |
720 m_nextFrameIsNewlyCommittedFrameOnImplThread = true; | 720 m_nextFrameIsNewlyCommittedFrameOnImplThread = true; |
721 | 721 |
722 m_commitCompletionEventOnImplThread->signal(); | 722 if (m_layerTreeHost->settings().implSidePainting && m_layerTreeHost->blocksP
endingCommit()) |
723 m_commitCompletionEventOnImplThread = 0; | 723 { |
| 724 // For some layer types in impl-side painting, the commit is held until |
| 725 // the pending tree is activated. |
| 726 TRACE_EVENT_INSTANT0("cc", "HoldCommit"); |
| 727 } |
| 728 else |
| 729 { |
| 730 m_commitCompletionEventOnImplThread->signal(); |
| 731 m_commitCompletionEventOnImplThread = 0; |
| 732 } |
724 | 733 |
725 // SetVisible kicks off the next scheduler action, so this must be last. | 734 // SetVisible kicks off the next scheduler action, so this must be last. |
726 m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); | 735 m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); |
727 } | 736 } |
728 | 737 |
729 void ThreadProxy::scheduledActionBeginContextRecreation() | 738 void ThreadProxy::scheduledActionBeginContextRecreation() |
730 { | 739 { |
731 DCHECK(isImplThread()); | 740 DCHECK(isImplThread()); |
732 Proxy::mainThread()->postTask(base::Bind(&ThreadProxy::beginContextRecreatio
n, m_mainThreadWeakPtr)); | 741 Proxy::mainThread()->postTask(base::Bind(&ThreadProxy::beginContextRecreatio
n, m_mainThreadWeakPtr)); |
733 } | 742 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 // prepareToDraw(), it is guarded on canDraw() as well. | 776 // prepareToDraw(), it is guarded on canDraw() as well. |
768 | 777 |
769 LayerTreeHostImpl::FrameData frame; | 778 LayerTreeHostImpl::FrameData frame; |
770 bool drawFrame = m_layerTreeHostImpl->canDraw() && (m_layerTreeHostImpl->pre
pareToDraw(frame) || forcedDraw); | 779 bool drawFrame = m_layerTreeHostImpl->canDraw() && (m_layerTreeHostImpl->pre
pareToDraw(frame) || forcedDraw); |
771 if (drawFrame) { | 780 if (drawFrame) { |
772 m_layerTreeHostImpl->drawLayers(frame); | 781 m_layerTreeHostImpl->drawLayers(frame); |
773 result.didDraw = true; | 782 result.didDraw = true; |
774 } | 783 } |
775 m_layerTreeHostImpl->didDrawAllLayers(frame); | 784 m_layerTreeHostImpl->didDrawAllLayers(frame); |
776 | 785 |
| 786 // Check for tree activation. |
| 787 if (m_commitCompletionEventOnImplThread && !m_layerTreeHostImpl->pendingTree
()) |
| 788 { |
| 789 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation"); |
| 790 DCHECK(m_layerTreeHostImpl->settings().implSidePainting); |
| 791 m_commitCompletionEventOnImplThread->signal(); |
| 792 m_commitCompletionEventOnImplThread = 0; |
| 793 } |
| 794 |
777 // Check for a pending compositeAndReadback. | 795 // Check for a pending compositeAndReadback. |
778 if (m_readbackRequestOnImplThread) { | 796 if (m_readbackRequestOnImplThread) { |
779 m_readbackRequestOnImplThread->success = false; | 797 m_readbackRequestOnImplThread->success = false; |
780 if (drawFrame) { | 798 if (drawFrame) { |
781 m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels,
m_readbackRequestOnImplThread->rect); | 799 m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels,
m_readbackRequestOnImplThread->rect); |
782 m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isCon
textLost(); | 800 m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isCon
textLost(); |
783 } | 801 } |
784 m_readbackRequestOnImplThread->completion.signal(); | 802 m_readbackRequestOnImplThread->completion.signal(); |
785 m_readbackRequestOnImplThread = 0; | 803 m_readbackRequestOnImplThread = 0; |
786 } else if (drawFrame) | 804 } else if (drawFrame) |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 } | 1033 } |
1016 | 1034 |
1017 void ThreadProxy::commitPendingOnImplThreadForTesting(CommitPendingRequest* requ
est) | 1035 void ThreadProxy::commitPendingOnImplThreadForTesting(CommitPendingRequest* requ
est) |
1018 { | 1036 { |
1019 DCHECK(isImplThread()); | 1037 DCHECK(isImplThread()); |
1020 request->commitPending = m_schedulerOnImplThread->commitPending(); | 1038 request->commitPending = m_schedulerOnImplThread->commitPending(); |
1021 request->completion.signal(); | 1039 request->completion.signal(); |
1022 } | 1040 } |
1023 | 1041 |
1024 } // namespace cc | 1042 } // namespace cc |
OLD | NEW |