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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 output_is_secure_(false), | 234 output_is_secure_(false), |
235 animation_host_(), | 235 animation_host_(), |
236 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 236 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
237 micro_benchmark_controller_(this), | 237 micro_benchmark_controller_(this), |
238 shared_bitmap_manager_(shared_bitmap_manager), | 238 shared_bitmap_manager_(shared_bitmap_manager), |
239 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | 239 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
240 task_graph_runner_(task_graph_runner), | 240 task_graph_runner_(task_graph_runner), |
241 id_(id), | 241 id_(id), |
242 requires_high_res_to_draw_(false), | 242 requires_high_res_to_draw_(false), |
243 is_likely_to_require_a_draw_(false), | 243 is_likely_to_require_a_draw_(false), |
244 mutator_(nullptr) { | 244 mutator_(nullptr), |
| 245 has_fixed_raster_scale_blurry_content_(false) { |
245 animation_host_ = AnimationHost::Create(ThreadInstance::IMPL); | 246 animation_host_ = AnimationHost::Create(ThreadInstance::IMPL); |
246 animation_host_->SetMutatorHostClient(this); | 247 animation_host_->SetMutatorHostClient(this); |
247 animation_host_->SetSupportsScrollAnimations(SupportsImplScrolling()); | 248 animation_host_->SetSupportsScrollAnimations(SupportsImplScrolling()); |
248 | 249 |
249 DCHECK(task_runner_provider_->IsImplThread()); | 250 DCHECK(task_runner_provider_->IsImplThread()); |
250 DidVisibilityChange(this, visible_); | 251 DidVisibilityChange(this, visible_); |
251 | 252 |
252 SetDebugState(settings.initial_debug_state); | 253 SetDebugState(settings.initial_debug_state); |
253 | 254 |
254 // LTHI always has an active tree. | 255 // LTHI always has an active tree. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 if (CommitToActiveTree()) | 348 if (CommitToActiveTree()) |
348 Animate(); | 349 Animate(); |
349 else | 350 else |
350 AnimatePendingTreeAfterCommit(); | 351 AnimatePendingTreeAfterCommit(); |
351 | 352 |
352 // LayerTreeHost may have changed the GPU rasterization flags state, which | 353 // LayerTreeHost may have changed the GPU rasterization flags state, which |
353 // may require an update of the tree resources. | 354 // may require an update of the tree resources. |
354 UpdateTreeResourcesForGpuRasterizationIfNeeded(); | 355 UpdateTreeResourcesForGpuRasterizationIfNeeded(); |
355 sync_tree()->set_needs_update_draw_properties(); | 356 sync_tree()->set_needs_update_draw_properties(); |
356 | 357 |
| 358 // Advance the attempted scale change history before updating draw properties. |
| 359 fixed_raster_scale_attempted_scale_change_history_ <<= 1; |
| 360 |
357 // We need an update immediately post-commit to have the opportunity to create | 361 // We need an update immediately post-commit to have the opportunity to create |
358 // tilings. Because invalidations may be coming from the main thread, it's | 362 // tilings. Because invalidations may be coming from the main thread, it's |
359 // safe to do an update for lcd text at this point and see if lcd text needs | 363 // safe to do an update for lcd text at this point and see if lcd text needs |
360 // to be disabled on any layers. | 364 // to be disabled on any layers. |
361 bool update_lcd_text = true; | 365 bool update_lcd_text = true; |
362 sync_tree()->UpdateDrawProperties(update_lcd_text); | 366 sync_tree()->UpdateDrawProperties(update_lcd_text); |
363 // Start working on newly created tiles immediately if needed. | 367 // Start working on newly created tiles immediately if needed. |
364 // TODO(vmpstr): Investigate always having PrepareTiles issue | 368 // TODO(vmpstr): Investigate always having PrepareTiles issue |
365 // NotifyReadyToActivate, instead of handling it here. | 369 // NotifyReadyToActivate, instead of handling it here. |
366 bool did_prepare_tiles = PrepareTiles(); | 370 bool did_prepare_tiles = PrepareTiles(); |
(...skipping 3619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3986 // Supported in threaded mode. | 3990 // Supported in threaded mode. |
3987 return task_runner_provider_->HasImplThread(); | 3991 return task_runner_provider_->HasImplThread(); |
3988 } | 3992 } |
3989 | 3993 |
3990 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3994 bool LayerTreeHostImpl::CommitToActiveTree() const { |
3991 // In single threaded mode we skip the pending tree and commit directly to the | 3995 // In single threaded mode we skip the pending tree and commit directly to the |
3992 // active tree. | 3996 // active tree. |
3993 return !task_runner_provider_->HasImplThread(); | 3997 return !task_runner_provider_->HasImplThread(); |
3994 } | 3998 } |
3995 | 3999 |
| 4000 bool LayerTreeHostImpl::HasFixedRasterScalePotentialPerformanceRegression() |
| 4001 const { |
| 4002 return fixed_raster_scale_attempted_scale_change_history_.count() >= |
| 4003 kFixedRasterScaleAttemptedScaleChangeThreshold; |
| 4004 } |
| 4005 |
| 4006 void LayerTreeHostImpl::SetFixedRasterScaleAttemptedToChangeScale() { |
| 4007 fixed_raster_scale_attempted_scale_change_history_.set(0); |
| 4008 } |
| 4009 |
3996 } // namespace cc | 4010 } // namespace cc |
OLD | NEW |