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

Unified Diff: cc/trees/thread_proxy.cc

Issue 12674030: cc: Hook vsync time source to output surface (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Review tweaks. Created 7 years, 9 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/trees/thread_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 264c11f098a84248ce2cf74a7482083fddd9f478..dee475e4dedfa37f2e74405a51254e3b26917dbc 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -16,6 +16,7 @@
#include "cc/scheduler/delay_based_time_source.h"
#include "cc/scheduler/frame_rate_controller.h"
#include "cc/scheduler/scheduler.h"
+#include "cc/scheduler/vsync_time_source.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_impl.h"
@@ -59,6 +60,9 @@ ThreadProxy::ThreadProxy(LayerTreeHost* layer_tree_host,
texture_acquisition_completion_event_on_impl_thread_(NULL),
next_frame_is_newly_committed_frame_on_impl_thread_(false),
render_vsync_enabled_(layer_tree_host->settings().render_vsync_enabled),
+ render_vsync_notification_enabled_(
+ layer_tree_host->settings().render_vsync_notification_enabled),
+ vsync_client_(NULL),
inside_draw_(false),
defer_commits_(false),
renew_tree_priority_on_impl_thread_pending_(false) {
@@ -350,6 +354,21 @@ void ThreadProxy::OnVSyncParametersChanged(base::TimeTicks timebase,
scheduler_on_impl_thread_->SetTimebaseAndInterval(timebase, interval);
}
+void ThreadProxy::DidVSync(base::TimeTicks frame_time) {
+ DCHECK(IsImplThread());
+ TRACE_EVENT0("cc", "ThreadProxy::DidVSync");
+ if (vsync_client_)
+ vsync_client_->DidVSync(frame_time);
+}
+
+void ThreadProxy::RequestVSyncNotification(VSyncClient* client) {
+ DCHECK(IsImplThread());
+ TRACE_EVENT1(
+ "cc", "ThreadProxy::RequestVSyncNotification", "enable", !!client);
+ vsync_client_ = client;
+ layer_tree_host_impl_->EnableVSyncNotification(client);
+}
+
void ThreadProxy::OnCanDrawStateChanged(bool can_draw) {
DCHECK(IsImplThread());
TRACE_EVENT1(
@@ -1065,9 +1084,14 @@ void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion,
60);
scoped_ptr<FrameRateController> frame_rate_controller;
if (render_vsync_enabled_) {
- frame_rate_controller.reset(
- new FrameRateController(DelayBasedTimeSource::Create(
- display_refresh_interval, Proxy::ImplThread())));
+ if (render_vsync_notification_enabled_) {
+ frame_rate_controller.reset(
+ new FrameRateController(VSyncTimeSource::Create(this)));
+ } else {
+ frame_rate_controller.reset(
+ new FrameRateController(DelayBasedTimeSource::Create(
+ display_refresh_interval, Proxy::ImplThread())));
+ }
} else {
frame_rate_controller.reset(new FrameRateController(Proxy::ImplThread()));
}
@@ -1126,10 +1150,12 @@ void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
DCHECK(IsImplThread());
layer_tree_host_->DeleteContentsTexturesOnImplThread(
layer_tree_host_impl_->resource_provider());
+ layer_tree_host_impl_->EnableVSyncNotification(false);
input_handler_on_impl_thread_.reset();
layer_tree_host_impl_.reset();
scheduler_on_impl_thread_.reset();
weak_factory_on_impl_thread_.InvalidateWeakPtrs();
+ vsync_client_ = NULL;
completion->Signal();
}
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698