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" |
11 #include "CCFrameRateController.h" | 11 #include "CCFrameRateController.h" |
12 #include "CCGraphicsContext.h" | 12 #include "CCGraphicsContext.h" |
13 #include "CCInputHandler.h" | 13 #include "CCInputHandler.h" |
14 #include "CCLayerTreeHost.h" | 14 #include "CCLayerTreeHost.h" |
15 #include "CCScheduler.h" | 15 #include "CCScheduler.h" |
16 #include "CCScopedThreadProxy.h" | 16 #include "CCScopedThreadProxy.h" |
17 #include "CCTextureUpdateController.h" | |
18 #include "CCThreadTask.h" | 17 #include "CCThreadTask.h" |
19 #include "TraceEvent.h" | 18 #include "TraceEvent.h" |
20 #include <public/WebSharedGraphicsContext3D.h> | 19 #include <public/WebSharedGraphicsContext3D.h> |
21 #include <wtf/CurrentTime.h> | 20 #include <wtf/CurrentTime.h> |
22 | 21 |
23 using namespace WTF; | 22 using namespace WTF; |
24 | 23 |
25 using WebKit::WebSharedGraphicsContext3D; | 24 using WebKit::WebSharedGraphicsContext3D; |
26 namespace { | 25 namespace { |
27 | 26 |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; | 586 m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; |
588 } else if (m_layerTreeHostImpl->contentsTexturesPurged()) { | 587 } else if (m_layerTreeHostImpl->contentsTexturesPurged()) { |
589 // We purged the content textures on the impl thread between the time we | 588 // We purged the content textures on the impl thread between the time we |
590 // posted the beginFrame task and now, meaning we have a bunch of | 589 // posted the beginFrame task and now, meaning we have a bunch of |
591 // uploads that are now invalid. Clear the uploads (they all go to | 590 // uploads that are now invalid. Clear the uploads (they all go to |
592 // content textures), and kick another commit to fill them again. | 591 // content textures), and kick another commit to fill them again. |
593 queue->clearUploads(); | 592 queue->clearUploads(); |
594 setNeedsCommitOnImplThread(); | 593 setNeedsCommitOnImplThread(); |
595 } | 594 } |
596 | 595 |
597 m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::cr
eate(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_la
yerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->t
extureUploader()); | 596 bool hasResourceUpdates = queue->hasMoreUpdates(); |
| 597 if (hasResourceUpdates) |
| 598 m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController
::create(this, CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvid
er(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->ren
derer()->textureUploader()); |
598 m_commitCompletionEventOnImplThread = completion; | 599 m_commitCompletionEventOnImplThread = completion; |
599 | 600 |
600 m_schedulerOnImplThread->beginFrameComplete(); | 601 m_schedulerOnImplThread->beginFrameComplete(hasResourceUpdates); |
601 } | 602 } |
602 | 603 |
603 void CCThreadProxy::beginFrameAbortedOnImplThread() | 604 void CCThreadProxy::beginFrameAbortedOnImplThread() |
604 { | 605 { |
605 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread"); | 606 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread"); |
606 ASSERT(isImplThread()); | 607 ASSERT(isImplThread()); |
607 ASSERT(m_schedulerOnImplThread); | 608 ASSERT(m_schedulerOnImplThread); |
608 ASSERT(m_schedulerOnImplThread->commitPending()); | 609 ASSERT(m_schedulerOnImplThread->commitPending()); |
609 | 610 |
610 m_schedulerOnImplThread->beginFrameAborted(); | 611 m_schedulerOnImplThread->beginFrameAborted(); |
611 } | 612 } |
612 | 613 |
613 bool CCThreadProxy::hasMoreResourceUpdates() const | |
614 { | |
615 if (!m_currentTextureUpdateControllerOnImplThread) | |
616 return false; | |
617 return m_currentTextureUpdateControllerOnImplThread->hasMoreUpdates(); | |
618 } | |
619 | |
620 void CCThreadProxy::scheduledActionUpdateMoreResources(double monotonicTimeLimit
) | 614 void CCThreadProxy::scheduledActionUpdateMoreResources(double monotonicTimeLimit
) |
621 { | 615 { |
622 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionUpdateMoreResources"); | 616 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionUpdateMoreResources"); |
623 ASSERT(m_currentTextureUpdateControllerOnImplThread); | 617 ASSERT(m_currentTextureUpdateControllerOnImplThread); |
624 m_currentTextureUpdateControllerOnImplThread->updateMoreTextures(monotonicTi
meLimit); | 618 m_currentTextureUpdateControllerOnImplThread->updateMoreTextures(monotonicTi
meLimit); |
625 } | 619 } |
626 | 620 |
627 void CCThreadProxy::scheduledActionCommit() | 621 void CCThreadProxy::scheduledActionCommit() |
628 { | 622 { |
629 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionCommit"); | 623 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionCommit"); |
630 ASSERT(isImplThread()); | 624 ASSERT(isImplThread()); |
631 ASSERT(!hasMoreResourceUpdates()); | |
632 ASSERT(m_commitCompletionEventOnImplThread); | 625 ASSERT(m_commitCompletionEventOnImplThread); |
633 | 626 |
634 m_currentTextureUpdateControllerOnImplThread.clear(); | 627 m_currentTextureUpdateControllerOnImplThread.clear(); |
635 | 628 |
636 m_layerTreeHostImpl->beginCommit(); | 629 m_layerTreeHostImpl->beginCommit(); |
637 | 630 |
638 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); | 631 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); |
639 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); | 632 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); |
640 | 633 |
641 if (m_resetContentsTexturesPurgedAfterCommitOnImplThread) { | 634 if (m_resetContentsTexturesPurgedAfterCommitOnImplThread) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapIfPo
ssible() | 754 CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapIfPo
ssible() |
762 { | 755 { |
763 return scheduledActionDrawAndSwapInternal(false); | 756 return scheduledActionDrawAndSwapInternal(false); |
764 } | 757 } |
765 | 758 |
766 CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapForc
ed() | 759 CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapForc
ed() |
767 { | 760 { |
768 return scheduledActionDrawAndSwapInternal(true); | 761 return scheduledActionDrawAndSwapInternal(true); |
769 } | 762 } |
770 | 763 |
| 764 void CCThreadProxy::updateTexturesCompleted() |
| 765 { |
| 766 ASSERT(isImplThread()); |
| 767 m_schedulerOnImplThread->updateResourcesComplete(); |
| 768 } |
| 769 |
771 void CCThreadProxy::didCommitAndDrawFrame() | 770 void CCThreadProxy::didCommitAndDrawFrame() |
772 { | 771 { |
773 ASSERT(isMainThread()); | 772 ASSERT(isMainThread()); |
774 if (!m_layerTreeHost) | 773 if (!m_layerTreeHost) |
775 return; | 774 return; |
776 m_layerTreeHost->didCommitAndDrawFrame(); | 775 m_layerTreeHost->didCommitAndDrawFrame(); |
777 } | 776 } |
778 | 777 |
779 void CCThreadProxy::didCompleteSwapBuffers() | 778 void CCThreadProxy::didCompleteSwapBuffers() |
780 { | 779 { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 } | 913 } |
915 | 914 |
916 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple
tion, CCRenderingStats* stats) | 915 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple
tion, CCRenderingStats* stats) |
917 { | 916 { |
918 ASSERT(isImplThread()); | 917 ASSERT(isImplThread()); |
919 m_layerTreeHostImpl->renderingStats(*stats); | 918 m_layerTreeHostImpl->renderingStats(*stats); |
920 completion->signal(); | 919 completion->signal(); |
921 } | 920 } |
922 | 921 |
923 } // namespace WebCore | 922 } // namespace WebCore |
OLD | NEW |