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

Unified Diff: sky/compositor/layer_host.cc

Issue 753643002: Enable the Sky compositor again (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/surface_holder.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 a1991770c3b4a827fc12f5835b09c1ecaf06d38c..ad2ed69a68ad966b8d8273699ea1925b59cbfd07 100644
--- a/sky/compositor/layer_host.cc
+++ b/sky/compositor/layer_host.cc
@@ -15,6 +15,7 @@ namespace sky {
LayerHost::LayerHost(LayerHostClient* client)
: client_(client),
+ state_(kIdle),
surface_holder_(this, client->GetShell()),
gl_context_(mojo::GLContext::Create(client->GetShell())),
ganesh_context_(gl_context_),
@@ -29,6 +30,7 @@ LayerHost::~LayerHost() {
void LayerHost::SetNeedsAnimate() {
scheduler_.SetNeedsFrame();
+ state_ = kWaitingForBeginFrame;
}
void LayerHost::SetRootLayer(scoped_refptr<Layer> layer) {
@@ -39,6 +41,9 @@ void LayerHost::SetRootLayer(scoped_refptr<Layer> layer) {
void LayerHost::OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) {
client_->OnSurfaceIdAvailable(surface_id.Pass());
+
+ if (state_ == kWaitingForSurfaceToUploadFrame)
+ Upload(root_layer_.get());
}
void LayerHost::ReturnResources(
@@ -48,6 +53,8 @@ void LayerHost::ReturnResources(
void LayerHost::BeginFrame(base::TimeTicks frame_time,
base::TimeTicks deadline) {
+ DCHECK_EQ(state_, kWaitingForBeginFrame);
+ state_ = kProducingFrame;
client_->BeginFrame(frame_time);
{
@@ -57,9 +64,18 @@ void LayerHost::BeginFrame(base::TimeTicks frame_time,
}
Upload(root_layer_.get());
+
+ if (state_ == kProducingFrame)
+ state_ = kIdle;
}
void LayerHost::Upload(Layer* layer) {
+ if (!surface_holder_.IsReadyForFrame()) {
+ if (state_ == kProducingFrame)
esprehn 2014/11/21 19:34:45 What schedules the eventual upload if it wasn't re
abarth-chromium 2014/11/21 20:01:17 The OnSurfaceIdAvailable callback is called whenev
+ state_ = kWaitingForSurfaceToUploadFrame;
+ return;
+ }
+
gfx::Size size = layer->size();
surface_holder_.SetSize(size);
« no previous file with comments | « sky/compositor/layer_host.h ('k') | sky/compositor/surface_holder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698