OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 } | 983 } |
984 | 984 |
985 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( | 985 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( |
986 const CompositorFrameAck& ack) { | 986 const CompositorFrameAck& ack) { |
987 if (!renderer_) | 987 if (!renderer_) |
988 return; | 988 return; |
989 | 989 |
990 // TODO(piman): We may need to do some validation on this ack before | 990 // TODO(piman): We may need to do some validation on this ack before |
991 // processing it. | 991 // processing it. |
992 renderer_->ReceiveCompositorFrameAck(ack); | 992 renderer_->ReceiveCompositorFrameAck(ack); |
| 993 |
| 994 // When using compositor frame data, the ack doubles as a swap complete ack. |
| 995 OnSwapBuffersComplete(); |
993 } | 996 } |
994 | 997 |
995 void LayerTreeHostImpl::OnCanDrawStateChangedForTree() { | 998 void LayerTreeHostImpl::OnCanDrawStateChangedForTree() { |
996 client_->OnCanDrawStateChanged(CanDraw()); | 999 client_->OnCanDrawStateChanged(CanDraw()); |
997 } | 1000 } |
998 | 1001 |
999 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { | 1002 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { |
1000 CompositorFrameMetadata metadata; | 1003 CompositorFrameMetadata metadata; |
1001 metadata.device_scale_factor = device_scale_factor_; | 1004 metadata.device_scale_factor = device_scale_factor_; |
1002 metadata.page_scale_factor = active_tree_->total_page_scale_factor(); | 1005 metadata.page_scale_factor = active_tree_->total_page_scale_factor(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; | 1145 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; |
1143 return gfx::SizeF(dip_size.width(), | 1146 return gfx::SizeF(dip_size.width(), |
1144 dip_size.height() - top_offset - overdraw_bottom_height_); | 1147 dip_size.height() - top_offset - overdraw_bottom_height_); |
1145 } | 1148 } |
1146 | 1149 |
1147 const LayerTreeSettings& LayerTreeHostImpl::Settings() const { | 1150 const LayerTreeSettings& LayerTreeHostImpl::Settings() const { |
1148 return settings(); | 1151 return settings(); |
1149 } | 1152 } |
1150 | 1153 |
1151 void LayerTreeHostImpl::DidLoseOutputSurface() { | 1154 void LayerTreeHostImpl::DidLoseOutputSurface() { |
1152 client_->DidLoseOutputSurfaceOnImplThread(); | 1155 // TODO(jamesr): The renderer_ check is needed to make some of the |
| 1156 // LayerTreeHostContextTest tests pass, but shouldn't be necessary (or |
| 1157 // important) in production. We should adjust the test to not need this. |
| 1158 if (renderer_) |
| 1159 client_->DidLoseOutputSurfaceOnImplThread(); |
1153 } | 1160 } |
1154 | 1161 |
1155 void LayerTreeHostImpl::OnSwapBuffersComplete() { | 1162 void LayerTreeHostImpl::OnSwapBuffersComplete() { |
1156 client_->OnSwapBuffersCompleteOnImplThread(); | 1163 client_->OnSwapBuffersCompleteOnImplThread(); |
1157 } | 1164 } |
1158 | 1165 |
1159 void LayerTreeHostImpl::Readback(void* pixels, | 1166 void LayerTreeHostImpl::Readback(void* pixels, |
1160 gfx::Rect rect_in_device_viewport) { | 1167 gfx::Rect rect_in_device_viewport) { |
1161 DCHECK(renderer_); | 1168 DCHECK(renderer_); |
1162 renderer_->GetFramebufferPixels(pixels, rect_in_device_viewport); | 1169 renderer_->GetFramebufferPixels(pixels, rect_in_device_viewport); |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 } | 2095 } |
2089 | 2096 |
2090 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2097 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
2091 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2098 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
2092 paint_time_counter_->ClearHistory(); | 2099 paint_time_counter_->ClearHistory(); |
2093 | 2100 |
2094 debug_state_ = debug_state; | 2101 debug_state_ = debug_state; |
2095 } | 2102 } |
2096 | 2103 |
2097 } // namespace cc | 2104 } // namespace cc |
OLD | NEW |