| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 } else { | 329 } else { |
| 330 for (const auto& swap_promise : swap_promises) | 330 for (const auto& swap_promise : swap_promises) |
| 331 swap_promise->DidNotSwap(SwapPromise::COMMIT_NO_UPDATE); | 331 swap_promise->DidNotSwap(SwapPromise::COMMIT_NO_UPDATE); |
| 332 } | 332 } |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 | 335 |
| 336 void LayerTreeHostImpl::BeginCommit() { | 336 void LayerTreeHostImpl::BeginCommit() { |
| 337 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); | 337 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); |
| 338 | 338 |
| 339 // Ensure all textures are returned so partial texture updates can happen | |
| 340 // during the commit. | |
| 341 // TODO(ericrk): We should not need to ForceReclaimResources when using | |
| 342 // Impl-side-painting as it doesn't upload during commits. However, | |
| 343 // Display::Draw currently relies on resource being reclaimed to block drawing | |
| 344 // between BeginCommit / Swap. See crbug.com/489515. | |
| 345 if (compositor_frame_sink_) | |
| 346 compositor_frame_sink_->ForceReclaimResources(); | |
| 347 | |
| 348 if (!CommitToActiveTree()) | 339 if (!CommitToActiveTree()) |
| 349 CreatePendingTree(); | 340 CreatePendingTree(); |
| 350 } | 341 } |
| 351 | 342 |
| 352 void LayerTreeHostImpl::CommitComplete() { | 343 void LayerTreeHostImpl::CommitComplete() { |
| 353 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 344 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
| 354 | 345 |
| 355 if (CommitToActiveTree()) { | 346 if (CommitToActiveTree()) { |
| 356 // We have to activate animations here or "IsActive()" is true on the layers | 347 // We have to activate animations here or "IsActive()" is true on the layers |
| 357 // but the animations aren't activated yet so they get ignored by | 348 // but the animations aren't activated yet so they get ignored by |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 // If the root render surface has no visible damage, then don't generate a | 772 // If the root render surface has no visible damage, then don't generate a |
| 782 // frame at all. | 773 // frame at all. |
| 783 RenderSurfaceImpl* root_surface = active_tree_->RootRenderSurface(); | 774 RenderSurfaceImpl* root_surface = active_tree_->RootRenderSurface(); |
| 784 bool root_surface_has_no_visible_damage = | 775 bool root_surface_has_no_visible_damage = |
| 785 !root_surface->damage_tracker()->current_damage_rect().Intersects( | 776 !root_surface->damage_tracker()->current_damage_rect().Intersects( |
| 786 root_surface->content_rect()); | 777 root_surface->content_rect()); |
| 787 bool root_surface_has_contributing_layers = | 778 bool root_surface_has_contributing_layers = |
| 788 !root_surface->layer_list().empty(); | 779 !root_surface->layer_list().empty(); |
| 789 bool hud_wants_to_draw_ = active_tree_->hud_layer() && | 780 bool hud_wants_to_draw_ = active_tree_->hud_layer() && |
| 790 active_tree_->hud_layer()->IsAnimatingHUDContents(); | 781 active_tree_->hud_layer()->IsAnimatingHUDContents(); |
| 791 bool resources_must_be_resent = | 782 bool must_always_swap = |
| 792 compositor_frame_sink_->capabilities().can_force_reclaim_resources; | 783 compositor_frame_sink_->capabilities().must_always_swap; |
| 793 if (root_surface_has_contributing_layers && | 784 if (root_surface_has_contributing_layers && |
| 794 root_surface_has_no_visible_damage && | 785 root_surface_has_no_visible_damage && |
| 795 !active_tree_->property_trees()->effect_tree.HasCopyRequests() && | 786 !active_tree_->property_trees()->effect_tree.HasCopyRequests() && |
| 796 !resources_must_be_resent && !hud_wants_to_draw_) { | 787 !must_always_swap && !hud_wants_to_draw_) { |
| 797 TRACE_EVENT0("cc", | 788 TRACE_EVENT0("cc", |
| 798 "LayerTreeHostImpl::CalculateRenderPasses::EmptyDamageRect"); | 789 "LayerTreeHostImpl::CalculateRenderPasses::EmptyDamageRect"); |
| 799 frame->has_no_damage = true; | 790 frame->has_no_damage = true; |
| 800 DCHECK(!resourceless_software_draw_); | 791 DCHECK(!resourceless_software_draw_); |
| 801 return DRAW_SUCCESS; | 792 return DRAW_SUCCESS; |
| 802 } | 793 } |
| 803 | 794 |
| 804 TRACE_EVENT_BEGIN2( | 795 TRACE_EVENT_BEGIN2( |
| 805 "cc", "LayerTreeHostImpl::CalculateRenderPasses", | 796 "cc", "LayerTreeHostImpl::CalculateRenderPasses", |
| 806 "render_surface_layer_list.size()", | 797 "render_surface_layer_list.size()", |
| (...skipping 3285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4092 worker_context_visibility_ = | 4083 worker_context_visibility_ = |
| 4093 worker_context->CacheController()->ClientBecameVisible(); | 4084 worker_context->CacheController()->ClientBecameVisible(); |
| 4094 } else { | 4085 } else { |
| 4095 worker_context->CacheController()->ClientBecameNotVisible( | 4086 worker_context->CacheController()->ClientBecameNotVisible( |
| 4096 std::move(worker_context_visibility_)); | 4087 std::move(worker_context_visibility_)); |
| 4097 } | 4088 } |
| 4098 } | 4089 } |
| 4099 } | 4090 } |
| 4100 | 4091 |
| 4101 } // namespace cc | 4092 } // namespace cc |
| OLD | NEW |