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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::didComp
leteSwapBuffers)); | 325 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::didComp
leteSwapBuffers)); |
326 } | 326 } |
327 | 327 |
328 void CCThreadProxy::onVSyncParametersChanged(double monotonicTimebase, double in
tervalInSeconds) | 328 void CCThreadProxy::onVSyncParametersChanged(double monotonicTimebase, double in
tervalInSeconds) |
329 { | 329 { |
330 ASSERT(isImplThread()); | 330 ASSERT(isImplThread()); |
331 TRACE_EVENT2("cc", "CCThreadProxy::onVSyncParametersChanged", "monotonicTime
base", monotonicTimebase, "intervalInSeconds", intervalInSeconds); | 331 TRACE_EVENT2("cc", "CCThreadProxy::onVSyncParametersChanged", "monotonicTime
base", monotonicTimebase, "intervalInSeconds", intervalInSeconds); |
332 m_schedulerOnImplThread->setTimebaseAndInterval(monotonicTimebase, intervalI
nSeconds); | 332 m_schedulerOnImplThread->setTimebaseAndInterval(monotonicTimebase, intervalI
nSeconds); |
333 } | 333 } |
334 | 334 |
| 335 void CCThreadProxy::onCanDrawStateChanged(bool canDraw) |
| 336 { |
| 337 ASSERT(isImplThread()); |
| 338 TRACE_EVENT1("cc", "CCThreadProxy::onCanDrawStateChanged", "canDraw", canDra
w); |
| 339 m_schedulerOnImplThread->setCanDraw(canDraw); |
| 340 } |
| 341 |
335 void CCThreadProxy::setNeedsCommitOnImplThread() | 342 void CCThreadProxy::setNeedsCommitOnImplThread() |
336 { | 343 { |
337 ASSERT(isImplThread()); | 344 ASSERT(isImplThread()); |
338 TRACE_EVENT0("cc", "CCThreadProxy::setNeedsCommitOnImplThread"); | 345 TRACE_EVENT0("cc", "CCThreadProxy::setNeedsCommitOnImplThread"); |
339 m_schedulerOnImplThread->setNeedsCommit(); | 346 m_schedulerOnImplThread->setNeedsCommit(); |
340 } | 347 } |
341 | 348 |
342 void CCThreadProxy::setNeedsForcedCommitOnImplThread() | 349 void CCThreadProxy::setNeedsForcedCommitOnImplThread() |
343 { | 350 { |
344 ASSERT(isImplThread()); | 351 ASSERT(isImplThread()); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime); | 522 m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime); |
516 m_layerTreeHost->layout(); | 523 m_layerTreeHost->layout(); |
517 | 524 |
518 // Clear the commit flag after updating animations and layout here --- objec
ts that only | 525 // Clear the commit flag after updating animations and layout here --- objec
ts that only |
519 // layout when painted will trigger another setNeedsCommit inside | 526 // layout when painted will trigger another setNeedsCommit inside |
520 // updateLayers. | 527 // updateLayers. |
521 m_commitRequested = false; | 528 m_commitRequested = false; |
522 m_commitRequestSentToImplThread = false; | 529 m_commitRequestSentToImplThread = false; |
523 m_forcedCommitRequested = false; | 530 m_forcedCommitRequested = false; |
524 | 531 |
525 if (!m_layerTreeHost->initializeRendererIfNeeded()) | 532 if (!m_layerTreeHost->initializeRendererIfNeeded()) { |
| 533 TRACE_EVENT0("cc", "EarlyOut_InitializeFailed"); |
526 return; | 534 return; |
| 535 } |
527 | 536 |
528 if (request->contentsTexturesWereDeleted) | 537 if (request->contentsTexturesWereDeleted) |
529 m_layerTreeHost->evictAllContentTextures(); | 538 m_layerTreeHost->evictAllContentTextures(); |
530 | 539 |
531 OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue); | 540 OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue); |
532 m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimit
Bytes); | 541 m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimit
Bytes); |
533 | 542 |
534 // Once single buffered layers are committed, they cannot be modified until | 543 // Once single buffered layers are committed, they cannot be modified until |
535 // they are drawn by the impl thread. | 544 // they are drawn by the impl thread. |
536 m_texturesAcquired = false; | 545 m_texturesAcquired = false; |
(...skipping 29 matching lines...) Expand all Loading... |
566 | 575 |
567 void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
, PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted) | 576 void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
, PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted) |
568 { | 577 { |
569 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); | 578 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); |
570 ASSERT(!m_commitCompletionEventOnImplThread); | 579 ASSERT(!m_commitCompletionEventOnImplThread); |
571 ASSERT(isImplThread()); | 580 ASSERT(isImplThread()); |
572 ASSERT(m_schedulerOnImplThread); | 581 ASSERT(m_schedulerOnImplThread); |
573 ASSERT(m_schedulerOnImplThread->commitPending()); | 582 ASSERT(m_schedulerOnImplThread->commitPending()); |
574 | 583 |
575 if (!m_layerTreeHostImpl) { | 584 if (!m_layerTreeHostImpl) { |
| 585 TRACE_EVENT0("cc", "EarlyOut_NoLayerTree"); |
576 completion->signal(); | 586 completion->signal(); |
577 return; | 587 return; |
578 } | 588 } |
579 | 589 |
580 if (!contentsTexturesWereDeleted && m_layerTreeHostImpl->contentsTexturesPur
ged()) { | 590 if (!contentsTexturesWereDeleted && m_layerTreeHostImpl->contentsTexturesPur
ged()) { |
581 // 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 |
582 // 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 |
583 // 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 |
584 // content textures), and kick another commit to fill them again. | 594 // content textures), and kick another commit to fill them again. |
585 queue->clearUploads(); | 595 queue->clearUploads(); |
(...skipping 17 matching lines...) Expand all Loading... |
603 m_schedulerOnImplThread->beginFrameAborted(); | 613 m_schedulerOnImplThread->beginFrameAborted(); |
604 } | 614 } |
605 | 615 |
606 bool CCThreadProxy::hasMoreResourceUpdates() const | 616 bool CCThreadProxy::hasMoreResourceUpdates() const |
607 { | 617 { |
608 if (!m_currentTextureUpdateControllerOnImplThread) | 618 if (!m_currentTextureUpdateControllerOnImplThread) |
609 return false; | 619 return false; |
610 return m_currentTextureUpdateControllerOnImplThread->hasMoreUpdates(); | 620 return m_currentTextureUpdateControllerOnImplThread->hasMoreUpdates(); |
611 } | 621 } |
612 | 622 |
613 bool CCThreadProxy::canDraw() | |
614 { | |
615 ASSERT(isImplThread()); | |
616 if (!m_layerTreeHostImpl) | |
617 return false; | |
618 return m_layerTreeHostImpl->canDraw(); | |
619 } | |
620 | |
621 void CCThreadProxy::scheduledActionUpdateMoreResources(double monotonicTimeLimit
) | 623 void CCThreadProxy::scheduledActionUpdateMoreResources(double monotonicTimeLimit
) |
622 { | 624 { |
623 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionUpdateMoreResources"); | 625 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionUpdateMoreResources"); |
624 ASSERT(m_currentTextureUpdateControllerOnImplThread); | 626 ASSERT(m_currentTextureUpdateControllerOnImplThread); |
625 m_currentTextureUpdateControllerOnImplThread->updateMoreTextures(monotonicTi
meLimit); | 627 m_currentTextureUpdateControllerOnImplThread->updateMoreTextures(monotonicTi
meLimit); |
626 } | 628 } |
627 | 629 |
628 void CCThreadProxy::scheduledActionCommit() | 630 void CCThreadProxy::scheduledActionCommit() |
629 { | 631 { |
630 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionCommit"); | 632 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionCommit"); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 } | 863 } |
862 | 864 |
863 void CCThreadProxy::initializeRendererOnImplThread(CCCompletionEvent* completion
, bool* initializeSucceeded, RendererCapabilities* capabilities) | 865 void CCThreadProxy::initializeRendererOnImplThread(CCCompletionEvent* completion
, bool* initializeSucceeded, RendererCapabilities* capabilities) |
864 { | 866 { |
865 TRACE_EVENT0("cc", "CCThreadProxy::initializeRendererOnImplThread"); | 867 TRACE_EVENT0("cc", "CCThreadProxy::initializeRendererOnImplThread"); |
866 ASSERT(isImplThread()); | 868 ASSERT(isImplThread()); |
867 ASSERT(m_contextBeforeInitializationOnImplThread); | 869 ASSERT(m_contextBeforeInitializationOnImplThread); |
868 *initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_contextBefo
reInitializationOnImplThread.release(), textureUploader); | 870 *initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_contextBefo
reInitializationOnImplThread.release(), textureUploader); |
869 if (*initializeSucceeded) { | 871 if (*initializeSucceeded) { |
870 *capabilities = m_layerTreeHostImpl->rendererCapabilities(); | 872 *capabilities = m_layerTreeHostImpl->rendererCapabilities(); |
871 if (capabilities->usingSwapCompleteCallback) | 873 m_schedulerOnImplThread->setSwapBuffersCompleteSupported( |
872 m_schedulerOnImplThread->setMaxFramesPending(2); | 874 capabilities->usingSwapCompleteCallback); |
873 } | 875 } |
874 | 876 |
875 completion->signal(); | 877 completion->signal(); |
876 } | 878 } |
877 | 879 |
878 void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio
n) | 880 void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio
n) |
879 { | 881 { |
880 TRACE_EVENT0("cc", "CCThreadProxy::layerTreeHostClosedOnImplThread"); | 882 TRACE_EVENT0("cc", "CCThreadProxy::layerTreeHostClosedOnImplThread"); |
881 ASSERT(isImplThread()); | 883 ASSERT(isImplThread()); |
882 if (!m_layerTreeHostImpl->contentsTexturesPurged()) | 884 if (!m_layerTreeHostImpl->contentsTexturesPurged()) |
(...skipping 30 matching lines...) Expand all Loading... |
913 } | 915 } |
914 | 916 |
915 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple
tion, CCRenderingStats* stats) | 917 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple
tion, CCRenderingStats* stats) |
916 { | 918 { |
917 ASSERT(isImplThread()); | 919 ASSERT(isImplThread()); |
918 m_layerTreeHostImpl->renderingStats(*stats); | 920 m_layerTreeHostImpl->renderingStats(*stats); |
919 completion->signal(); | 921 completion->signal(); |
920 } | 922 } |
921 | 923 |
922 } // namespace WebCore | 924 } // namespace WebCore |
OLD | NEW |