| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // region that the given point hits. | 371 // region that the given point hits. |
| 372 for (; layer_impl; layer_impl = layer_impl->parent()) { | 372 for (; layer_impl; layer_impl = layer_impl->parent()) { |
| 373 if (LayerTreeHostCommon::LayerHasTouchEventHandlersAt(device_viewport_point, | 373 if (LayerTreeHostCommon::LayerHasTouchEventHandlersAt(device_viewport_point, |
| 374 layer_impl)) | 374 layer_impl)) |
| 375 return true; | 375 return true; |
| 376 } | 376 } |
| 377 | 377 |
| 378 return false; | 378 return false; |
| 379 } | 379 } |
| 380 | 380 |
| 381 void LayerTreeHostImpl::DidReceiveLastInputEventForVSync( | 381 void LayerTreeHostImpl::DidReceiveLastInputEventForBeginFrame( |
| 382 base::TimeTicks frame_time) { | 382 base::TimeTicks frame_time) { |
| 383 client_->DidReceiveLastInputEventForVSync(frame_time); | 383 client_->DidReceiveLastInputEventForBeginFrameOnImplThread(frame_time); |
| 384 } | 384 } |
| 385 | 385 |
| 386 void LayerTreeHostImpl::TrackDamageForAllSurfaces( | 386 void LayerTreeHostImpl::TrackDamageForAllSurfaces( |
| 387 LayerImpl* root_draw_layer, | 387 LayerImpl* root_draw_layer, |
| 388 const LayerImplList& render_surface_layer_list) { | 388 const LayerImplList& render_surface_layer_list) { |
| 389 // For now, we use damage tracking to compute a global scissor. To do this, we | 389 // For now, we use damage tracking to compute a global scissor. To do this, we |
| 390 // must compute all damage tracking before drawing anything, so that we know | 390 // must compute all damage tracking before drawing anything, so that we know |
| 391 // the root damage rect. The root damage rect is then used to scissor each | 391 // the root damage rect. The root damage rect is then used to scissor each |
| 392 // surface. | 392 // surface. |
| 393 | 393 |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 | 1037 |
| 1038 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { | 1038 void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { |
| 1039 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1039 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase, | 1042 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase, |
| 1043 base::TimeDelta interval) { | 1043 base::TimeDelta interval) { |
| 1044 client_->OnVSyncParametersChanged(timebase, interval); | 1044 client_->OnVSyncParametersChanged(timebase, interval); |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 void LayerTreeHostImpl::DidVSync(base::TimeTicks frame_time) { | 1047 void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) { |
| 1048 client_->DidVSync(frame_time); | 1048 client_->BeginFrameOnImplThread(frame_time); |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( | 1051 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck( |
| 1052 const CompositorFrameAck& ack) { | 1052 const CompositorFrameAck& ack) { |
| 1053 if (!renderer_) | 1053 if (!renderer_) |
| 1054 return; | 1054 return; |
| 1055 | 1055 |
| 1056 // TODO(piman): We may need to do some validation on this ack before | 1056 // TODO(piman): We may need to do some validation on this ack before |
| 1057 // processing it. | 1057 // processing it. |
| 1058 renderer_->ReceiveCompositorFrameAck(ack); | 1058 renderer_->ReceiveCompositorFrameAck(ack); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 } | 1189 } |
| 1190 | 1190 |
| 1191 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { | 1191 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
| 1192 if (frame.has_no_damage) | 1192 if (frame.has_no_damage) |
| 1193 return false; | 1193 return false; |
| 1194 renderer_->SwapBuffers(frame.latency_info); | 1194 renderer_->SwapBuffers(frame.latency_info); |
| 1195 active_tree_->ClearLatencyInfo(); | 1195 active_tree_->ClearLatencyInfo(); |
| 1196 return true; | 1196 return true; |
| 1197 } | 1197 } |
| 1198 | 1198 |
| 1199 void LayerTreeHostImpl::EnableVSyncNotification(bool enable) { | 1199 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { |
| 1200 if (output_surface_) | 1200 if (output_surface_) |
| 1201 output_surface_->EnableVSyncNotification(enable); | 1201 output_surface_->SetNeedsBeginFrame(enable); |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 gfx::Size LayerTreeHostImpl::DeviceViewportSize() const { | 1204 gfx::Size LayerTreeHostImpl::DeviceViewportSize() const { |
| 1205 return device_viewport_size(); | 1205 return device_viewport_size(); |
| 1206 } | 1206 } |
| 1207 | 1207 |
| 1208 gfx::SizeF LayerTreeHostImpl::VisibleViewportSize() const { | 1208 gfx::SizeF LayerTreeHostImpl::VisibleViewportSize() const { |
| 1209 gfx::SizeF dip_size = | 1209 gfx::SizeF dip_size = |
| 1210 gfx::ScaleSize(DeviceViewportSize(), 1.f / device_scale_factor()); | 1210 gfx::ScaleSize(DeviceViewportSize(), 1.f / device_scale_factor()); |
| 1211 | 1211 |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2234 } | 2234 } |
| 2235 | 2235 |
| 2236 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2236 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
| 2237 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2237 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
| 2238 paint_time_counter_->ClearHistory(); | 2238 paint_time_counter_->ClearHistory(); |
| 2239 | 2239 |
| 2240 debug_state_ = debug_state; | 2240 debug_state_ = debug_state; |
| 2241 } | 2241 } |
| 2242 | 2242 |
| 2243 } // namespace cc | 2243 } // namespace cc |
| OLD | NEW |