| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 event_listener_properties_(), | 239 event_listener_properties_(), |
| 240 did_complete_scale_animation_(false), | 240 did_complete_scale_animation_(false), |
| 241 in_paint_layer_contents_(false), | 241 in_paint_layer_contents_(false), |
| 242 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 242 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
| 243 next_commit_forces_redraw_(false), | 243 next_commit_forces_redraw_(false), |
| 244 shared_bitmap_manager_(params->shared_bitmap_manager), | 244 shared_bitmap_manager_(params->shared_bitmap_manager), |
| 245 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), | 245 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), |
| 246 task_graph_runner_(params->task_graph_runner), | 246 task_graph_runner_(params->task_graph_runner), |
| 247 image_serialization_processor_(params->image_serialization_processor), | 247 image_serialization_processor_(params->image_serialization_processor), |
| 248 surface_id_namespace_(0u), | 248 surface_id_namespace_(0u), |
| 249 next_surface_sequence_(1u) { | 249 next_surface_sequence_(1u), |
| 250 has_fixed_raster_scale_blurry_content_(false), |
| 251 has_fixed_raster_scale_potential_performance_regression_(false) { |
| 250 DCHECK(task_graph_runner_); | 252 DCHECK(task_graph_runner_); |
| 251 | 253 |
| 252 animation_host_ = AnimationHost::Create(ThreadInstance::MAIN); | 254 animation_host_ = AnimationHost::Create(ThreadInstance::MAIN); |
| 253 animation_host_->SetMutatorHostClient(this); | 255 animation_host_->SetMutatorHostClient(this); |
| 254 | 256 |
| 255 rendering_stats_instrumentation_->set_record_rendering_stats( | 257 rendering_stats_instrumentation_->set_record_rendering_stats( |
| 256 debug_state_.RecordRenderingStats()); | 258 debug_state_.RecordRenderingStats()); |
| 257 } | 259 } |
| 258 | 260 |
| 259 void LayerTreeHost::InitializeThreaded( | 261 void LayerTreeHost::InitializeThreaded( |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 // We don't track changes to effect tree on main thread. But, to preserve any | 541 // We don't track changes to effect tree on main thread. But, to preserve any |
| 540 // change tracking done on active tree's effect tree, we copy it to the main | 542 // change tracking done on active tree's effect tree, we copy it to the main |
| 541 // thread's effect tree before we push the main thread property trees to | 543 // thread's effect tree before we push the main thread property trees to |
| 542 // active tree. | 544 // active tree. |
| 543 if (property_trees_changed_on_active_tree) | 545 if (property_trees_changed_on_active_tree) |
| 544 property_trees_.ResetAllChangeTracking( | 546 property_trees_.ResetAllChangeTracking( |
| 545 PropertyTrees::ResetFlags::ALL_TREES); | 547 PropertyTrees::ResetFlags::ALL_TREES); |
| 546 else | 548 else |
| 547 property_trees_.ResetAllChangeTracking( | 549 property_trees_.ResetAllChangeTracking( |
| 548 PropertyTrees::ResetFlags::TRANSFORM_TREE); | 550 PropertyTrees::ResetFlags::TRANSFORM_TREE); |
| 551 |
| 552 has_fixed_raster_scale_blurry_content_ = |
| 553 host_impl->has_fixed_raster_scale_blurry_content(); |
| 554 has_fixed_raster_scale_potential_performance_regression_ = |
| 555 host_impl->HasFixedRasterScalePotentialPerformanceRegression(); |
| 549 } | 556 } |
| 550 | 557 |
| 551 void LayerTreeHost::WillCommit() { | 558 void LayerTreeHost::WillCommit() { |
| 552 OnCommitForSwapPromises(); | 559 OnCommitForSwapPromises(); |
| 553 client_->WillCommit(); | 560 client_->WillCommit(); |
| 554 } | 561 } |
| 555 | 562 |
| 556 void LayerTreeHost::UpdateHudLayer() { | 563 void LayerTreeHost::UpdateHudLayer() { |
| 557 if (debug_state_.ShowHudInfo()) { | 564 if (debug_state_.ShowHudInfo()) { |
| 558 if (!hud_layer_.get()) { | 565 if (!hud_layer_.get()) { |
| 559 hud_layer_ = HeadsUpDisplayLayer::Create(); | 566 hud_layer_ = HeadsUpDisplayLayer::Create(); |
| 560 } | 567 } |
| 561 | 568 |
| 562 if (root_layer_.get() && !hud_layer_->parent()) | 569 if (root_layer_.get() && !hud_layer_->parent()) |
| 563 root_layer_->AddChild(hud_layer_); | 570 root_layer_->AddChild(hud_layer_); |
| 564 } else if (hud_layer_.get()) { | 571 } else if (hud_layer_.get()) { |
| 565 hud_layer_->RemoveFromParent(); | 572 hud_layer_->RemoveFromParent(); |
| 566 hud_layer_ = NULL; | 573 hud_layer_ = NULL; |
| 567 } | 574 } |
| 568 } | 575 } |
| 569 | 576 |
| 570 void LayerTreeHost::CommitComplete() { | 577 void LayerTreeHost::CommitComplete() { |
| 571 source_frame_number_++; | 578 source_frame_number_++; |
| 572 client_->DidCommit(); | 579 client_->DidCommit(); |
| 573 if (did_complete_scale_animation_) { | 580 if (did_complete_scale_animation_) { |
| 574 client_->DidCompletePageScaleAnimation(); | 581 client_->DidCompletePageScaleAnimation(); |
| 575 did_complete_scale_animation_ = false; | 582 did_complete_scale_animation_ = false; |
| 576 } | 583 } |
| 584 client_->ReportFixedRasterScaleUseCounters( |
| 585 has_fixed_raster_scale_blurry_content_, |
| 586 has_fixed_raster_scale_potential_performance_regression_); |
| 577 } | 587 } |
| 578 | 588 |
| 579 void LayerTreeHost::SetOutputSurface(std::unique_ptr<OutputSurface> surface) { | 589 void LayerTreeHost::SetOutputSurface(std::unique_ptr<OutputSurface> surface) { |
| 580 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); | 590 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); |
| 581 DCHECK(output_surface_lost_); | 591 DCHECK(output_surface_lost_); |
| 582 DCHECK(surface); | 592 DCHECK(surface); |
| 583 | 593 |
| 584 DCHECK(!new_output_surface_); | 594 DCHECK(!new_output_surface_); |
| 585 new_output_surface_ = std::move(surface); | 595 new_output_surface_ = std::move(surface); |
| 586 proxy_->SetOutputSurface(new_output_surface_.get()); | 596 proxy_->SetOutputSurface(new_output_surface_.get()); |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1634 int seq_num = property_trees_.sequence_number; | 1644 int seq_num = property_trees_.sequence_number; |
| 1635 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { | 1645 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { |
| 1636 layer->set_property_tree_sequence_number(seq_num); | 1646 layer->set_property_tree_sequence_number(seq_num); |
| 1637 }); | 1647 }); |
| 1638 | 1648 |
| 1639 surface_id_namespace_ = proto.surface_id_namespace(); | 1649 surface_id_namespace_ = proto.surface_id_namespace(); |
| 1640 next_surface_sequence_ = proto.next_surface_sequence(); | 1650 next_surface_sequence_ = proto.next_surface_sequence(); |
| 1641 } | 1651 } |
| 1642 | 1652 |
| 1643 } // namespace cc | 1653 } // namespace cc |
| OLD | NEW |