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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 15836005: cc: Emulate BeginFrame in OutputSurfaces that don't support it natively (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc
Patch Set: Ignore last patch set: bad upload. Created 7 years, 6 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
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index ae3b2b6f1aa1abe466b5905f3f0c62dcf6506231..0654b581ebdc8c4ac4a9fdfaee9741fa67b1c9c7 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1044,11 +1044,6 @@ void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) {
client_->SetNeedsRedrawRectOnImplThread(damage_rect);
}
-void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase,
- base::TimeDelta interval) {
- client_->OnVSyncParametersChanged(timebase, interval);
-}
-
void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) {
client_->BeginFrameOnImplThread(frame_time);
}
@@ -1492,6 +1487,28 @@ bool LayerTreeHostImpl::InitializeRenderer(
resource_provider_ = resource_provider.Pass();
}
+ // Setup BeginFrameEmulation if it's not supported natively
+ if (!settings_.begin_frame_scheduling_enabled) {
+ const base::TimeDelta display_refresh_interval =
+ base::TimeDelta::FromMicroseconds(
+ base::Time::kMicrosecondsPerSecond /
+ settings_.refresh_rate);
+
+ output_surface->InitializeBeginFrameEmulation(
+ proxy_->ImplThread(),
+ settings_.throttle_frame_production,
+ display_refresh_interval,
+ GetRendererCapabilities().using_swap_complete_callback || true);
+ }
+
+ int max_frames_pending =
+ output_surface->capabilities().max_frames_pending;
+ if (max_frames_pending <= 0)
+ max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING;
+ if (output_surface->capabilities().has_parent_compositor)
+ max_frames_pending = 1;
+ output_surface->SetMaxFramesPending(max_frames_pending);
+
output_surface_ = output_surface.Pass();
if (!visible_)

Powered by Google App Engine
This is Rietveld 408576698