OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surfaces/surface_aggregator.h" | 5 #include "cc/surfaces/surface_aggregator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, | 135 void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, |
136 RenderPass* dest_pass) { | 136 RenderPass* dest_pass) { |
137 SurfaceId surface_id = surface_quad->surface_id; | 137 SurfaceId surface_id = surface_quad->surface_id; |
138 // If this surface's id is already in our referenced set then it creates | 138 // If this surface's id is already in our referenced set then it creates |
139 // a cycle in the graph and should be dropped. | 139 // a cycle in the graph and should be dropped. |
140 if (referenced_surfaces_.count(surface_id)) | 140 if (referenced_surfaces_.count(surface_id)) |
141 return; | 141 return; |
142 Surface* surface = manager_->GetSurfaceForId(surface_id); | 142 Surface* surface = manager_->GetSurfaceForId(surface_id); |
143 if (!surface) | 143 if (!surface) |
144 return; | 144 return; |
| 145 contained_surface_set_->insert(surface); |
145 const CompositorFrame* frame = surface->GetEligibleFrame(); | 146 const CompositorFrame* frame = surface->GetEligibleFrame(); |
146 if (!frame) | 147 if (!frame) |
147 return; | 148 return; |
148 const DelegatedFrameData* frame_data = frame->delegated_frame_data.get(); | 149 const DelegatedFrameData* frame_data = frame->delegated_frame_data.get(); |
149 if (!frame_data) | 150 if (!frame_data) |
150 return; | 151 return; |
151 | 152 |
152 RenderPassList render_pass_list; | 153 RenderPassList render_pass_list; |
153 bool invalid_frame = TakeResources(surface, frame_data, &render_pass_list); | 154 bool invalid_frame = TakeResources(surface, frame_data, &render_pass_list); |
154 if (invalid_frame) | 155 if (invalid_frame) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 CopyQuadsToPass(source.quad_list, | 281 CopyQuadsToPass(source.quad_list, |
281 source.shared_quad_state_list, | 282 source.shared_quad_state_list, |
282 gfx::Transform(), | 283 gfx::Transform(), |
283 copy_pass.get(), | 284 copy_pass.get(), |
284 surface_id); | 285 surface_id); |
285 | 286 |
286 dest_pass_list_->push_back(copy_pass.Pass()); | 287 dest_pass_list_->push_back(copy_pass.Pass()); |
287 } | 288 } |
288 } | 289 } |
289 | 290 |
290 scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) { | 291 scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate( |
| 292 SurfaceId surface_id, |
| 293 std::set<Surface*>* contained_surfaces) { |
| 294 contained_surface_set_ = contained_surfaces; |
291 Surface* surface = manager_->GetSurfaceForId(surface_id); | 295 Surface* surface = manager_->GetSurfaceForId(surface_id); |
292 DCHECK(surface); | 296 DCHECK(surface); |
| 297 contained_surface_set_->insert(surface); |
293 const CompositorFrame* root_surface_frame = surface->GetEligibleFrame(); | 298 const CompositorFrame* root_surface_frame = surface->GetEligibleFrame(); |
294 if (!root_surface_frame) | 299 if (!root_surface_frame) |
295 return scoped_ptr<CompositorFrame>(); | 300 return scoped_ptr<CompositorFrame>(); |
296 TRACE_EVENT0("cc", "SurfaceAggregator::Aggregate"); | 301 TRACE_EVENT0("cc", "SurfaceAggregator::Aggregate"); |
297 | 302 |
298 scoped_ptr<CompositorFrame> frame(new CompositorFrame); | 303 scoped_ptr<CompositorFrame> frame(new CompositorFrame); |
299 frame->delegated_frame_data = make_scoped_ptr(new DelegatedFrameData); | 304 frame->delegated_frame_data = make_scoped_ptr(new DelegatedFrameData); |
300 | 305 |
301 DCHECK(root_surface_frame->delegated_frame_data); | 306 DCHECK(root_surface_frame->delegated_frame_data); |
302 | 307 |
(...skipping 17 matching lines...) Expand all Loading... |
320 | 325 |
321 dest_pass_list_ = NULL; | 326 dest_pass_list_ = NULL; |
322 | 327 |
323 // TODO(jamesr): Aggregate all resource references into the returned frame's | 328 // TODO(jamesr): Aggregate all resource references into the returned frame's |
324 // resource list. | 329 // resource list. |
325 | 330 |
326 return frame.Pass(); | 331 return frame.Pass(); |
327 } | 332 } |
328 | 333 |
329 } // namespace cc | 334 } // namespace cc |
OLD | NEW |