Index: sky/compositor/layer_host.cc |
diff --git a/sky/compositor/layer_host.cc b/sky/compositor/layer_host.cc |
index 2cd2de038c4bc98ffc07d13f47104f4305d50ba5..a00dbd98c194248345da9072f89c75d0b14b3729 100644 |
--- a/sky/compositor/layer_host.cc |
+++ b/sky/compositor/layer_host.cc |
@@ -4,6 +4,7 @@ |
#include "sky/compositor/layer_host.h" |
+#include "base/message_loop/message_loop.h" |
#include "mojo/converters/geometry/geometry_type_converters.h" |
#include "mojo/gpu/gl_context.h" |
#include "mojo/services/public/cpp/surfaces/surfaces_utils.h" |
@@ -17,13 +18,17 @@ LayerHost::LayerHost(LayerHostClient* client) |
surface_holder_(this, client->GetShell()), |
gl_context_(mojo::GLContext::Create(client->GetShell())), |
ganesh_context_(gl_context_), |
- resource_manager_(gl_context_) { |
+ resource_manager_(gl_context_), |
+ scheduler_(this, base::MessageLoop::current()->task_runner()) { |
+ scheduler_.UpdateVSync( |
+ TimeInterval(base::TimeTicks(), base::TimeDelta::FromSecondsD(1.0 / 60))); |
} |
LayerHost::~LayerHost() { |
} |
void LayerHost::SetNeedsAnimate() { |
+ scheduler_.SetNeedsFrame(); |
} |
void LayerHost::SetRootLayer(scoped_refptr<Layer> layer) { |
@@ -32,12 +37,6 @@ void LayerHost::SetRootLayer(scoped_refptr<Layer> layer) { |
root_layer_->set_host(this); |
} |
-void LayerHost::OnReadyForNextFrame() { |
- client_->BeginFrame(); |
- root_layer_->Display(); |
- Upload(root_layer_.get()); |
-} |
- |
void LayerHost::OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) { |
client_->OnSurfaceIdAvailable(surface_id.Pass()); |
} |
@@ -47,6 +46,13 @@ void LayerHost::ReturnResources( |
resource_manager_.ReturnResources(resources.Pass()); |
} |
+void LayerHost::BeginFrame(base::TimeTicks frame_time, |
+ base::TimeTicks deadline) { |
+ client_->BeginFrame(frame_time); |
+ root_layer_->Display(); |
+ Upload(root_layer_.get()); |
+} |
+ |
void LayerHost::Upload(Layer* layer) { |
gfx::Size size = layer->size(); |
surface_holder_.SetSize(size); |