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

Unified Diff: sky/compositor/layer_host.cc

Issue 744753003: Use the scheduler to drive the Sky compositor (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « sky/compositor/layer_host.h ('k') | sky/compositor/layer_host_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « sky/compositor/layer_host.h ('k') | sky/compositor/layer_host_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698