| 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/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // region that the given point hits. | 363 // region that the given point hits. |
| 364 for (; layer_impl; layer_impl = layer_impl->parent()) { | 364 for (; layer_impl; layer_impl = layer_impl->parent()) { |
| 365 if (LayerTreeHostCommon::LayerHasTouchEventHandlersAt(device_viewport_point, | 365 if (LayerTreeHostCommon::LayerHasTouchEventHandlersAt(device_viewport_point, |
| 366 layer_impl)) | 366 layer_impl)) |
| 367 return true; | 367 return true; |
| 368 } | 368 } |
| 369 | 369 |
| 370 return false; | 370 return false; |
| 371 } | 371 } |
| 372 | 372 |
| 373 void LayerTreeHostImpl::DidReceiveLastInputEventForVSync( | 373 void LayerTreeHostImpl::DidReceiveLastInputEventForBeginImplFrame( |
| 374 base::TimeTicks frame_time) { | 374 base::TimeTicks frame_time) { |
| 375 client_->DidReceiveLastInputEventForVSync(frame_time); | 375 client_->DidReceiveLastInputEventForBeginImplFrame(frame_time); |
| 376 } | 376 } |
| 377 | 377 |
| 378 void LayerTreeHostImpl::TrackDamageForAllSurfaces( | 378 void LayerTreeHostImpl::TrackDamageForAllSurfaces( |
| 379 LayerImpl* root_draw_layer, | 379 LayerImpl* root_draw_layer, |
| 380 const LayerImplList& render_surface_layer_list) { | 380 const LayerImplList& render_surface_layer_list) { |
| 381 // For now, we use damage tracking to compute a global scissor. To do this, we | 381 // For now, we use damage tracking to compute a global scissor. To do this, we |
| 382 // must compute all damage tracking before drawing anything, so that we know | 382 // must compute all damage tracking before drawing anything, so that we know |
| 383 // the root damage rect. The root damage rect is then used to scissor each | 383 // the root damage rect. The root damage rect is then used to scissor each |
| 384 // surface. | 384 // surface. |
| 385 | 385 |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 | 1008 |
| 1009 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { | 1009 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { |
| 1010 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1010 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase, | 1013 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase, |
| 1014 base::TimeDelta interval) { | 1014 base::TimeDelta interval) { |
| 1015 client_->OnVSyncParametersChanged(timebase, interval); | 1015 client_->OnVSyncParametersChanged(timebase, interval); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 void LayerTreeHostImpl::DidVSync(base::TimeTicks frame_time) { | 1018 void LayerTreeHostImpl::BeginImplFrame(base::TimeTicks frame_time) { |
| 1019 client_->DidVSync(frame_time); | 1019 client_->DidBeginImplFrame(frame_time); |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( | 1022 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( |
| 1023 const CompositorFrameAck& ack) { | 1023 const CompositorFrameAck& ack) { |
| 1024 if (!renderer_) | 1024 if (!renderer_) |
| 1025 return; | 1025 return; |
| 1026 | 1026 |
| 1027 // TODO(piman): We may need to do some validation on this ack before | 1027 // TODO(piman): We may need to do some validation on this ack before |
| 1028 // processing it. | 1028 // processing it. |
| 1029 renderer_->ReceiveCompositorFrameAck(ack); | 1029 renderer_->ReceiveCompositorFrameAck(ack); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { | 1161 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
| 1162 if (frame.has_no_damage) | 1162 if (frame.has_no_damage) |
| 1163 return false; | 1163 return false; |
| 1164 renderer_->SwapBuffers(frame.latency_info); | 1164 renderer_->SwapBuffers(frame.latency_info); |
| 1165 active_tree_->ClearLatencyInfo(); | 1165 active_tree_->ClearLatencyInfo(); |
| 1166 return true; | 1166 return true; |
| 1167 } | 1167 } |
| 1168 | 1168 |
| 1169 void LayerTreeHostImpl::EnableVSyncNotification(bool enable) { | 1169 void LayerTreeHostImpl::SetNeedsBeginImplFrame(bool enable) { |
| 1170 if (output_surface_) | 1170 if (output_surface_) |
| 1171 output_surface_->EnableVSyncNotification(enable); | 1171 output_surface_->SetNeedsBeginImplFrame(enable); |
| 1172 } | 1172 } |
| 1173 | 1173 |
| 1174 gfx::Size LayerTreeHostImpl::DeviceViewportSize() const { | 1174 gfx::Size LayerTreeHostImpl::DeviceViewportSize() const { |
| 1175 return device_viewport_size(); | 1175 return device_viewport_size(); |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 gfx::SizeF LayerTreeHostImpl::VisibleViewportSize() const { | 1178 gfx::SizeF LayerTreeHostImpl::VisibleViewportSize() const { |
| 1179 gfx::SizeF dip_size = | 1179 gfx::SizeF dip_size = |
| 1180 gfx::ScaleSize(DeviceViewportSize(), 1.f / device_scale_factor()); | 1180 gfx::ScaleSize(DeviceViewportSize(), 1.f / device_scale_factor()); |
| 1181 | 1181 |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2163 } | 2163 } |
| 2164 | 2164 |
| 2165 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2165 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
| 2166 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2166 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
| 2167 paint_time_counter_->ClearHistory(); | 2167 paint_time_counter_->ClearHistory(); |
| 2168 | 2168 |
| 2169 debug_state_ = debug_state; | 2169 debug_state_ = debug_state; |
| 2170 } | 2170 } |
| 2171 | 2171 |
| 2172 } // namespace cc | 2172 } // namespace cc |
| OLD | NEW |