| 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 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1751 | 1751 |
| 1752 // Collect all resource ids in the render passes into a single array. | 1752 // Collect all resource ids in the render passes into a single array. |
| 1753 ResourceProvider::ResourceIdArray resources; | 1753 ResourceProvider::ResourceIdArray resources; |
| 1754 for (const auto& render_pass : frame->render_passes) { | 1754 for (const auto& render_pass : frame->render_passes) { |
| 1755 for (auto* quad : render_pass->quad_list) { | 1755 for (auto* quad : render_pass->quad_list) { |
| 1756 for (ResourceId resource_id : quad->resources) | 1756 for (ResourceId resource_id : quad->resources) |
| 1757 resources.push_back(resource_id); | 1757 resources.push_back(resource_id); |
| 1758 } | 1758 } |
| 1759 } | 1759 } |
| 1760 | 1760 |
| 1761 std::vector<SharedBitmap*> shared_bitmaps_to_register = |
| 1762 resource_provider_->TakeSharedBitmapsToRegister(); |
| 1763 |
| 1764 for (SharedBitmap* shared_bitmap : shared_bitmaps_to_register) { |
| 1765 base::SharedMemory* shared_memory = shared_bitmap->GetSharedMemory(); |
| 1766 if (shared_memory && shared_memory->handle().IsValid()) { |
| 1767 metadata.shared_bitmaps_to_register.push_back( |
| 1768 {shared_bitmap->id(), |
| 1769 shared_memory->handle().Duplicate(), |
| 1770 shared_memory->mapped_size()}); |
| 1771 DCHECK(shared_memory->handle().IsValid()); |
| 1772 shared_memory->Close(); |
| 1773 DCHECK(!shared_memory->handle().IsValid()); |
| 1774 } |
| 1775 } |
| 1776 |
| 1761 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, | 1777 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, |
| 1762 frame->begin_frame_ack.sequence_number); | 1778 frame->begin_frame_ack.sequence_number); |
| 1763 metadata.begin_frame_ack = frame->begin_frame_ack; | 1779 metadata.begin_frame_ack = frame->begin_frame_ack; |
| 1764 | 1780 |
| 1765 CompositorFrame compositor_frame; | 1781 CompositorFrame compositor_frame; |
| 1766 compositor_frame.metadata = std::move(metadata); | 1782 compositor_frame.metadata = std::move(metadata); |
| 1767 resource_provider_->PrepareSendToParent(resources, | 1783 resource_provider_->PrepareSendToParent(resources, |
| 1768 &compositor_frame.resource_list); | 1784 &compositor_frame.resource_list); |
| 1769 compositor_frame.render_pass_list = std::move(frame->render_passes); | 1785 compositor_frame.render_pass_list = std::move(frame->render_passes); |
| 1770 // TODO(fsamuel): Once all clients get their LocalSurfaceId from their parent, | 1786 // TODO(fsamuel): Once all clients get their LocalSurfaceId from their parent, |
| 1771 // the LocalSurfaceId should hang off CompositorFrameMetadata. | 1787 // the LocalSurfaceId should hang off CompositorFrameMetadata. |
| 1772 if (settings_.enable_surface_synchronization && | 1788 if (settings_.enable_surface_synchronization && |
| 1773 active_tree()->local_surface_id().is_valid()) { | 1789 active_tree()->local_surface_id().is_valid()) { |
| 1774 layer_tree_frame_sink_->SetLocalSurfaceId( | 1790 layer_tree_frame_sink_->SetLocalSurfaceId( |
| 1775 active_tree()->local_surface_id()); | 1791 active_tree()->local_surface_id()); |
| 1776 } | 1792 } |
| 1793 |
| 1777 layer_tree_frame_sink_->SubmitCompositorFrame(std::move(compositor_frame)); | 1794 layer_tree_frame_sink_->SubmitCompositorFrame(std::move(compositor_frame)); |
| 1778 | 1795 |
| 1779 // Clears the list of swap promises after calling DidSwap on each of them to | 1796 // Clears the list of swap promises after calling DidSwap on each of them to |
| 1780 // signal that the swap is over. | 1797 // signal that the swap is over. |
| 1781 active_tree()->ClearSwapPromises(); | 1798 active_tree()->ClearSwapPromises(); |
| 1782 | 1799 |
| 1783 // The next frame should start by assuming nothing has changed, and changes | 1800 // The next frame should start by assuming nothing has changed, and changes |
| 1784 // are noted as they occur. | 1801 // are noted as they occur. |
| 1785 // TODO(boliu): If we did a temporary software renderer frame, propogate the | 1802 // TODO(boliu): If we did a temporary software renderer frame, propogate the |
| 1786 // damage forward to the next frame. | 1803 // damage forward to the next frame. |
| (...skipping 2630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4417 | 4434 |
| 4418 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4435 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
| 4419 if (!element_id) | 4436 if (!element_id) |
| 4420 return; | 4437 return; |
| 4421 if (ScrollbarAnimationController* animation_controller = | 4438 if (ScrollbarAnimationController* animation_controller = |
| 4422 ScrollbarAnimationControllerForElementId(element_id)) | 4439 ScrollbarAnimationControllerForElementId(element_id)) |
| 4423 animation_controller->DidScrollUpdate(); | 4440 animation_controller->DidScrollUpdate(); |
| 4424 } | 4441 } |
| 4425 | 4442 |
| 4426 } // namespace cc | 4443 } // namespace cc |
| OLD | NEW |