| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 resourceless_software_draw_(false), | 236 resourceless_software_draw_(false), |
| 237 animation_host_(std::move(animation_host)), | 237 animation_host_(std::move(animation_host)), |
| 238 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 238 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
| 239 micro_benchmark_controller_(this), | 239 micro_benchmark_controller_(this), |
| 240 shared_bitmap_manager_(shared_bitmap_manager), | 240 shared_bitmap_manager_(shared_bitmap_manager), |
| 241 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | 241 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
| 242 task_graph_runner_(task_graph_runner), | 242 task_graph_runner_(task_graph_runner), |
| 243 id_(id), | 243 id_(id), |
| 244 requires_high_res_to_draw_(false), | 244 requires_high_res_to_draw_(false), |
| 245 is_likely_to_require_a_draw_(false), | 245 is_likely_to_require_a_draw_(false), |
| 246 mutator_(nullptr), | 246 mutator_(nullptr) { |
| 247 has_fixed_raster_scale_blurry_content_(false) { | |
| 248 DCHECK(animation_host_); | 247 DCHECK(animation_host_); |
| 249 animation_host_->SetMutatorHostClient(this); | 248 animation_host_->SetMutatorHostClient(this); |
| 250 | 249 |
| 251 DCHECK(task_runner_provider_->IsImplThread()); | 250 DCHECK(task_runner_provider_->IsImplThread()); |
| 252 DidVisibilityChange(this, visible_); | 251 DidVisibilityChange(this, visible_); |
| 253 | 252 |
| 254 SetDebugState(settings.initial_debug_state); | 253 SetDebugState(settings.initial_debug_state); |
| 255 | 254 |
| 256 // LTHI always has an active tree. | 255 // LTHI always has an active tree. |
| 257 active_tree_ = | 256 active_tree_ = |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 if (CommitToActiveTree()) | 348 if (CommitToActiveTree()) |
| 350 Animate(); | 349 Animate(); |
| 351 else | 350 else |
| 352 AnimatePendingTreeAfterCommit(); | 351 AnimatePendingTreeAfterCommit(); |
| 353 | 352 |
| 354 // LayerTreeHost may have changed the GPU rasterization flags state, which | 353 // LayerTreeHost may have changed the GPU rasterization flags state, which |
| 355 // may require an update of the tree resources. | 354 // may require an update of the tree resources. |
| 356 UpdateTreeResourcesForGpuRasterizationIfNeeded(); | 355 UpdateTreeResourcesForGpuRasterizationIfNeeded(); |
| 357 sync_tree()->set_needs_update_draw_properties(); | 356 sync_tree()->set_needs_update_draw_properties(); |
| 358 | 357 |
| 359 // Advance the attempted scale change history before updating draw properties. | |
| 360 fixed_raster_scale_attempted_scale_change_history_ <<= 1; | |
| 361 | |
| 362 // We need an update immediately post-commit to have the opportunity to create | 358 // We need an update immediately post-commit to have the opportunity to create |
| 363 // tilings. Because invalidations may be coming from the main thread, it's | 359 // tilings. Because invalidations may be coming from the main thread, it's |
| 364 // safe to do an update for lcd text at this point and see if lcd text needs | 360 // safe to do an update for lcd text at this point and see if lcd text needs |
| 365 // to be disabled on any layers. | 361 // to be disabled on any layers. |
| 366 bool update_lcd_text = true; | 362 bool update_lcd_text = true; |
| 367 sync_tree()->UpdateDrawProperties(update_lcd_text); | 363 sync_tree()->UpdateDrawProperties(update_lcd_text); |
| 368 // Start working on newly created tiles immediately if needed. | 364 // Start working on newly created tiles immediately if needed. |
| 369 // TODO(vmpstr): Investigate always having PrepareTiles issue | 365 // TODO(vmpstr): Investigate always having PrepareTiles issue |
| 370 // NotifyReadyToActivate, instead of handling it here. | 366 // NotifyReadyToActivate, instead of handling it here. |
| 371 bool did_prepare_tiles = PrepareTiles(); | 367 bool did_prepare_tiles = PrepareTiles(); |
| (...skipping 3651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4023 // Supported in threaded mode. | 4019 // Supported in threaded mode. |
| 4024 return task_runner_provider_->HasImplThread(); | 4020 return task_runner_provider_->HasImplThread(); |
| 4025 } | 4021 } |
| 4026 | 4022 |
| 4027 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4023 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4028 // In single threaded mode we skip the pending tree and commit directly to the | 4024 // In single threaded mode we skip the pending tree and commit directly to the |
| 4029 // active tree. | 4025 // active tree. |
| 4030 return !task_runner_provider_->HasImplThread(); | 4026 return !task_runner_provider_->HasImplThread(); |
| 4031 } | 4027 } |
| 4032 | 4028 |
| 4033 bool LayerTreeHostImpl::HasFixedRasterScalePotentialPerformanceRegression() | |
| 4034 const { | |
| 4035 return fixed_raster_scale_attempted_scale_change_history_.count() >= | |
| 4036 kFixedRasterScaleAttemptedScaleChangeThreshold; | |
| 4037 } | |
| 4038 | |
| 4039 void LayerTreeHostImpl::SetFixedRasterScaleAttemptedToChangeScale() { | |
| 4040 fixed_raster_scale_attempted_scale_change_history_.set(0); | |
| 4041 } | |
| 4042 | |
| 4043 } // namespace cc | 4029 } // namespace cc |
| OLD | NEW |