| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // region that the given point hits. | 361 // region that the given point hits. |
| 362 for (; layer_impl; layer_impl = layer_impl->parent()) { | 362 for (; layer_impl; layer_impl = layer_impl->parent()) { |
| 363 if (LayerTreeHostCommon::LayerHasTouchEventHandlersAt(device_viewport_point, | 363 if (LayerTreeHostCommon::LayerHasTouchEventHandlersAt(device_viewport_point, |
| 364 layer_impl)) | 364 layer_impl)) |
| 365 return true; | 365 return true; |
| 366 } | 366 } |
| 367 | 367 |
| 368 return false; | 368 return false; |
| 369 } | 369 } |
| 370 | 370 |
| 371 void LayerTreeHostImpl::DidReceiveLastInputEventForVSync( | 371 void LayerTreeHostImpl::DidReceiveLastInputEventForBeginFrame( |
| 372 base::TimeTicks frame_time) { | 372 base::TimeTicks frame_time) { |
| 373 client_->DidReceiveLastInputEventForVSync(frame_time); | 373 client_->DidReceiveLastInputEventForBeginFrame(frame_time); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void LayerTreeHostImpl::TrackDamageForAllSurfaces( | 376 void LayerTreeHostImpl::TrackDamageForAllSurfaces( |
| 377 LayerImpl* root_draw_layer, | 377 LayerImpl* root_draw_layer, |
| 378 const LayerImplList& render_surface_layer_list) { | 378 const LayerImplList& render_surface_layer_list) { |
| 379 // For now, we use damage tracking to compute a global scissor. To do this, we | 379 // For now, we use damage tracking to compute a global scissor. To do this, we |
| 380 // must compute all damage tracking before drawing anything, so that we know | 380 // must compute all damage tracking before drawing anything, so that we know |
| 381 // the root damage rect. The root damage rect is then used to scissor each | 381 // the root damage rect. The root damage rect is then used to scissor each |
| 382 // surface. | 382 // surface. |
| 383 | 383 |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 | 1006 |
| 1007 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { | 1007 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { |
| 1008 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1008 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase, | 1011 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase, |
| 1012 base::TimeDelta interval) { | 1012 base::TimeDelta interval) { |
| 1013 client_->OnVSyncParametersChanged(timebase, interval); | 1013 client_->OnVSyncParametersChanged(timebase, interval); |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 void LayerTreeHostImpl::DidVSync(base::TimeTicks frame_time) { | 1016 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) { |
| 1017 client_->DidVSync(frame_time); | 1017 client_->DidBeginFrame(frame_time); |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( | 1020 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( |
| 1021 const CompositorFrameAck& ack) { | 1021 const CompositorFrameAck& ack) { |
| 1022 if (!renderer_) | 1022 if (!renderer_) |
| 1023 return; | 1023 return; |
| 1024 | 1024 |
| 1025 // TODO(piman): We may need to do some validation on this ack before | 1025 // TODO(piman): We may need to do some validation on this ack before |
| 1026 // processing it. | 1026 // processing it. |
| 1027 renderer_->ReceiveCompositorFrameAck(ack); | 1027 renderer_->ReceiveCompositorFrameAck(ack); |
| (...skipping 131 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::EnableBeginFrameNotification(bool enable) { |
| 1170 if (output_surface_) | 1170 if (output_surface_) |
| 1171 output_surface_->EnableVSyncNotification(enable); | 1171 output_surface_->EnableBeginFrameNotification(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 |