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