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