| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 #if DCHECK_IS_ON() | 75 #if DCHECK_IS_ON() |
| 76 std::string SurfaceManager::SurfaceReferencesToString() { | 76 std::string SurfaceManager::SurfaceReferencesToString() { |
| 77 std::stringstream str; | 77 std::stringstream str; |
| 78 SurfaceReferencesToStringImpl(root_surface_id_, "", &str); | 78 SurfaceReferencesToStringImpl(root_surface_id_, "", &str); |
| 79 return str.str(); | 79 return str.str(); |
| 80 } | 80 } |
| 81 #endif | 81 #endif |
| 82 | 82 |
| 83 void SurfaceManager::SetDependencyTracker( |
| 84 std::unique_ptr<SurfaceDependencyTracker> dependency_tracker) { |
| 85 dependency_tracker_ = std::move(dependency_tracker); |
| 86 } |
| 87 |
| 88 void SurfaceManager::RequestSurfaceResolution(Surface* pending_surface) { |
| 89 if (dependency_tracker_) |
| 90 dependency_tracker_->RequestSurfaceResolution(pending_surface); |
| 91 } |
| 92 |
| 83 void SurfaceManager::RegisterSurface(Surface* surface) { | 93 void SurfaceManager::RegisterSurface(Surface* surface) { |
| 84 DCHECK(thread_checker_.CalledOnValidThread()); | 94 DCHECK(thread_checker_.CalledOnValidThread()); |
| 85 DCHECK(surface); | 95 DCHECK(surface); |
| 86 DCHECK(!surface_map_.count(surface->surface_id())); | 96 DCHECK(!surface_map_.count(surface->surface_id())); |
| 87 surface_map_[surface->surface_id()] = surface; | 97 surface_map_[surface->surface_id()] = surface; |
| 88 } | 98 } |
| 89 | 99 |
| 90 void SurfaceManager::DeregisterSurface(const SurfaceId& surface_id) { | 100 void SurfaceManager::DeregisterSurface(const SurfaceId& surface_id) { |
| 91 DCHECK(thread_checker_.CalledOnValidThread()); | 101 DCHECK(thread_checker_.CalledOnValidThread()); |
| 92 SurfaceMap::iterator it = surface_map_.find(surface_id); | 102 SurfaceMap::iterator it = surface_map_.find(surface_id); |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 std::string indent, | 600 std::string indent, |
| 591 std::stringstream* str) { | 601 std::stringstream* str) { |
| 592 *str << indent; | 602 *str << indent; |
| 593 | 603 |
| 594 // Print the current line for |surface_id|. | 604 // Print the current line for |surface_id|. |
| 595 Surface* surface = GetSurfaceForId(surface_id); | 605 Surface* surface = GetSurfaceForId(surface_id); |
| 596 if (surface) { | 606 if (surface) { |
| 597 *str << surface->surface_id().ToString(); | 607 *str << surface->surface_id().ToString(); |
| 598 *str << (surface->destroyed() ? " destroyed " : " live "); | 608 *str << (surface->destroyed() ? " destroyed " : " live "); |
| 599 | 609 |
| 600 if (surface->HasFrame()) { | 610 if (surface->HasPendingFrame()) { |
| 601 // This provides the surface size from the root render pass. | 611 // This provides the surface size from the root render pass. |
| 602 const CompositorFrame& frame = surface->GetEligibleFrame(); | 612 const CompositorFrame& frame = surface->GetPendingFrame(); |
| 603 *str << frame.render_pass_list.back()->output_rect.size().ToString(); | 613 *str << "pending " |
| 614 << frame.render_pass_list.back()->output_rect.size().ToString() |
| 615 << " "; |
| 616 } |
| 617 |
| 618 if (surface->HasActiveFrame()) { |
| 619 // This provides the surface size from the root render pass. |
| 620 const CompositorFrame& frame = surface->GetActiveFrame(); |
| 621 *str << "active " |
| 622 << frame.render_pass_list.back()->output_rect.size().ToString(); |
| 604 } | 623 } |
| 605 } else { | 624 } else { |
| 606 *str << surface_id; | 625 *str << surface_id; |
| 607 } | 626 } |
| 608 *str << "\n"; | 627 *str << "\n"; |
| 609 | 628 |
| 610 // If the current surface has references to children, sort children and print | 629 // If the current surface has references to children, sort children and print |
| 611 // references for each child. | 630 // references for each child. |
| 612 auto iter = parent_to_child_refs_.find(surface_id); | 631 auto iter = parent_to_child_refs_.find(surface_id); |
| 613 if (iter != parent_to_child_refs_.end()) { | 632 if (iter != parent_to_child_refs_.end()) { |
| 614 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); | 633 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); |
| 615 std::sort(children.begin(), children.end()); | 634 std::sort(children.begin(), children.end()); |
| 616 | 635 |
| 617 for (const SurfaceId& child_id : children) | 636 for (const SurfaceId& child_id : children) |
| 618 SurfaceReferencesToStringImpl(child_id, indent + " ", str); | 637 SurfaceReferencesToStringImpl(child_id, indent + " ", str); |
| 619 } | 638 } |
| 620 } | 639 } |
| 621 #endif // DCHECK_IS_ON() | 640 #endif // DCHECK_IS_ON() |
| 622 | 641 |
| 623 } // namespace cc | 642 } // namespace cc |
| OLD | NEW |