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

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: 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
« cc/test/fake_output_surface.h ('K') | « 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 ba621e2576d6c8a5a02f0b79c8f4b9680196d4a2..d977bb54ede004d2a15b6728ab8282b87742cd16 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,19 @@ 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_)
jamesr 2013/03/23 00:35:29 is it valid to call DidVSync without a vsync_clien
Sami 2013/03/25 13:58:33 Because enabling and disabling the callback is don
+ vsync_client_->DidVSync(frame_time);
+}
+
+void ThreadProxy::RequestVSyncNotification(VSyncClient* client) {
+ DCHECK(IsImplThread());
+ vsync_client_ = client;
jamesr 2013/03/23 00:35:29 I think it's worth tracing this too just to make i
Sami 2013/03/25 13:58:33 Good idea, done.
+ layer_tree_host_impl_->EnableVSyncNotification(client);
+}
+
void ThreadProxy::OnCanDrawStateChanged(bool can_draw) {
DCHECK(IsImplThread());
TRACE_EVENT1(
@@ -1065,9 +1082,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(
- displayRefreshInterval, 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(
+ displayRefreshInterval, Proxy::ImplThread())));
+ }
} else {
frame_rate_controller.reset(new FrameRateController(Proxy::ImplThread()));
}
@@ -1126,10 +1148,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();
}
« cc/test/fake_output_surface.h ('K') | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698