Chromium Code Reviews| Index: cc/surfaces/surface_manager.cc |
| diff --git a/cc/surfaces/surface_manager.cc b/cc/surfaces/surface_manager.cc |
| index 94bdac6aceaf9382966fc5dedcc45262303c0837..8d924c2189b723b0491879a7a4b6e76e6ed0e872 100644 |
| --- a/cc/surfaces/surface_manager.cc |
| +++ b/cc/surfaces/surface_manager.cc |
| @@ -224,6 +224,26 @@ void SurfaceManager::RemoveSurfaceReference(const SurfaceId& parent_id, |
| GarbageCollectSurfaces(); |
| } |
| +void SurfaceManager::AddSurfaceReferences( |
| + const std::vector<SurfaceReference>& references) { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| + |
| + for (const auto& reference : references) { |
|
kylechar
2017/01/25 15:54:33
Get rid of {} since the loop body is only one line
|
| + AddSurfaceReference(reference.parent_id(), reference.child_id()); |
| + } |
| +} |
| + |
| +void SurfaceManager::RemoveSurfaceReferences( |
| + const std::vector<SurfaceReference>& references) { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| + |
| + // TODO(kylechar): Each remove reference can trigger GC, it would be better if |
|
kylechar
2017/01/25 15:54:33
We can easily make this comment a reality now. Run
|
| + // we GC only once if removing multiple references. |
| + for (const auto& reference : references) { |
|
kylechar
2017/01/25 15:54:33
Get rid of {} since the loop body is only one line
|
| + RemoveSurfaceReference(reference.parent_id(), reference.child_id()); |
| + } |
| +} |
| + |
| size_t SurfaceManager::GetSurfaceReferenceCount( |
| const SurfaceId& surface_id) const { |
| auto iter = child_to_parent_refs_.find(surface_id); |