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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } else { | 316 } else { |
317 for (const auto& swap_promise : swap_promises) | 317 for (const auto& swap_promise : swap_promises) |
318 swap_promise->DidNotSwap(SwapPromise::COMMIT_NO_UPDATE); | 318 swap_promise->DidNotSwap(SwapPromise::COMMIT_NO_UPDATE); |
319 } | 319 } |
320 } | 320 } |
321 } | 321 } |
322 | 322 |
323 void LayerTreeHostImpl::BeginCommit() { | 323 void LayerTreeHostImpl::BeginCommit() { |
324 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); | 324 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); |
325 | 325 |
326 // Ensure all textures are returned so partial texture updates can happen | |
327 // during the commit. | |
328 // TODO(ericrk): We should not need to ForceReclaimResources when using | |
329 // Impl-side-painting as it doesn't upload during commits. However, | |
330 // Display::Draw currently relies on resource being reclaimed to block drawing | |
331 // between BeginCommit / Swap. See crbug.com/489515. | |
332 if (compositor_frame_sink_) | |
333 compositor_frame_sink_->ForceReclaimResources(); | |
334 | |
335 if (!CommitToActiveTree()) | 326 if (!CommitToActiveTree()) |
336 CreatePendingTree(); | 327 CreatePendingTree(); |
337 } | 328 } |
338 | 329 |
339 void LayerTreeHostImpl::CommitComplete() { | 330 void LayerTreeHostImpl::CommitComplete() { |
340 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 331 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
341 | 332 |
342 UpdateSyncTreeAfterCommitOrImplSideInvalidation(); | 333 UpdateSyncTreeAfterCommitOrImplSideInvalidation(); |
343 micro_benchmark_controller_.DidCompleteCommit(); | 334 micro_benchmark_controller_.DidCompleteCommit(); |
344 } | 335 } |
(...skipping 448 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 3459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4286 } | 4276 } |
4287 | 4277 |
4288 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { | 4278 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { |
4289 if (is_wheel_scroll) | 4279 if (is_wheel_scroll) |
4290 has_scrolled_by_wheel_ = true; | 4280 has_scrolled_by_wheel_ = true; |
4291 else | 4281 else |
4292 has_scrolled_by_touch_ = true; | 4282 has_scrolled_by_touch_ = true; |
4293 } | 4283 } |
4294 | 4284 |
4295 } // namespace cc | 4285 } // namespace cc |
OLD | NEW |