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