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_manager.h" | 5 #include "cc/surfaces/surface_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 live_surfaces.push_back(surface_id); | 320 live_surfaces.push_back(surface_id); |
321 } | 321 } |
322 } | 322 } |
323 | 323 |
324 // Mark all surfaces reachable from live surfaces by adding them to | 324 // Mark all surfaces reachable from live surfaces by adding them to |
325 // live_surfaces and live_surfaces_set. | 325 // live_surfaces and live_surfaces_set. |
326 for (size_t i = 0; i < live_surfaces.size(); i++) { | 326 for (size_t i = 0; i < live_surfaces.size(); i++) { |
327 Surface* surf = surface_map_[live_surfaces[i]]; | 327 Surface* surf = surface_map_[live_surfaces[i]]; |
328 DCHECK(surf); | 328 DCHECK(surf); |
329 | 329 |
330 for (const SurfaceId& id : surf->referenced_surfaces()) { | 330 // TODO(fsamuel): We should probably keep alive pending referenced surfaces |
| 331 // too. |
| 332 for (const SurfaceId& id : surf->active_referenced_surfaces()) { |
331 if (live_surfaces_set.count(id)) | 333 if (live_surfaces_set.count(id)) |
332 continue; | 334 continue; |
333 | 335 |
334 Surface* surf2 = GetSurfaceForId(id); | 336 Surface* surf2 = GetSurfaceForId(id); |
335 if (surf2) { | 337 if (surf2) { |
336 live_surfaces.push_back(id); | 338 live_surfaces.push_back(id); |
337 live_surfaces_set.insert(id); | 339 live_surfaces_set.insert(id); |
338 } | 340 } |
339 } | 341 } |
340 } | 342 } |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); | 635 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); |
634 std::sort(children.begin(), children.end()); | 636 std::sort(children.begin(), children.end()); |
635 | 637 |
636 for (const SurfaceId& child_id : children) | 638 for (const SurfaceId& child_id : children) |
637 SurfaceReferencesToStringImpl(child_id, indent + " ", str); | 639 SurfaceReferencesToStringImpl(child_id, indent + " ", str); |
638 } | 640 } |
639 } | 641 } |
640 #endif // DCHECK_IS_ON() | 642 #endif // DCHECK_IS_ON() |
641 | 643 |
642 } // namespace cc | 644 } // namespace cc |
OLD | NEW |