| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/ui/surfaces/display_compositor.h" | 5 #include "services/ui/surfaces/display_compositor.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // Remove temporary references for surfaces with the same FrameSinkId that | 162 // Remove temporary references for surfaces with the same FrameSinkId that |
| 163 // were created before |child_id|. The earlier surfaces were never embedded in | 163 // were created before |child_id|. The earlier surfaces were never embedded in |
| 164 // the parent and the parent is embedding a later surface, so we know the | 164 // the parent and the parent is embedding a later surface, so we know the |
| 165 // parent doesn't need them anymore. | 165 // parent doesn't need them anymore. |
| 166 for (auto iter = refs.begin(); iter != temp_ref_iter; ++iter) { | 166 for (auto iter = refs.begin(); iter != temp_ref_iter; ++iter) { |
| 167 cc::SurfaceId id = cc::SurfaceId(child_id.frame_sink_id(), *iter); | 167 cc::SurfaceId id = cc::SurfaceId(child_id.frame_sink_id(), *iter); |
| 168 reference_manager_->RemoveSurfaceReference(GetRootSurfaceId(), id); | 168 reference_manager_->RemoveSurfaceReference(GetRootSurfaceId(), id); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Remove markers for temporary references up to |child_id|, as the temporary | 171 // Remove markers for temporary references up to |child_id|, as the temporary |
| 172 // references they correspond to were removed above. If |ref_iter| is the last | 172 // references they correspond to were removed above. If |temp_ref_iter| points |
| 173 // element in |refs| then we are removing all temporary references for the | 173 // at the last element in |refs| then we are removing all temporary references |
| 174 // FrameSinkId and can remove the map entry entirely. | 174 // for the FrameSinkId and can remove the map entry entirely. |
| 175 if (++temp_ref_iter == refs.end()) | 175 if (++temp_ref_iter == refs.end()) |
| 176 temp_references_.erase(child_id.frame_sink_id()); | 176 temp_references_.erase(child_id.frame_sink_id()); |
| 177 else | 177 else |
| 178 refs.erase(refs.begin(), ++temp_ref_iter); | 178 refs.erase(refs.begin(), temp_ref_iter); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void DisplayCompositor::RemoveSurfaceReference( | 181 void DisplayCompositor::RemoveSurfaceReference( |
| 182 const cc::SurfaceReference& ref) { | 182 const cc::SurfaceReference& ref) { |
| 183 reference_manager_->RemoveSurfaceReference(ref.parent_id(), ref.child_id()); | 183 reference_manager_->RemoveSurfaceReference(ref.parent_id(), ref.child_id()); |
| 184 } | 184 } |
| 185 | 185 |
| 186 std::unique_ptr<cc::Display> DisplayCompositor::CreateDisplay( | 186 std::unique_ptr<cc::Display> DisplayCompositor::CreateDisplay( |
| 187 const cc::FrameSinkId& frame_sink_id, | 187 const cc::FrameSinkId& frame_sink_id, |
| 188 gpu::SurfaceHandle surface_handle, | 188 gpu::SurfaceHandle surface_handle, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 surface_info.id().local_frame_id()); | 266 surface_info.id().local_frame_id()); |
| 267 | 267 |
| 268 if (client_) | 268 if (client_) |
| 269 client_->OnSurfaceCreated(surface_info); | 269 client_->OnSurfaceCreated(surface_info); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void DisplayCompositor::OnSurfaceDamaged(const cc::SurfaceId& surface_id, | 272 void DisplayCompositor::OnSurfaceDamaged(const cc::SurfaceId& surface_id, |
| 273 bool* changed) {} | 273 bool* changed) {} |
| 274 | 274 |
| 275 } // namespace ui | 275 } // namespace ui |
| OLD | NEW |