| 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 return true; | 482 return true; |
| 483 if (ChildContains(children[i], search_frame_sink_id)) | 483 if (ChildContains(children[i], search_frame_sink_id)) |
| 484 return true; | 484 return true; |
| 485 } | 485 } |
| 486 return false; | 486 return false; |
| 487 } | 487 } |
| 488 | 488 |
| 489 void SurfaceManager::RegisterFrameSinkHierarchy( | 489 void SurfaceManager::RegisterFrameSinkHierarchy( |
| 490 const FrameSinkId& parent_frame_sink_id, | 490 const FrameSinkId& parent_frame_sink_id, |
| 491 const FrameSinkId& child_frame_sink_id) { | 491 const FrameSinkId& child_frame_sink_id) { |
| 492 DCHECK_EQ(valid_frame_sink_ids_.count(parent_frame_sink_id), 1u); | |
| 493 DCHECK_EQ(valid_frame_sink_ids_.count(child_frame_sink_id), 1u); | |
| 494 | |
| 495 // If it's possible to reach the parent through the child's descendant chain, | 492 // If it's possible to reach the parent through the child's descendant chain, |
| 496 // then this will create an infinite loop. Might as well just crash here. | 493 // then this will create an infinite loop. Might as well just crash here. |
| 497 CHECK(!ChildContains(child_frame_sink_id, parent_frame_sink_id)); | 494 CHECK(!ChildContains(child_frame_sink_id, parent_frame_sink_id)); |
| 498 | 495 |
| 499 std::vector<FrameSinkId>& children = | 496 std::vector<FrameSinkId>& children = |
| 500 frame_sink_source_map_[parent_frame_sink_id].children; | 497 frame_sink_source_map_[parent_frame_sink_id].children; |
| 501 for (size_t i = 0; i < children.size(); ++i) | 498 for (size_t i = 0; i < children.size(); ++i) |
| 502 DCHECK(children[i] != child_frame_sink_id); | 499 DCHECK(children[i] != child_frame_sink_id); |
| 503 children.push_back(child_frame_sink_id); | 500 children.push_back(child_frame_sink_id); |
| 504 | 501 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); | 635 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); |
| 639 std::sort(children.begin(), children.end()); | 636 std::sort(children.begin(), children.end()); |
| 640 | 637 |
| 641 for (const SurfaceId& child_id : children) | 638 for (const SurfaceId& child_id : children) |
| 642 SurfaceReferencesToStringImpl(child_id, indent + " ", str); | 639 SurfaceReferencesToStringImpl(child_id, indent + " ", str); |
| 643 } | 640 } |
| 644 } | 641 } |
| 645 #endif // DCHECK_IS_ON() | 642 #endif // DCHECK_IS_ON() |
| 646 | 643 |
| 647 } // namespace cc | 644 } // namespace cc |
| OLD | NEW |