| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 void LayerTreeHostImpl::BeginCommit() {} | 226 void LayerTreeHostImpl::BeginCommit() {} |
| 227 | 227 |
| 228 void LayerTreeHostImpl::CommitComplete() { | 228 void LayerTreeHostImpl::CommitComplete() { |
| 229 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 229 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
| 230 | 230 |
| 231 // Impl-side painting needs an update immediately post-commit to have the | 231 // Impl-side painting needs an update immediately post-commit to have the |
| 232 // opportunity to create tilings. Other paths can call UpdateDrawProperties | 232 // opportunity to create tilings. Other paths can call UpdateDrawProperties |
| 233 // more lazily when needed prior to drawing. | 233 // more lazily when needed prior to drawing. |
| 234 if (settings_.impl_side_painting) { | 234 if (settings_.impl_side_painting) { |
| 235 pending_tree_->set_needs_update_draw_properties(); | 235 pending_tree_->set_needs_update_draw_properties(); |
| 236 pending_tree_->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE); | 236 pending_tree_->UpdateDrawProperties(); |
| 237 } else { | 237 } else { |
| 238 active_tree_->set_needs_update_draw_properties(); | 238 active_tree_->set_needs_update_draw_properties(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 client_->SendManagedMemoryStats(); | 241 client_->SendManagedMemoryStats(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 bool LayerTreeHostImpl::CanDraw() { | 244 bool LayerTreeHostImpl::CanDraw() { |
| 245 // Note: If you are changing this function or any other function that might | 245 // Note: If you are changing this function or any other function that might |
| 246 // affect the result of CanDraw, make sure to call | 246 // affect the result of CanDraw, make sure to call |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 it = frame->render_passes.size() - position_from_end; | 872 it = frame->render_passes.size() - position_from_end; |
| 873 DCHECK_GE(frame->render_passes.size(), position_from_end); | 873 DCHECK_GE(frame->render_passes.size(), position_from_end); |
| 874 } | 874 } |
| 875 } | 875 } |
| 876 } | 876 } |
| 877 | 877 |
| 878 bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame, | 878 bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame, |
| 879 gfx::Rect device_viewport_damage_rect) { | 879 gfx::Rect device_viewport_damage_rect) { |
| 880 TRACE_EVENT0("cc", "LayerTreeHostImpl::PrepareToDraw"); | 880 TRACE_EVENT0("cc", "LayerTreeHostImpl::PrepareToDraw"); |
| 881 | 881 |
| 882 active_tree_->UpdateDrawProperties( | 882 active_tree_->UpdateDrawProperties(); |
| 883 LayerTreeImpl::UPDATE_ACTIVE_TREE_FOR_DRAW); | |
| 884 | 883 |
| 885 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); | 884 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); |
| 886 frame->render_passes.clear(); | 885 frame->render_passes.clear(); |
| 887 frame->render_passes_by_id.clear(); | 886 frame->render_passes_by_id.clear(); |
| 888 frame->will_draw_layers.clear(); | 887 frame->will_draw_layers.clear(); |
| 889 frame->contains_incomplete_tile = false; | 888 frame->contains_incomplete_tile = false; |
| 890 frame->has_no_damage = false; | 889 frame->has_no_damage = false; |
| 891 | 890 |
| 892 if (active_tree_->root_layer()) { | 891 if (active_tree_->root_layer()) { |
| 893 device_viewport_damage_rect.Union(viewport_damage_rect_); | 892 device_viewport_damage_rect.Union(viewport_damage_rect_); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 if (tile_manager_) | 1262 if (tile_manager_) |
| 1264 tile_manager_->CheckForCompletedTileUploads(); | 1263 tile_manager_->CheckForCompletedTileUploads(); |
| 1265 } | 1264 } |
| 1266 | 1265 |
| 1267 bool LayerTreeHostImpl::ActivatePendingTreeIfNeeded() { | 1266 bool LayerTreeHostImpl::ActivatePendingTreeIfNeeded() { |
| 1268 if (!pending_tree_) | 1267 if (!pending_tree_) |
| 1269 return false; | 1268 return false; |
| 1270 | 1269 |
| 1271 CHECK(tile_manager_); | 1270 CHECK(tile_manager_); |
| 1272 | 1271 |
| 1273 pending_tree_->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE); | 1272 pending_tree_->UpdateDrawProperties(); |
| 1274 | 1273 |
| 1275 TRACE_EVENT_ASYNC_STEP1("cc", | 1274 TRACE_EVENT_ASYNC_STEP1("cc", |
| 1276 "PendingTree", pending_tree_.get(), "activate", | 1275 "PendingTree", pending_tree_.get(), "activate", |
| 1277 "state", ValueToString(ActivationStateAsValue())); | 1276 "state", ValueToString(ActivationStateAsValue())); |
| 1278 | 1277 |
| 1279 // Activate once all visible resources in pending tree are ready. | 1278 // Activate once all visible resources in pending tree are ready. |
| 1280 if (!pending_tree_->AreVisibleResourcesReady()) | 1279 if (!pending_tree_->AreVisibleResourcesReady()) |
| 1281 return false; | 1280 return false; |
| 1282 | 1281 |
| 1283 ActivatePendingTree(); | 1282 ActivatePendingTree(); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1458 active_tree_->UpdateMaxScrollOffset(); | 1457 active_tree_->UpdateMaxScrollOffset(); |
| 1459 } | 1458 } |
| 1460 | 1459 |
| 1461 void LayerTreeHostImpl::DidChangeTopControlsPosition() { | 1460 void LayerTreeHostImpl::DidChangeTopControlsPosition() { |
| 1462 client_->SetNeedsRedrawOnImplThread(); | 1461 client_->SetNeedsRedrawOnImplThread(); |
| 1463 active_tree_->set_needs_update_draw_properties(); | 1462 active_tree_->set_needs_update_draw_properties(); |
| 1464 SetFullRootLayerDamage(); | 1463 SetFullRootLayerDamage(); |
| 1465 } | 1464 } |
| 1466 | 1465 |
| 1467 bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() { | 1466 bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() { |
| 1468 active_tree_->UpdateDrawProperties(LayerTreeImpl::UPDATE_ACTIVE_TREE); | 1467 active_tree_->UpdateDrawProperties(); |
| 1469 return !active_tree_->RenderSurfaceLayerList().empty(); | 1468 return !active_tree_->RenderSurfaceLayerList().empty(); |
| 1470 } | 1469 } |
| 1471 | 1470 |
| 1472 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( | 1471 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
| 1473 gfx::Point viewport_point, InputHandler::ScrollInputType type) { | 1472 gfx::Point viewport_point, InputHandler::ScrollInputType type) { |
| 1474 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); | 1473 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); |
| 1475 | 1474 |
| 1476 if (top_controls_manager_) | 1475 if (top_controls_manager_) |
| 1477 top_controls_manager_->ScrollBegin(); | 1476 top_controls_manager_->ScrollBegin(); |
| 1478 | 1477 |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2160 } | 2159 } |
| 2161 | 2160 |
| 2162 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2161 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
| 2163 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2162 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
| 2164 paint_time_counter_->ClearHistory(); | 2163 paint_time_counter_->ClearHistory(); |
| 2165 | 2164 |
| 2166 debug_state_ = debug_state; | 2165 debug_state_ = debug_state; |
| 2167 } | 2166 } |
| 2168 | 2167 |
| 2169 } // namespace cc | 2168 } // namespace cc |
| OLD | NEW |