Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: cc/thread_proxy.cc

Issue 11833009: Provide a vsync notification to the renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/thread_proxy.h ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
{
« no previous file with comments | « cc/thread_proxy.h ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698