| Index: cc/thread_proxy.cc
|
| diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc
|
| index adb9d016d020f8acb2c046493c0daf03fb706fc4..cb8e49baebc77a532169e3fb89c0db7a8baf5629 100644
|
| --- a/cc/thread_proxy.cc
|
| +++ b/cc/thread_proxy.cc
|
| @@ -59,6 +59,8 @@ ThreadProxy::ThreadProxy(LayerTreeHost* layerTreeHost, scoped_ptr<Thread> implTh
|
| , m_nextFrameIsNewlyCommittedFrameOnImplThread(false)
|
| , m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled)
|
| , m_insideDraw(false)
|
| + , m_renderVSyncNotificationEnabled(layerTreeHost->settings().renderVSyncNotificationEnabled)
|
| + , m_vsyncClient(0)
|
| , m_totalCommitCount(0)
|
| , m_deferCommits(false)
|
| , m_renewTreePriorityOnImplThreadPending(false)
|
| @@ -332,6 +334,14 @@ void ThreadProxy::onVSyncParametersChanged(base::TimeTicks timebase, base::TimeD
|
| m_schedulerOnImplThread->setTimebaseAndInterval(timebase, interval);
|
| }
|
|
|
| +void ThreadProxy::didVSync(base::TimeTicks frameTime)
|
| +{
|
| + DCHECK(isImplThread());
|
| + TRACE_EVENT0("cc", "ThreadProxy::didVSync");
|
| + if (m_vsyncClient)
|
| + m_vsyncClient->DidVSync(frameTime);
|
| +}
|
| +
|
| void ThreadProxy::onCanDrawStateChanged(bool canDraw)
|
| {
|
| DCHECK(isImplThread());
|
| @@ -991,9 +1001,12 @@ void ThreadProxy::initializeImplOnImplThread(CompletionEvent* completion, InputH
|
| m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this);
|
| const base::TimeDelta displayRefreshInterval = base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / 60);
|
| scoped_ptr<FrameRateController> frameRateController;
|
| - if (m_renderVSyncEnabled)
|
| - frameRateController.reset(new FrameRateController(DelayBasedTimeSource::create(displayRefreshInterval, Proxy::implThread())));
|
| - else
|
| + if (m_renderVSyncEnabled) {
|
| + if (m_renderVSyncNotificationEnabled)
|
| + frameRateController.reset(new FrameRateController(VSyncTimeSource::create(this)));
|
| + else
|
| + frameRateController.reset(new FrameRateController(DelayBasedTimeSource::create(displayRefreshInterval, Proxy::implThread())));
|
| + } else
|
| frameRateController.reset(new FrameRateController(Proxy::implThread()));
|
| SchedulerSettings schedulerSettings;
|
| schedulerSettings.implSidePainting = m_layerTreeHost->settings().implSidePainting;
|
| @@ -1043,6 +1056,7 @@ void ThreadProxy::layerTreeHostClosedOnImplThread(CompletionEvent* completion)
|
| m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
|
| m_inputHandlerOnImplThread.reset();
|
| m_layerTreeHostImpl.reset();
|
| + m_vsyncClient = 0;
|
| m_schedulerOnImplThread.reset();
|
| m_weakFactoryOnImplThread.InvalidateWeakPtrs();
|
| completion->signal();
|
| @@ -1079,6 +1093,13 @@ void ThreadProxy::renderingStatsOnImplThread(CompletionEvent* completion, Render
|
| completion->signal();
|
| }
|
|
|
| +void ThreadProxy::RequestVSyncNotification(VSyncClient* client)
|
| +{
|
| + DCHECK(isImplThread());
|
| + m_vsyncClient = client;
|
| + m_layerTreeHostImpl->enableVSyncNotification(client);
|
| +}
|
| +
|
| ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState()
|
| : memoryAllocationLimitBytes(0)
|
| {
|
|
|