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.h" | 5 #include "cc/surfaces/surface.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // If a referenced surface does not have a corresponding active frame in the | 213 // If a referenced surface does not have a corresponding active frame in the |
214 // display compositor, then it blocks this frame. | 214 // display compositor, then it blocks this frame. |
215 if (!surface || !surface->HasActiveFrame()) | 215 if (!surface || !surface->HasActiveFrame()) |
216 new_blocking_surfaces.insert(surface_id); | 216 new_blocking_surfaces.insert(surface_id); |
217 } | 217 } |
218 | 218 |
219 // If this Surface has a previous pending frame, then we must determine the | 219 // If this Surface has a previous pending frame, then we must determine the |
220 // changes in dependencies so that we can update the SurfaceDependencyTracker | 220 // changes in dependencies so that we can update the SurfaceDependencyTracker |
221 // map. | 221 // map. |
222 if (has_previous_pending_frame) { | 222 if (has_previous_pending_frame) { |
223 SurfaceDependencies removed_dependencies; | 223 base::flat_set<SurfaceId> removed_dependencies; |
224 for (const SurfaceId& surface_id : blocking_surfaces_) { | 224 for (const SurfaceId& surface_id : blocking_surfaces_) { |
225 if (!new_blocking_surfaces.count(surface_id)) | 225 if (!new_blocking_surfaces.count(surface_id)) |
226 removed_dependencies.insert(surface_id); | 226 removed_dependencies.insert(surface_id); |
227 } | 227 } |
228 | 228 |
229 SurfaceDependencies added_dependencies; | 229 base::flat_set<SurfaceId> added_dependencies; |
230 for (const SurfaceId& surface_id : new_blocking_surfaces) { | 230 for (const SurfaceId& surface_id : new_blocking_surfaces) { |
231 if (!blocking_surfaces_.count(surface_id)) | 231 if (!blocking_surfaces_.count(surface_id)) |
232 added_dependencies.insert(surface_id); | 232 added_dependencies.insert(surface_id); |
233 } | 233 } |
234 | 234 |
235 // If there is a change in the dependency set, then inform observers. | 235 // If there is a change in the dependency set, then inform observers. |
236 if (!added_dependencies.empty() || !removed_dependencies.empty()) { | 236 if (!added_dependencies.empty() || !removed_dependencies.empty()) { |
237 for (auto& observer : observers_) { | 237 for (auto& observer : observers_) { |
238 observer.OnSurfaceDependenciesChanged(this, added_dependencies, | 238 observer.OnSurfaceDependenciesChanged(this, added_dependencies, |
239 removed_dependencies); | 239 removed_dependencies); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 frame->metadata.latency_info.swap(*latency_info); | 346 frame->metadata.latency_info.swap(*latency_info); |
347 return; | 347 return; |
348 } | 348 } |
349 std::copy(frame->metadata.latency_info.begin(), | 349 std::copy(frame->metadata.latency_info.begin(), |
350 frame->metadata.latency_info.end(), | 350 frame->metadata.latency_info.end(), |
351 std::back_inserter(*latency_info)); | 351 std::back_inserter(*latency_info)); |
352 frame->metadata.latency_info.clear(); | 352 frame->metadata.latency_info.clear(); |
353 } | 353 } |
354 | 354 |
355 } // namespace cc | 355 } // namespace cc |
OLD | NEW |