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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } else { | 317 } else { |
318 for (const auto& swap_promise : swap_promises) | 318 for (const auto& swap_promise : swap_promises) |
319 swap_promise->DidNotSwap(SwapPromise::COMMIT_NO_UPDATE); | 319 swap_promise->DidNotSwap(SwapPromise::COMMIT_NO_UPDATE); |
320 } | 320 } |
321 } | 321 } |
322 } | 322 } |
323 | 323 |
324 void LayerTreeHostImpl::BeginCommit() { | 324 void LayerTreeHostImpl::BeginCommit() { |
325 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); | 325 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); |
326 | 326 |
327 // Ensure all textures are returned so partial texture updates can happen | |
328 // during the commit. | |
329 // TODO(ericrk): We should not need to ForceReclaimResources when using | |
330 // Impl-side-painting as it doesn't upload during commits. However, | |
331 // Display::Draw currently relies on resource being reclaimed to block drawing | |
332 // between BeginCommit / Swap. See crbug.com/489515. | |
333 if (compositor_frame_sink_) | |
334 compositor_frame_sink_->ForceReclaimResources(); | |
335 | |
336 if (!CommitToActiveTree()) | 327 if (!CommitToActiveTree()) |
337 CreatePendingTree(); | 328 CreatePendingTree(); |
338 } | 329 } |
339 | 330 |
340 void LayerTreeHostImpl::CommitComplete() { | 331 void LayerTreeHostImpl::CommitComplete() { |
341 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 332 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
342 | 333 |
343 UpdateSyncTreeAfterCommitOrImplSideInvalidation(); | 334 UpdateSyncTreeAfterCommitOrImplSideInvalidation(); |
344 micro_benchmark_controller_.DidCompleteCommit(); | 335 micro_benchmark_controller_.DidCompleteCommit(); |
345 } | 336 } |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 | 784 |
794 // If the root render surface has no visible damage, then don't generate a | 785 // If the root render surface has no visible damage, then don't generate a |
795 // frame at all. | 786 // frame at all. |
796 RenderSurfaceImpl* root_surface = active_tree_->RootRenderSurface(); | 787 RenderSurfaceImpl* root_surface = active_tree_->RootRenderSurface(); |
797 bool root_surface_has_no_visible_damage = | 788 bool root_surface_has_no_visible_damage = |
798 !root_surface->GetDamageRect().Intersects(root_surface->content_rect()); | 789 !root_surface->GetDamageRect().Intersects(root_surface->content_rect()); |
799 bool root_surface_has_contributing_layers = | 790 bool root_surface_has_contributing_layers = |
800 !root_surface->layer_list().empty(); | 791 !root_surface->layer_list().empty(); |
801 bool hud_wants_to_draw_ = active_tree_->hud_layer() && | 792 bool hud_wants_to_draw_ = active_tree_->hud_layer() && |
802 active_tree_->hud_layer()->IsAnimatingHUDContents(); | 793 active_tree_->hud_layer()->IsAnimatingHUDContents(); |
803 bool resources_must_be_resent = | 794 bool must_always_swap = |
804 compositor_frame_sink_->capabilities().can_force_reclaim_resources; | 795 compositor_frame_sink_->capabilities().must_always_swap; |
805 // When touch handle visibility changes there is no visible damage | 796 // When touch handle visibility changes there is no visible damage |
806 // because touch handles are composited in the browser. However we | 797 // because touch handles are composited in the browser. However we |
807 // still want the browser to be notified that the handles changed | 798 // still want the browser to be notified that the handles changed |
808 // through the |ViewHostMsg_SwapCompositorFrame| IPC so we keep | 799 // through the |ViewHostMsg_SwapCompositorFrame| IPC so we keep |
809 // track of handle visibility changes through |handle_visibility_changed|. | 800 // track of handle visibility changes through |handle_visibility_changed|. |
810 bool handle_visibility_changed = | 801 bool handle_visibility_changed = |
811 active_tree_->GetAndResetHandleVisibilityChanged(); | 802 active_tree_->GetAndResetHandleVisibilityChanged(); |
812 if (root_surface_has_contributing_layers && | 803 if (root_surface_has_contributing_layers && |
813 root_surface_has_no_visible_damage && | 804 root_surface_has_no_visible_damage && |
814 !active_tree_->property_trees()->effect_tree.HasCopyRequests() && | 805 !active_tree_->property_trees()->effect_tree.HasCopyRequests() && |
815 !resources_must_be_resent && !hud_wants_to_draw_ && | 806 !must_always_swap && !hud_wants_to_draw_ && !handle_visibility_changed) { |
816 !handle_visibility_changed) { | |
817 TRACE_EVENT0("cc", | 807 TRACE_EVENT0("cc", |
818 "LayerTreeHostImpl::CalculateRenderPasses::EmptyDamageRect"); | 808 "LayerTreeHostImpl::CalculateRenderPasses::EmptyDamageRect"); |
819 frame->has_no_damage = true; | 809 frame->has_no_damage = true; |
820 DCHECK(!resourceless_software_draw_); | 810 DCHECK(!resourceless_software_draw_); |
821 return DRAW_SUCCESS; | 811 return DRAW_SUCCESS; |
822 } | 812 } |
823 | 813 |
824 TRACE_EVENT_BEGIN2( | 814 TRACE_EVENT_BEGIN2( |
825 "cc", "LayerTreeHostImpl::CalculateRenderPasses", | 815 "cc", "LayerTreeHostImpl::CalculateRenderPasses", |
826 "render_surface_layer_list.size()", | 816 "render_surface_layer_list.size()", |
(...skipping 3469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4296 } | 4286 } |
4297 | 4287 |
4298 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { | 4288 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { |
4299 if (is_wheel_scroll) | 4289 if (is_wheel_scroll) |
4300 has_scrolled_by_wheel_ = true; | 4290 has_scrolled_by_wheel_ = true; |
4301 else | 4291 else |
4302 has_scrolled_by_touch_ = true; | 4292 has_scrolled_by_touch_ = true; |
4303 } | 4293 } |
4304 | 4294 |
4305 } // namespace cc | 4295 } // namespace cc |
OLD | NEW |