| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sky/compositor/layer_host.h" | 5 #include "sky/compositor/layer_host.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 10 #include "mojo/gpu/gl_context.h" | 10 #include "mojo/gpu/gl_context.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 if (state_ == kReadyForFrame) | 35 if (state_ == kReadyForFrame) |
| 36 BeginFrameSoon(); | 36 BeginFrameSoon(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void LayerHost::SetRootLayer(scoped_refptr<Layer> layer) { | 39 void LayerHost::SetRootLayer(scoped_refptr<Layer> layer) { |
| 40 DCHECK(!root_layer_.get()); | 40 DCHECK(!root_layer_.get()); |
| 41 root_layer_ = layer; | 41 root_layer_ = layer; |
| 42 root_layer_->set_host(this); | 42 root_layer_->set_host(this); |
| 43 } | 43 } |
| 44 | 44 |
| 45 std::string LayerHost::GetPixels() { |
| 46 return root_layer_->GetPixels(); |
| 47 } |
| 48 |
| 45 void LayerHost::OnSurfaceConnectionCreated() { | 49 void LayerHost::OnSurfaceConnectionCreated() { |
| 46 DCHECK_EQ(state_, kWaitingForSurfaceService); | 50 DCHECK_EQ(state_, kWaitingForSurfaceService); |
| 47 state_ = kReadyForFrame; | 51 state_ = kReadyForFrame; |
| 48 if (frame_requested_) | 52 if (frame_requested_) |
| 49 BeginFrameSoon(); | 53 BeginFrameSoon(); |
| 50 } | 54 } |
| 51 | 55 |
| 52 void LayerHost::OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) { | 56 void LayerHost::OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) { |
| 53 client_->OnSurfaceIdAvailable(surface_id.Pass()); | 57 client_->OnSurfaceIdAvailable(surface_id.Pass()); |
| 54 } | 58 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 154 } |
| 151 | 155 |
| 152 void LayerHost::DidCompleteFrame() { | 156 void LayerHost::DidCompleteFrame() { |
| 153 DCHECK_EQ(state_, kWaitingForFrameAcknowldgement); | 157 DCHECK_EQ(state_, kWaitingForFrameAcknowldgement); |
| 154 state_ = kReadyForFrame; | 158 state_ = kReadyForFrame; |
| 155 if (frame_requested_) | 159 if (frame_requested_) |
| 156 BeginFrame(); | 160 BeginFrame(); |
| 157 } | 161 } |
| 158 | 162 |
| 159 } // namespace sky | 163 } // namespace sky |
| OLD | NEW |