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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 static void UnrefHelper(base::WeakPtr<SurfaceFactory> surface_factory, | 116 static void UnrefHelper(base::WeakPtr<SurfaceFactory> surface_factory, |
117 const ReturnedResourceArray& resources, | 117 const ReturnedResourceArray& resources, |
118 BlockingTaskRunner* main_thread_task_runner) { | 118 BlockingTaskRunner* main_thread_task_runner) { |
119 if (surface_factory) | 119 if (surface_factory) |
120 surface_factory->UnrefResources(resources); | 120 surface_factory->UnrefResources(resources); |
121 } | 121 } |
122 | 122 |
123 RenderPassId SurfaceAggregator::RemapPassId(RenderPassId surface_local_pass_id, | 123 RenderPassId SurfaceAggregator::RemapPassId(RenderPassId surface_local_pass_id, |
124 SurfaceId surface_id) { | 124 SurfaceId surface_id) { |
125 RenderPassIdAllocator* allocator = render_pass_allocator_map_.get(surface_id); | 125 scoped_ptr<RenderPassIdAllocator>& allocator = |
126 if (!allocator) { | 126 render_pass_allocator_map_[surface_id]; |
127 allocator = new RenderPassIdAllocator(&next_render_pass_id_); | 127 if (!allocator) |
128 render_pass_allocator_map_.set(surface_id, make_scoped_ptr(allocator)); | 128 allocator.reset(new RenderPassIdAllocator(&next_render_pass_id_)); |
129 } | |
130 allocator->AddKnownPass(surface_local_pass_id); | 129 allocator->AddKnownPass(surface_local_pass_id); |
131 return allocator->Remap(surface_local_pass_id); | 130 return allocator->Remap(surface_local_pass_id); |
132 } | 131 } |
133 | 132 |
134 int SurfaceAggregator::ChildIdForSurface(Surface* surface) { | 133 int SurfaceAggregator::ChildIdForSurface(Surface* surface) { |
135 SurfaceToResourceChildIdMap::iterator it = | 134 SurfaceToResourceChildIdMap::iterator it = |
136 surface_id_to_resource_child_id_.find(surface->surface_id()); | 135 surface_id_to_resource_child_id_.find(surface->surface_id()); |
137 if (it == surface_id_to_resource_child_id_.end()) { | 136 if (it == surface_id_to_resource_child_id_.end()) { |
138 int child_id = | 137 int child_id = |
139 provider_->CreateChild(base::Bind(&UnrefHelper, surface->factory())); | 138 provider_->CreateChild(base::Bind(&UnrefHelper, surface->factory())); |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 | 706 |
708 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { | 707 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { |
709 auto it = previous_contained_surfaces_.find(surface_id); | 708 auto it = previous_contained_surfaces_.find(surface_id); |
710 if (it == previous_contained_surfaces_.end()) | 709 if (it == previous_contained_surfaces_.end()) |
711 return; | 710 return; |
712 // Set the last drawn index as 0 to ensure full damage next time it's drawn. | 711 // Set the last drawn index as 0 to ensure full damage next time it's drawn. |
713 it->second = 0; | 712 it->second = 0; |
714 } | 713 } |
715 | 714 |
716 } // namespace cc | 715 } // namespace cc |
OLD | NEW |