| 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 <algorithm> | 10 #include <algorithm> |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 void SurfaceManager::DestroySurface(std::unique_ptr<Surface> surface) { | 121 void SurfaceManager::DestroySurface(std::unique_ptr<Surface> surface) { |
| 122 DCHECK(thread_checker_.CalledOnValidThread()); | 122 DCHECK(thread_checker_.CalledOnValidThread()); |
| 123 surface->set_destroyed(true); | 123 surface->set_destroyed(true); |
| 124 for (auto& observer : observer_list_) | 124 for (auto& observer : observer_list_) |
| 125 observer.OnSurfaceDestroyed(surface->surface_id()); | 125 observer.OnSurfaceDestroyed(surface->surface_id()); |
| 126 surfaces_to_destroy_.push_back(std::move(surface)); | 126 surfaces_to_destroy_.push_back(std::move(surface)); |
| 127 GarbageCollectSurfaces(); | 127 GarbageCollectSurfaces(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void SurfaceManager::SurfaceWillDraw(const SurfaceId& surface_id) { |
| 131 DCHECK(thread_checker_.CalledOnValidThread()); |
| 132 for (auto& observer : observer_list_) |
| 133 observer.OnSurfaceWillDraw(surface_id); |
| 134 } |
| 135 |
| 130 void SurfaceManager::RequireSequence(const SurfaceId& surface_id, | 136 void SurfaceManager::RequireSequence(const SurfaceId& surface_id, |
| 131 const SurfaceSequence& sequence) { | 137 const SurfaceSequence& sequence) { |
| 132 auto* surface = GetSurfaceForId(surface_id); | 138 auto* surface = GetSurfaceForId(surface_id); |
| 133 if (!surface) { | 139 if (!surface) { |
| 134 DLOG(ERROR) << "Attempting to require callback on nonexistent surface"; | 140 DLOG(ERROR) << "Attempting to require callback on nonexistent surface"; |
| 135 return; | 141 return; |
| 136 } | 142 } |
| 137 surface->AddDestructionDependency(sequence); | 143 surface->AddDestructionDependency(sequence); |
| 138 } | 144 } |
| 139 | 145 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 *str << "\n"; | 565 *str << "\n"; |
| 560 | 566 |
| 561 // If the current surface has references to children, sort children and print | 567 // If the current surface has references to children, sort children and print |
| 562 // references for each child. | 568 // references for each child. |
| 563 for (const SurfaceId& child_id : GetSurfacesReferencedByParent(surface_id)) | 569 for (const SurfaceId& child_id : GetSurfacesReferencedByParent(surface_id)) |
| 564 SurfaceReferencesToStringImpl(child_id, indent + " ", str); | 570 SurfaceReferencesToStringImpl(child_id, indent + " ", str); |
| 565 } | 571 } |
| 566 #endif // DCHECK_IS_ON() | 572 #endif // DCHECK_IS_ON() |
| 567 | 573 |
| 568 } // namespace cc | 574 } // namespace cc |
| OLD | NEW |