| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 void LayerTreeHostImpl::BeginCommit() {} | 224 void LayerTreeHostImpl::BeginCommit() {} |
| 225 | 225 |
| 226 void LayerTreeHostImpl::CommitComplete() { | 226 void LayerTreeHostImpl::CommitComplete() { |
| 227 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 227 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
| 228 | 228 |
| 229 // Impl-side painting needs an update immediately post-commit to have the | 229 // Impl-side painting needs an update immediately post-commit to have the |
| 230 // opportunity to create tilings. Other paths can call UpdateDrawProperties | 230 // opportunity to create tilings. Other paths can call UpdateDrawProperties |
| 231 // more lazily when needed prior to drawing. | 231 // more lazily when needed prior to drawing. |
| 232 if (settings_.impl_side_painting) { | 232 if (settings_.impl_side_painting) { |
| 233 pending_tree_->set_needs_update_draw_properties(); | 233 pending_tree_->set_needs_update_draw_properties(); |
| 234 pending_tree_->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE); | 234 pending_tree_->UpdateDrawProperties(); |
| 235 } else { | 235 } else { |
| 236 active_tree_->set_needs_update_draw_properties(); | 236 active_tree_->set_needs_update_draw_properties(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 client_->SendManagedMemoryStats(); | 239 client_->SendManagedMemoryStats(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 bool LayerTreeHostImpl::CanDraw() { | 242 bool LayerTreeHostImpl::CanDraw() { |
| 243 // Note: If you are changing this function or any other function that might | 243 // Note: If you are changing this function or any other function that might |
| 244 // affect the result of CanDraw, make sure to call | 244 // affect the result of CanDraw, make sure to call |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 it = frame->render_passes.size() - position_from_end; | 849 it = frame->render_passes.size() - position_from_end; |
| 850 DCHECK_GE(frame->render_passes.size(), position_from_end); | 850 DCHECK_GE(frame->render_passes.size(), position_from_end); |
| 851 } | 851 } |
| 852 } | 852 } |
| 853 } | 853 } |
| 854 | 854 |
| 855 bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame, | 855 bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame, |
| 856 gfx::Rect device_viewport_damage_rect) { | 856 gfx::Rect device_viewport_damage_rect) { |
| 857 TRACE_EVENT0("cc", "LayerTreeHostImpl::PrepareToDraw"); | 857 TRACE_EVENT0("cc", "LayerTreeHostImpl::PrepareToDraw"); |
| 858 | 858 |
| 859 active_tree_->UpdateDrawProperties( | 859 active_tree_->UpdateDrawProperties(); |
| 860 LayerTreeImpl::UPDATE_ACTIVE_TREE_FOR_DRAW); | |
| 861 | 860 |
| 862 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); | 861 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); |
| 863 frame->render_passes.clear(); | 862 frame->render_passes.clear(); |
| 864 frame->render_passes_by_id.clear(); | 863 frame->render_passes_by_id.clear(); |
| 865 frame->will_draw_layers.clear(); | 864 frame->will_draw_layers.clear(); |
| 866 frame->contains_incomplete_tile = false; | 865 frame->contains_incomplete_tile = false; |
| 867 frame->has_no_damage = false; | 866 frame->has_no_damage = false; |
| 868 | 867 |
| 869 if (active_tree_->root_layer()) { | 868 if (active_tree_->root_layer()) { |
| 870 device_viewport_damage_rect.Union(viewport_damage_rect_); | 869 device_viewport_damage_rect.Union(viewport_damage_rect_); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 if (tile_manager_) | 1230 if (tile_manager_) |
| 1232 tile_manager_->CheckForCompletedTileUploads(); | 1231 tile_manager_->CheckForCompletedTileUploads(); |
| 1233 } | 1232 } |
| 1234 | 1233 |
| 1235 bool LayerTreeHostImpl::ActivatePendingTreeIfNeeded() { | 1234 bool LayerTreeHostImpl::ActivatePendingTreeIfNeeded() { |
| 1236 if (!pending_tree_) | 1235 if (!pending_tree_) |
| 1237 return false; | 1236 return false; |
| 1238 | 1237 |
| 1239 CHECK(tile_manager_); | 1238 CHECK(tile_manager_); |
| 1240 | 1239 |
| 1241 pending_tree_->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE); | 1240 pending_tree_->UpdateDrawProperties(); |
| 1242 | 1241 |
| 1243 TRACE_EVENT_ASYNC_STEP1("cc", | 1242 TRACE_EVENT_ASYNC_STEP1("cc", |
| 1244 "PendingTree", pending_tree_.get(), "activate", | 1243 "PendingTree", pending_tree_.get(), "activate", |
| 1245 "state", ValueToString(ActivationStateAsValue())); | 1244 "state", ValueToString(ActivationStateAsValue())); |
| 1246 | 1245 |
| 1247 // Activate once all visible resources in pending tree are ready. | 1246 // Activate once all visible resources in pending tree are ready. |
| 1248 if (!pending_tree_->AreVisibleResourcesReady()) | 1247 if (!pending_tree_->AreVisibleResourcesReady()) |
| 1249 return false; | 1248 return false; |
| 1250 | 1249 |
| 1251 ActivatePendingTree(); | 1250 ActivatePendingTree(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 active_tree_->UpdateMaxScrollOffset(); | 1439 active_tree_->UpdateMaxScrollOffset(); |
| 1441 } | 1440 } |
| 1442 | 1441 |
| 1443 void LayerTreeHostImpl::DidChangeTopControlsPosition() { | 1442 void LayerTreeHostImpl::DidChangeTopControlsPosition() { |
| 1444 client_->SetNeedsRedrawOnImplThread(); | 1443 client_->SetNeedsRedrawOnImplThread(); |
| 1445 active_tree_->set_needs_update_draw_properties(); | 1444 active_tree_->set_needs_update_draw_properties(); |
| 1446 SetFullRootLayerDamage(); | 1445 SetFullRootLayerDamage(); |
| 1447 } | 1446 } |
| 1448 | 1447 |
| 1449 bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() { | 1448 bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() { |
| 1450 active_tree_->UpdateDrawProperties(LayerTreeImpl::UPDATE_ACTIVE_TREE); | 1449 active_tree_->UpdateDrawProperties(); |
| 1451 return !active_tree_->RenderSurfaceLayerList().empty(); | 1450 return !active_tree_->RenderSurfaceLayerList().empty(); |
| 1452 } | 1451 } |
| 1453 | 1452 |
| 1454 InputHandlerClient::ScrollStatus LayerTreeHostImpl::ScrollBegin( | 1453 InputHandlerClient::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
| 1455 gfx::Point viewport_point, InputHandlerClient::ScrollInputType type) { | 1454 gfx::Point viewport_point, InputHandlerClient::ScrollInputType type) { |
| 1456 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); | 1455 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); |
| 1457 | 1456 |
| 1458 if (top_controls_manager_) | 1457 if (top_controls_manager_) |
| 1459 top_controls_manager_->ScrollBegin(); | 1458 top_controls_manager_->ScrollBegin(); |
| 1460 | 1459 |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2116 } | 2115 } |
| 2117 | 2116 |
| 2118 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2117 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
| 2119 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2118 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
| 2120 paint_time_counter_->ClearHistory(); | 2119 paint_time_counter_->ClearHistory(); |
| 2121 | 2120 |
| 2122 debug_state_ = debug_state; | 2121 debug_state_ = debug_state; |
| 2123 } | 2122 } |
| 2124 | 2123 |
| 2125 } // namespace cc | 2124 } // namespace cc |
| OLD | NEW |