| 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { | 404 void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { |
| 405 DCHECK(!IsRemoteServer()); | 405 DCHECK(!IsRemoteServer()); |
| 406 DCHECK(task_runner_provider_->IsImplThread()); | 406 DCHECK(task_runner_provider_->IsImplThread()); |
| 407 | 407 |
| 408 bool is_new_trace; | 408 bool is_new_trace; |
| 409 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); | 409 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); |
| 410 if (is_new_trace && | 410 if (is_new_trace && |
| 411 frame_viewer_instrumentation::IsTracingLayerTreeSnapshots() && | 411 frame_viewer_instrumentation::IsTracingLayerTreeSnapshots() && |
| 412 root_layer()) { | 412 root_layer()) { |
| 413 LayerTreeHostCommon::CallFunctionForEveryLayer( | 413 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 414 this, [](Layer* layer) { layer->DidBeginTracing(); }); | 414 this, [](Layer* layer) { layer->DidBeginTracing(); }, |
| 415 CallFunctionLayerType::ALL_LAYERS); |
| 415 } | 416 } |
| 416 | 417 |
| 417 LayerTreeImpl* sync_tree = host_impl->sync_tree(); | 418 LayerTreeImpl* sync_tree = host_impl->sync_tree(); |
| 418 | 419 |
| 419 if (next_commit_forces_redraw_) { | 420 if (next_commit_forces_redraw_) { |
| 420 sync_tree->ForceRedrawNextActivation(); | 421 sync_tree->ForceRedrawNextActivation(); |
| 421 next_commit_forces_redraw_ = false; | 422 next_commit_forces_redraw_ = false; |
| 422 } | 423 } |
| 423 | 424 |
| 424 sync_tree->set_source_frame_number(source_frame_number()); | 425 sync_tree->set_source_frame_number(source_frame_number()); |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 bool can_render_to_separate_surface = true; | 987 bool can_render_to_separate_surface = true; |
| 987 PropertyTreeBuilder::BuildPropertyTrees( | 988 PropertyTreeBuilder::BuildPropertyTrees( |
| 988 root_layer, page_scale_layer, inner_viewport_scroll_layer_.get(), | 989 root_layer, page_scale_layer, inner_viewport_scroll_layer_.get(), |
| 989 outer_viewport_scroll_layer_.get(), overscroll_elasticity_layer_.get(), | 990 outer_viewport_scroll_layer_.get(), overscroll_elasticity_layer_.get(), |
| 990 elastic_overscroll_, page_scale_factor_, device_scale_factor_, | 991 elastic_overscroll_, page_scale_factor_, device_scale_factor_, |
| 991 gfx::Rect(device_viewport_size_), identity_transform, &property_trees_); | 992 gfx::Rect(device_viewport_size_), identity_transform, &property_trees_); |
| 992 draw_property_utils::UpdateRenderSurfaces(root_layer, &property_trees_); | 993 draw_property_utils::UpdateRenderSurfaces(root_layer, &property_trees_); |
| 993 draw_property_utils::UpdatePropertyTrees(&property_trees_, | 994 draw_property_utils::UpdatePropertyTrees(&property_trees_, |
| 994 can_render_to_separate_surface); | 995 can_render_to_separate_surface); |
| 995 draw_property_utils::FindLayersThatNeedUpdates( | 996 draw_property_utils::FindLayersThatNeedUpdates( |
| 996 root_layer, property_trees_.transform_tree, property_trees_.effect_tree, | 997 this, property_trees_.transform_tree, property_trees_.effect_tree, |
| 997 &update_layer_list); | 998 &update_layer_list); |
| 998 } | 999 } |
| 999 | 1000 |
| 1000 for (const auto& layer : update_layer_list) | 1001 for (const auto& layer : update_layer_list) |
| 1001 layer->SavePaintProperties(); | 1002 layer->SavePaintProperties(); |
| 1002 | 1003 |
| 1003 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); | 1004 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); |
| 1004 bool did_paint_content = false; | 1005 bool did_paint_content = false; |
| 1005 for (const auto& layer : update_layer_list) { | 1006 for (const auto& layer : update_layer_list) { |
| 1006 did_paint_content |= layer->Update(); | 1007 did_paint_content |= layer->Update(); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 // It is required to create new PropertyTrees before deserializing it. | 1623 // It is required to create new PropertyTrees before deserializing it. |
| 1623 property_trees_ = PropertyTrees(); | 1624 property_trees_ = PropertyTrees(); |
| 1624 property_trees_.FromProtobuf(proto.property_trees()); | 1625 property_trees_.FromProtobuf(proto.property_trees()); |
| 1625 | 1626 |
| 1626 // Forcefully override the sequence number of all layers in the tree to have | 1627 // Forcefully override the sequence number of all layers in the tree to have |
| 1627 // a valid sequence number. Changing the sequence number for a layer does not | 1628 // a valid sequence number. Changing the sequence number for a layer does not |
| 1628 // need a commit, so the value will become out of date for layers that are not | 1629 // need a commit, so the value will become out of date for layers that are not |
| 1629 // updated for other reasons. All layers that at this point are part of the | 1630 // updated for other reasons. All layers that at this point are part of the |
| 1630 // layer tree are valid, so it is OK that they have a valid sequence number. | 1631 // layer tree are valid, so it is OK that they have a valid sequence number. |
| 1631 int seq_num = property_trees_.sequence_number; | 1632 int seq_num = property_trees_.sequence_number; |
| 1632 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { | 1633 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 1633 layer->set_property_tree_sequence_number(seq_num); | 1634 this, |
| 1634 }); | 1635 [seq_num](Layer* layer) { |
| 1636 layer->set_property_tree_sequence_number(seq_num); |
| 1637 }, |
| 1638 CallFunctionLayerType::ALL_LAYERS); |
| 1635 | 1639 |
| 1636 surface_id_namespace_ = proto.surface_id_namespace(); | 1640 surface_id_namespace_ = proto.surface_id_namespace(); |
| 1637 next_surface_sequence_ = proto.next_surface_sequence(); | 1641 next_surface_sequence_ = proto.next_surface_sequence(); |
| 1638 } | 1642 } |
| 1639 | 1643 |
| 1640 } // namespace cc | 1644 } // namespace cc |
| OLD | NEW |