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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 rendering_stats_instrumentation)); | 158 rendering_stats_instrumentation)); |
159 } | 159 } |
160 | 160 |
161 LayerTreeHostImpl::LayerTreeHostImpl( | 161 LayerTreeHostImpl::LayerTreeHostImpl( |
162 const LayerTreeSettings& settings, | 162 const LayerTreeSettings& settings, |
163 LayerTreeHostImplClient* client, | 163 LayerTreeHostImplClient* client, |
164 Proxy* proxy, | 164 Proxy* proxy, |
165 RenderingStatsInstrumentation* rendering_stats_instrumentation) | 165 RenderingStatsInstrumentation* rendering_stats_instrumentation) |
166 : client_(client), | 166 : client_(client), |
167 proxy_(proxy), | 167 proxy_(proxy), |
168 input_handler_client_(NULL), | |
168 did_lock_scrolling_layer_(false), | 169 did_lock_scrolling_layer_(false), |
169 should_bubble_scrolls_(false), | 170 should_bubble_scrolls_(false), |
170 wheel_scrolling_(false), | 171 wheel_scrolling_(false), |
171 settings_(settings), | 172 settings_(settings), |
172 overdraw_bottom_height_(0.f), | 173 overdraw_bottom_height_(0.f), |
173 device_scale_factor_(1.f), | 174 device_scale_factor_(1.f), |
174 visible_(true), | 175 visible_(true), |
175 managed_memory_policy_( | 176 managed_memory_policy_( |
176 PrioritizedResourceManager::DefaultMemoryAllocationLimit(), | 177 PrioritizedResourceManager::DefaultMemoryAllocationLimit(), |
177 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, | 178 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 TRACE_EVENT_INSTANT0( | 272 TRACE_EVENT_INSTANT0( |
272 "cc", "LayerTreeHostImpl::CanDraw contents textures purged", | 273 "cc", "LayerTreeHostImpl::CanDraw contents textures purged", |
273 TRACE_EVENT_SCOPE_THREAD); | 274 TRACE_EVENT_SCOPE_THREAD); |
274 return false; | 275 return false; |
275 } | 276 } |
276 return true; | 277 return true; |
277 } | 278 } |
278 | 279 |
279 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time, | 280 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time, |
280 base::Time wall_clock_time) { | 281 base::Time wall_clock_time) { |
282 if (input_handler_client_) | |
283 input_handler_client_->Animate(monotonic_time); | |
281 AnimatePageScale(monotonic_time); | 284 AnimatePageScale(monotonic_time); |
282 AnimateLayers(monotonic_time, wall_clock_time); | 285 AnimateLayers(monotonic_time, wall_clock_time); |
283 AnimateScrollbars(monotonic_time); | 286 AnimateScrollbars(monotonic_time); |
284 AnimateTopControls(monotonic_time); | 287 AnimateTopControls(monotonic_time); |
285 } | 288 } |
286 | 289 |
287 void LayerTreeHostImpl::ManageTiles() { | 290 void LayerTreeHostImpl::ManageTiles() { |
288 DCHECK(tile_manager_); | 291 DCHECK(tile_manager_); |
289 tile_manager_->ManageTiles(); | 292 tile_manager_->ManageTiles(); |
290 | 293 |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
714 RemoveRenderPasses(CullRenderPassesWithNoQuads(), frame); | 717 RemoveRenderPasses(CullRenderPassesWithNoQuads(), frame); |
715 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); | 718 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); |
716 RemoveRenderPasses(CullRenderPassesWithCachedTextures(renderer_.get()), | 719 RemoveRenderPasses(CullRenderPassesWithCachedTextures(renderer_.get()), |
717 frame); | 720 frame); |
718 | 721 |
719 // If we're making a frame to draw, it better have at least one render pass. | 722 // If we're making a frame to draw, it better have at least one render pass. |
720 DCHECK(!frame->render_passes.empty()); | 723 DCHECK(!frame->render_passes.empty()); |
721 return draw_frame; | 724 return draw_frame; |
722 } | 725 } |
723 | 726 |
727 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { | |
728 if (input_handler_client_) | |
729 input_handler_client_->MainThreadHasStoppedFlinging(); | |
730 } | |
731 | |
724 void LayerTreeHostImpl::UpdateBackgroundAnimateTicking( | 732 void LayerTreeHostImpl::UpdateBackgroundAnimateTicking( |
725 bool should_background_tick) { | 733 bool should_background_tick) { |
726 bool enabled = should_background_tick && | 734 bool enabled = should_background_tick && |
727 !animation_registrar_->active_animation_controllers().empty(); | 735 !animation_registrar_->active_animation_controllers().empty(); |
728 | 736 |
729 // Lazily create the time_source adapter so that we can vary the interval for | 737 // Lazily create the time_source adapter so that we can vary the interval for |
730 // testing. | 738 // testing. |
731 if (!time_source_client_adapter_) { | 739 if (!time_source_client_adapter_) { |
732 time_source_client_adapter_ = LayerTreeHostImplTimeSourceAdapter::Create( | 740 time_source_client_adapter_ = LayerTreeHostImplTimeSourceAdapter::Create( |
733 this, | 741 this, |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1451 client_->SetNeedsRedrawOnImplThread(); | 1459 client_->SetNeedsRedrawOnImplThread(); |
1452 active_tree_->set_needs_update_draw_properties(); | 1460 active_tree_->set_needs_update_draw_properties(); |
1453 SetFullRootLayerDamage(); | 1461 SetFullRootLayerDamage(); |
1454 } | 1462 } |
1455 | 1463 |
1456 bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() { | 1464 bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() { |
1457 active_tree_->UpdateDrawProperties(LayerTreeImpl::UPDATE_ACTIVE_TREE); | 1465 active_tree_->UpdateDrawProperties(LayerTreeImpl::UPDATE_ACTIVE_TREE); |
1458 return !active_tree_->RenderSurfaceLayerList().empty(); | 1466 return !active_tree_->RenderSurfaceLayerList().empty(); |
1459 } | 1467 } |
1460 | 1468 |
1469 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { | |
1470 input_handler_client_ = client; | |
danakj
2013/05/01 19:20:43
DCHECK(input_handler_client_ == NULL) ?
| |
1471 } | |
1472 | |
1461 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( | 1473 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
1462 gfx::Point viewport_point, InputHandler::ScrollInputType type) { | 1474 gfx::Point viewport_point, InputHandler::ScrollInputType type) { |
1463 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); | 1475 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); |
1464 | 1476 |
1465 if (top_controls_manager_) | 1477 if (top_controls_manager_) |
1466 top_controls_manager_->ScrollBegin(); | 1478 top_controls_manager_->ScrollBegin(); |
1467 | 1479 |
1468 DCHECK(!CurrentlyScrollingLayer()); | 1480 DCHECK(!CurrentlyScrollingLayer()); |
1469 ClearCurrentlyScrollingLayer(); | 1481 ClearCurrentlyScrollingLayer(); |
1470 | 1482 |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2135 } | 2147 } |
2136 | 2148 |
2137 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2149 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
2138 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2150 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
2139 paint_time_counter_->ClearHistory(); | 2151 paint_time_counter_->ClearHistory(); |
2140 | 2152 |
2141 debug_state_ = debug_state; | 2153 debug_state_ = debug_state; |
2142 } | 2154 } |
2143 | 2155 |
2144 } // namespace cc | 2156 } // namespace cc |
OLD | NEW |