| 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 21 matching lines...) Expand all Loading... |
| 32 if (frame_requested_) | 32 if (frame_requested_) |
| 33 return; | 33 return; |
| 34 frame_requested_ = true; | 34 frame_requested_ = true; |
| 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); | |
| 43 } | |
| 44 | |
| 45 void LayerHost::GetPixelsForTesting(std::vector<unsigned char>* pixels) { | |
| 46 return root_layer_->GetPixelsForTesting(pixels); | |
| 47 } | 42 } |
| 48 | 43 |
| 49 void LayerHost::OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) { | 44 void LayerHost::OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) { |
| 50 client_->OnSurfaceIdAvailable(surface_id.Pass()); | 45 client_->OnSurfaceIdAvailable(surface_id.Pass()); |
| 51 } | 46 } |
| 52 | 47 |
| 53 void LayerHost::ReturnResources( | 48 void LayerHost::ReturnResources( |
| 54 mojo::Array<mojo::ReturnedResourcePtr> resources) { | 49 mojo::Array<mojo::ReturnedResourcePtr> resources) { |
| 55 resource_manager_.ReturnResources(resources.Pass()); | 50 resource_manager_.ReturnResources(resources.Pass()); |
| 56 } | 51 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 142 } |
| 148 | 143 |
| 149 void LayerHost::DidCompleteFrame() { | 144 void LayerHost::DidCompleteFrame() { |
| 150 DCHECK_EQ(state_, kWaitingForFrameAcknowldgement); | 145 DCHECK_EQ(state_, kWaitingForFrameAcknowldgement); |
| 151 state_ = kReadyForFrame; | 146 state_ = kReadyForFrame; |
| 152 if (frame_requested_) | 147 if (frame_requested_) |
| 153 BeginFrame(); | 148 BeginFrame(); |
| 154 } | 149 } |
| 155 | 150 |
| 156 } // namespace sky | 151 } // namespace sky |
| OLD | NEW |