| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 ASSERT(isImplThread()); | 312 ASSERT(isImplThread()); |
| 313 TRACE_EVENT0("cc", "CCThreadProxy::onSwapBuffersCompleteOnImplThread"); | 313 TRACE_EVENT0("cc", "CCThreadProxy::onSwapBuffersCompleteOnImplThread"); |
| 314 m_schedulerOnImplThread->didSwapBuffersComplete(); | 314 m_schedulerOnImplThread->didSwapBuffersComplete(); |
| 315 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::didComp
leteSwapBuffers)); | 315 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::didComp
leteSwapBuffers)); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void CCThreadProxy::onVSyncParametersChanged(double monotonicTimebase, double in
tervalInSeconds) | 318 void CCThreadProxy::onVSyncParametersChanged(double monotonicTimebase, double in
tervalInSeconds) |
| 319 { | 319 { |
| 320 ASSERT(isImplThread()); | 320 ASSERT(isImplThread()); |
| 321 TRACE_EVENT2("cc", "CCThreadProxy::onVSyncParametersChanged", "monotonicTime
base", monotonicTimebase, "intervalInSeconds", intervalInSeconds); | 321 TRACE_EVENT2("cc", "CCThreadProxy::onVSyncParametersChanged", "monotonicTime
base", monotonicTimebase, "intervalInSeconds", intervalInSeconds); |
| 322 m_schedulerOnImplThread->setTimebaseAndInterval(monotonicTimebase, intervalI
nSeconds); | 322 base::TimeTicks timebase = base::TimeTicks::FromInternalValue(monotonicTimeb
ase * base::Time::kMicrosecondsPerSecond); |
| 323 base::TimeDelta interval = base::TimeDelta::FromMicroseconds(intervalInSecon
ds * base::Time::kMicrosecondsPerSecond); |
| 324 m_schedulerOnImplThread->setTimebaseAndInterval(timebase, interval); |
| 323 } | 325 } |
| 324 | 326 |
| 325 void CCThreadProxy::onCanDrawStateChanged(bool canDraw) | 327 void CCThreadProxy::onCanDrawStateChanged(bool canDraw) |
| 326 { | 328 { |
| 327 ASSERT(isImplThread()); | 329 ASSERT(isImplThread()); |
| 328 TRACE_EVENT1("cc", "CCThreadProxy::onCanDrawStateChanged", "canDraw", canDra
w); | 330 TRACE_EVENT1("cc", "CCThreadProxy::onCanDrawStateChanged", "canDraw", canDra
w); |
| 329 m_schedulerOnImplThread->setCanDraw(canDraw); | 331 m_schedulerOnImplThread->setCanDraw(canDraw); |
| 330 } | 332 } |
| 331 | 333 |
| 332 void CCThreadProxy::setNeedsCommitOnImplThread() | 334 void CCThreadProxy::setNeedsCommitOnImplThread() |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 void CCThreadProxy::beginFrameAbortedOnImplThread() | 619 void CCThreadProxy::beginFrameAbortedOnImplThread() |
| 618 { | 620 { |
| 619 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread"); | 621 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread"); |
| 620 ASSERT(isImplThread()); | 622 ASSERT(isImplThread()); |
| 621 ASSERT(m_schedulerOnImplThread); | 623 ASSERT(m_schedulerOnImplThread); |
| 622 ASSERT(m_schedulerOnImplThread->commitPending()); | 624 ASSERT(m_schedulerOnImplThread->commitPending()); |
| 623 | 625 |
| 624 m_schedulerOnImplThread->beginFrameAborted(); | 626 m_schedulerOnImplThread->beginFrameAborted(); |
| 625 } | 627 } |
| 626 | 628 |
| 627 void CCThreadProxy::scheduledActionUpdateMoreResources(double monotonicTimeLimit
) | 629 void CCThreadProxy::scheduledActionUpdateMoreResources(base::TimeTicks timeLimit
) |
| 628 { | 630 { |
| 629 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionUpdateMoreResources"); | 631 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionUpdateMoreResources"); |
| 630 ASSERT(m_currentTextureUpdateControllerOnImplThread); | 632 ASSERT(m_currentTextureUpdateControllerOnImplThread); |
| 631 m_currentTextureUpdateControllerOnImplThread->performMoreUpdates( | 633 double monotonicTimeLimit = timeLimit.ToInternalValue() / static_cast<double
>(base::Time::kMicrosecondsPerSecond); |
| 632 monotonicTimeLimit); | 634 m_currentTextureUpdateControllerOnImplThread->performMoreUpdates(monotonicTi
meLimit); |
| 633 } | 635 } |
| 634 | 636 |
| 635 void CCThreadProxy::scheduledActionCommit() | 637 void CCThreadProxy::scheduledActionCommit() |
| 636 { | 638 { |
| 637 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionCommit"); | 639 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionCommit"); |
| 638 ASSERT(isImplThread()); | 640 ASSERT(isImplThread()); |
| 639 ASSERT(m_commitCompletionEventOnImplThread); | 641 ASSERT(m_commitCompletionEventOnImplThread); |
| 640 ASSERT(m_currentTextureUpdateControllerOnImplThread); | 642 ASSERT(m_currentTextureUpdateControllerOnImplThread); |
| 641 | 643 |
| 642 // Complete all remaining texture updates. | 644 // Complete all remaining texture updates. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 m_contextRecreationTimer->startOneShot(contextRecreationTickRate); | 849 m_contextRecreationTimer->startOneShot(contextRecreationTickRate); |
| 848 else if (result == CCLayerTreeHost::RecreateSucceeded) | 850 else if (result == CCLayerTreeHost::RecreateSucceeded) |
| 849 m_contextRecreationTimer.clear(); | 851 m_contextRecreationTimer.clear(); |
| 850 } | 852 } |
| 851 | 853 |
| 852 void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion, Pa
ssOwnPtr<CCInputHandler> popHandler) | 854 void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion, Pa
ssOwnPtr<CCInputHandler> popHandler) |
| 853 { | 855 { |
| 854 TRACE_EVENT0("cc", "CCThreadProxy::initializeImplOnImplThread"); | 856 TRACE_EVENT0("cc", "CCThreadProxy::initializeImplOnImplThread"); |
| 855 ASSERT(isImplThread()); | 857 ASSERT(isImplThread()); |
| 856 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); | 858 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); |
| 857 const double displayRefreshInterval = 1.0 / 60.0; | 859 const base::TimeDelta displayRefreshInterval = base::TimeDelta::FromMicrosec
onds(base::Time::kMicrosecondsPerSecond / 60); |
| 858 OwnPtr<CCFrameRateController> frameRateController; | 860 OwnPtr<CCFrameRateController> frameRateController; |
| 859 if (m_renderVSyncEnabled) | 861 if (m_renderVSyncEnabled) |
| 860 frameRateController = adoptPtr(new CCFrameRateController(CCDelayBasedTim
eSource::create(displayRefreshInterval, CCProxy::implThread()))); | 862 frameRateController = adoptPtr(new CCFrameRateController(CCDelayBasedTim
eSource::create(displayRefreshInterval, CCProxy::implThread()))); |
| 861 else | 863 else |
| 862 frameRateController = adoptPtr(new CCFrameRateController(CCProxy::implTh
read())); | 864 frameRateController = adoptPtr(new CCFrameRateController(CCProxy::implTh
read())); |
| 863 m_schedulerOnImplThread = CCScheduler::create(this, frameRateController.rele
ase()); | 865 m_schedulerOnImplThread = CCScheduler::create(this, frameRateController.rele
ase()); |
| 864 m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); | 866 m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); |
| 865 | 867 |
| 866 m_inputHandlerOnImplThread = popHandler; | 868 m_inputHandlerOnImplThread = popHandler; |
| 867 if (m_inputHandlerOnImplThread) | 869 if (m_inputHandlerOnImplThread) |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 } | 930 } |
| 929 | 931 |
| 930 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple
tion, CCRenderingStats* stats) | 932 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple
tion, CCRenderingStats* stats) |
| 931 { | 933 { |
| 932 ASSERT(isImplThread()); | 934 ASSERT(isImplThread()); |
| 933 m_layerTreeHostImpl->renderingStats(*stats); | 935 m_layerTreeHostImpl->renderingStats(*stats); |
| 934 completion->signal(); | 936 completion->signal(); |
| 935 } | 937 } |
| 936 | 938 |
| 937 } // namespace cc | 939 } // namespace cc |
| OLD | NEW |