| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 if (!invalid_frame) | 129 if (!invalid_frame) |
| 130 provider_->DeclareUsedResourcesFromChild(child_id, referenced_resources); | 130 provider_->DeclareUsedResourcesFromChild(child_id, referenced_resources); |
| 131 | 131 |
| 132 return invalid_frame; | 132 return invalid_frame; |
| 133 } | 133 } |
| 134 | 134 |
| 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 contained_surfaces_->insert(surface_id); |
| 138 // If this surface's id is already in our referenced set then it creates | 139 // If this surface's id is already in our referenced set then it creates |
| 139 // a cycle in the graph and should be dropped. | 140 // a cycle in the graph and should be dropped. |
| 140 if (referenced_surfaces_.count(surface_id)) | 141 if (referenced_surfaces_.count(surface_id)) |
| 141 return; | 142 return; |
| 142 Surface* surface = manager_->GetSurfaceForId(surface_id); | 143 Surface* surface = manager_->GetSurfaceForId(surface_id); |
| 143 if (!surface) | 144 if (!surface) |
| 144 return; | 145 return; |
| 145 const CompositorFrame* frame = surface->GetEligibleFrame(); | 146 const CompositorFrame* frame = surface->GetEligibleFrame(); |
| 146 if (!frame) | 147 if (!frame) |
| 147 return; | 148 return; |
| (...skipping 132 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<SurfaceId>* contained_surfaces) { |
| 294 contained_surfaces_ = contained_surfaces; |
| 295 contained_surfaces_->insert(surface_id); |
| 291 Surface* surface = manager_->GetSurfaceForId(surface_id); | 296 Surface* surface = manager_->GetSurfaceForId(surface_id); |
| 292 DCHECK(surface); | 297 DCHECK(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 |
| (...skipping 19 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 |