Chromium Code Reviews| 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 #ifndef CC_SURFACES_SURFACE_AGGREGATOR_H_ | 5 #ifndef CC_SURFACES_SURFACE_AGGREGATOR_H_ |
| 6 #define CC_SURFACES_SURFACE_AGGREGATOR_H_ | 6 #define CC_SURFACES_SURFACE_AGGREGATOR_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 class ResourceProvider; | 22 class ResourceProvider; |
| 23 class Surface; | 23 class Surface; |
| 24 class SurfaceDrawQuad; | 24 class SurfaceDrawQuad; |
| 25 class SurfaceManager; | 25 class SurfaceManager; |
| 26 | 26 |
| 27 class CC_SURFACES_EXPORT SurfaceAggregator { | 27 class CC_SURFACES_EXPORT SurfaceAggregator { |
| 28 public: | 28 public: |
| 29 SurfaceAggregator(SurfaceManager* manager, ResourceProvider* provider); | 29 SurfaceAggregator(SurfaceManager* manager, ResourceProvider* provider); |
| 30 ~SurfaceAggregator(); | 30 ~SurfaceAggregator(); |
| 31 | 31 |
| 32 scoped_ptr<CompositorFrame> Aggregate( | 32 scoped_ptr<CompositorFrame> Aggregate(SurfaceId surface_id); |
| 33 SurfaceId surface_id, | 33 base::hash_map<SurfaceId, int>& previous_contained_surfaces() { |
| 34 std::set<SurfaceId>* contained_surfaces); | 34 return previous_contained_surfaces_; |
| 35 } | |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 RenderPassId RemapPassId(RenderPassId surface_local_pass_id, | 38 RenderPassId RemapPassId(RenderPassId surface_local_pass_id, |
| 38 SurfaceId surface_id); | 39 SurfaceId surface_id); |
| 39 | 40 |
| 40 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, | 41 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, |
| 41 RenderPass* dest_pass); | 42 RenderPass* dest_pass); |
| 42 void CopySharedQuadState(const SharedQuadState* source_sqs, | 43 void CopySharedQuadState(const SharedQuadState* source_sqs, |
| 43 const gfx::Transform& content_to_target_transform, | 44 const gfx::Transform& content_to_target_transform, |
| 44 RenderPass* dest_render_pass); | 45 RenderPass* dest_render_pass); |
| 45 void CopyQuadsToPass(const QuadList& source_quad_list, | 46 void CopyQuadsToPass(const QuadList& source_quad_list, |
| 46 const SharedQuadStateList& source_shared_quad_state_list, | 47 const SharedQuadStateList& source_shared_quad_state_list, |
| 47 const gfx::Transform& content_to_target_transform, | 48 const gfx::Transform& content_to_target_transform, |
| 48 RenderPass* dest_pass, | 49 RenderPass* dest_pass, |
| 49 SurfaceId surface_id); | 50 SurfaceId surface_id); |
| 50 void CopyPasses(const RenderPassList& source_pass_list, SurfaceId surface_id); | 51 void CopyPasses(const RenderPassList& source_pass_list, |
| 52 const Surface* surface); | |
| 51 | 53 |
| 52 bool TakeResources(Surface* surface, | 54 bool TakeResources(Surface* surface, |
| 53 const DelegatedFrameData* frame_data, | 55 const DelegatedFrameData* frame_data, |
| 54 RenderPassList* render_pass_list); | 56 RenderPassList* render_pass_list); |
| 55 int ChildIdForSurface(Surface* surface); | 57 int ChildIdForSurface(Surface* surface); |
| 58 gfx::Rect DamageRectForSurface(const Surface* surface, | |
| 59 const RenderPass& source); | |
| 56 | 60 |
| 57 SurfaceManager* manager_; | 61 SurfaceManager* manager_; |
| 58 ResourceProvider* provider_; | 62 ResourceProvider* provider_; |
| 59 | 63 |
| 60 class RenderPassIdAllocator; | 64 class RenderPassIdAllocator; |
| 61 typedef base::ScopedPtrHashMap<SurfaceId, RenderPassIdAllocator> | 65 typedef base::ScopedPtrHashMap<SurfaceId, RenderPassIdAllocator> |
| 62 RenderPassIdAllocatorMap; | 66 RenderPassIdAllocatorMap; |
| 63 RenderPassIdAllocatorMap render_pass_allocator_map_; | 67 RenderPassIdAllocatorMap render_pass_allocator_map_; |
| 64 | 68 |
| 65 typedef base::hash_map<SurfaceId, int> SurfaceToResourceChildIdMap; | 69 typedef base::hash_map<SurfaceId, int> SurfaceToResourceChildIdMap; |
| 66 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; | 70 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; |
| 67 | 71 |
| 68 // The following state is only valid for the duration of one Aggregate call | 72 // The following state is only valid for the duration of one Aggregate call |
| 69 // and is only stored on the class to avoid having to pass through every | 73 // and is only stored on the class to avoid having to pass through every |
| 70 // function call. | 74 // function call. |
| 71 | 75 |
| 72 // This is the set of surfaces referenced in the aggregation so far, used to | 76 // This is the set of surfaces referenced in the aggregation so far, used to |
| 73 // detect cycles. | 77 // detect cycles. |
| 74 typedef std::set<SurfaceId> SurfaceSet; | 78 typedef std::set<SurfaceId> SurfaceSet; |
| 75 SurfaceSet referenced_surfaces_; | 79 SurfaceSet referenced_surfaces_; |
| 76 | 80 |
| 77 // This is the set of surfaces that were used in the last draw. | 81 // For each Surface used in the last aggregation, gives the frame_index at |
| 78 SurfaceSet* contained_surfaces_; | 82 // that time. |
| 83 base::hash_map<SurfaceId, int> previous_contained_surfaces_; | |
|
jamesr
2014/08/26 22:06:22
could use a typedef for this container type, it's
| |
| 84 base::hash_map<SurfaceId, int> contained_surfaces_; | |
| 79 | 85 |
| 80 // This is the pass list for the aggregated frame. | 86 // This is the pass list for the aggregated frame. |
| 81 RenderPassList* dest_pass_list_; | 87 RenderPassList* dest_pass_list_; |
| 82 | 88 |
| 83 // Resource list for the aggregated frame. | 89 // Resource list for the aggregated frame. |
| 84 TransferableResourceArray* dest_resource_list_; | 90 TransferableResourceArray* dest_resource_list_; |
| 85 | 91 |
| 86 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); | 92 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); |
| 87 }; | 93 }; |
| 88 | 94 |
| 89 } // namespace cc | 95 } // namespace cc |
| 90 | 96 |
| 91 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ | 97 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ |
| OLD | NEW |