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