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 | |
342 if (!CommitToActiveTree()) | 333 if (!CommitToActiveTree()) |
343 CreatePendingTree(); | 334 CreatePendingTree(); |
344 } | 335 } |
345 | 336 |
346 void LayerTreeHostImpl::CommitComplete() { | 337 void LayerTreeHostImpl::CommitComplete() { |
347 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 338 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
348 | 339 |
349 if (CommitToActiveTree()) { | 340 if (CommitToActiveTree()) { |
350 // We have to activate animations here or "IsActive()" is true on the layers | 341 // We have to activate animations here or "IsActive()" is true on the layers |
351 // but the animations aren't activated yet so they get ignored by | 342 // 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... |
775 // If the root render surface has no visible damage, then don't generate a | 766 // If the root render surface has no visible damage, then don't generate a |
776 // frame at all. | 767 // frame at all. |
777 RenderSurfaceImpl* root_surface = active_tree_->RootRenderSurface(); | 768 RenderSurfaceImpl* root_surface = active_tree_->RootRenderSurface(); |
778 bool root_surface_has_no_visible_damage = | 769 bool root_surface_has_no_visible_damage = |
779 !root_surface->damage_tracker()->current_damage_rect().Intersects( | 770 !root_surface->damage_tracker()->current_damage_rect().Intersects( |
780 root_surface->content_rect()); | 771 root_surface->content_rect()); |
781 bool root_surface_has_contributing_layers = | 772 bool root_surface_has_contributing_layers = |
782 !root_surface->layer_list().empty(); | 773 !root_surface->layer_list().empty(); |
783 bool hud_wants_to_draw_ = active_tree_->hud_layer() && | 774 bool hud_wants_to_draw_ = active_tree_->hud_layer() && |
784 active_tree_->hud_layer()->IsAnimatingHUDContents(); | 775 active_tree_->hud_layer()->IsAnimatingHUDContents(); |
785 bool resources_must_be_resent = | 776 bool must_always_swap = |
786 compositor_frame_sink_->capabilities().can_force_reclaim_resources; | 777 compositor_frame_sink_->capabilities().must_always_swap; |
787 if (root_surface_has_contributing_layers && | 778 if (root_surface_has_contributing_layers && |
788 root_surface_has_no_visible_damage && | 779 root_surface_has_no_visible_damage && |
789 !active_tree_->property_trees()->effect_tree.HasCopyRequests() && | 780 !active_tree_->property_trees()->effect_tree.HasCopyRequests() && |
790 !resources_must_be_resent && !hud_wants_to_draw_) { | 781 !must_always_swap && !hud_wants_to_draw_) { |
791 TRACE_EVENT0("cc", | 782 TRACE_EVENT0("cc", |
792 "LayerTreeHostImpl::CalculateRenderPasses::EmptyDamageRect"); | 783 "LayerTreeHostImpl::CalculateRenderPasses::EmptyDamageRect"); |
793 frame->has_no_damage = true; | 784 frame->has_no_damage = true; |
794 DCHECK(!resourceless_software_draw_); | 785 DCHECK(!resourceless_software_draw_); |
795 return DRAW_SUCCESS; | 786 return DRAW_SUCCESS; |
796 } | 787 } |
797 | 788 |
798 TRACE_EVENT_BEGIN2( | 789 TRACE_EVENT_BEGIN2( |
799 "cc", "LayerTreeHostImpl::CalculateRenderPasses", | 790 "cc", "LayerTreeHostImpl::CalculateRenderPasses", |
800 "render_surface_layer_list.size()", | 791 "render_surface_layer_list.size()", |
(...skipping 3291 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 |