OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/output/delegating_renderer.h" | 5 #include "cc/output/delegating_renderer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 delegated_frame_data_ = make_scoped_ptr(new DelegatedFrameData); | 83 delegated_frame_data_ = make_scoped_ptr(new DelegatedFrameData); |
84 DelegatedFrameData& out_data = *delegated_frame_data_; | 84 DelegatedFrameData& out_data = *delegated_frame_data_; |
85 out_data.device_scale_factor = device_scale_factor; | 85 out_data.device_scale_factor = device_scale_factor; |
86 // Move the render passes and resources into the |out_frame|. | 86 // Move the render passes and resources into the |out_frame|. |
87 out_data.render_pass_list.swap(*render_passes_in_draw_order); | 87 out_data.render_pass_list.swap(*render_passes_in_draw_order); |
88 | 88 |
89 // Collect all resource ids in the render passes into a ResourceIdArray. | 89 // Collect all resource ids in the render passes into a ResourceIdArray. |
90 ResourceProvider::ResourceIdArray resources; | 90 ResourceProvider::ResourceIdArray resources; |
91 DrawQuad::ResourceIteratorCallback append_to_array = | 91 DrawQuad::ResourceIteratorCallback append_to_array = |
92 base::Bind(&AppendToArray, &resources); | 92 base::Bind(&AppendToArray, &resources); |
93 for (size_t i = 0; i < out_data.render_pass_list.size(); ++i) { | 93 for (const auto& render_pass : out_data.render_pass_list) { |
94 RenderPass* render_pass = out_data.render_pass_list.at(i); | 94 for (const auto& quad : render_pass->quad_list) |
95 for (auto& quad : render_pass->quad_list) | 95 quad->IterateResources(append_to_array); |
96 quad.IterateResources(append_to_array); | |
97 } | 96 } |
98 resource_provider_->PrepareSendToParent(resources, &out_data.resource_list); | 97 resource_provider_->PrepareSendToParent(resources, &out_data.resource_list); |
99 } | 98 } |
100 | 99 |
101 void DelegatingRenderer::SwapBuffers(const CompositorFrameMetadata& metadata) { | 100 void DelegatingRenderer::SwapBuffers(const CompositorFrameMetadata& metadata) { |
102 TRACE_EVENT0("cc,benchmark", "DelegatingRenderer::SwapBuffers"); | 101 TRACE_EVENT0("cc,benchmark", "DelegatingRenderer::SwapBuffers"); |
103 CompositorFrame compositor_frame; | 102 CompositorFrame compositor_frame; |
104 compositor_frame.metadata = metadata; | 103 compositor_frame.metadata = metadata; |
105 compositor_frame.delegated_frame_data = delegated_frame_data_.Pass(); | 104 compositor_frame.delegated_frame_data = delegated_frame_data_.Pass(); |
106 output_surface_->SwapBuffers(&compositor_frame); | 105 output_surface_->SwapBuffers(&compositor_frame); |
(...skipping 15 matching lines...) Expand all Loading... |
122 } | 121 } |
123 } | 122 } |
124 // We loop visibility to the GPU process, since that's what manages memory. | 123 // We loop visibility to the GPU process, since that's what manages memory. |
125 // That will allow it to feed us with memory allocations that we can act | 124 // That will allow it to feed us with memory allocations that we can act |
126 // upon. | 125 // upon. |
127 if (context_provider) | 126 if (context_provider) |
128 context_provider->ContextSupport()->SetSurfaceVisible(visible()); | 127 context_provider->ContextSupport()->SetSurfaceVisible(visible()); |
129 } | 128 } |
130 | 129 |
131 } // namespace cc | 130 } // namespace cc |
OLD | NEW |