| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 surfaces_to_destroy_.erase(it); | 111 surfaces_to_destroy_.erase(it); |
| 112 surface->set_destroyed(false); | 112 surface->set_destroyed(false); |
| 113 DCHECK_EQ(compositor_frame_sink_support.get(), | 113 DCHECK_EQ(compositor_frame_sink_support.get(), |
| 114 surface->compositor_frame_sink_support().get()); | 114 surface->compositor_frame_sink_support().get()); |
| 115 return surface; | 115 return surface; |
| 116 } | 116 } |
| 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_) | |
| 122 observer.OnSurfaceDestroyed(surface->surface_id()); | |
| 123 surfaces_to_destroy_.push_back(std::move(surface)); | 121 surfaces_to_destroy_.push_back(std::move(surface)); |
| 124 GarbageCollectSurfaces(); | 122 GarbageCollectSurfaces(); |
| 125 } | 123 } |
| 126 | 124 |
| 127 void SurfaceManager::RequireSequence(const SurfaceId& surface_id, | 125 void SurfaceManager::RequireSequence(const SurfaceId& surface_id, |
| 128 const SurfaceSequence& sequence) { | 126 const SurfaceSequence& sequence) { |
| 129 auto* surface = GetSurfaceForId(surface_id); | 127 auto* surface = GetSurfaceForId(surface_id); |
| 130 if (!surface) { | 128 if (!surface) { |
| 131 DLOG(ERROR) << "Attempting to require callback on nonexistent surface"; | 129 DLOG(ERROR) << "Attempting to require callback on nonexistent surface"; |
| 132 return; | 130 return; |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); | 557 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); |
| 560 std::sort(children.begin(), children.end()); | 558 std::sort(children.begin(), children.end()); |
| 561 | 559 |
| 562 for (const SurfaceId& child_id : children) | 560 for (const SurfaceId& child_id : children) |
| 563 SurfaceReferencesToStringImpl(child_id, indent + " ", str); | 561 SurfaceReferencesToStringImpl(child_id, indent + " ", str); |
| 564 } | 562 } |
| 565 } | 563 } |
| 566 #endif // DCHECK_IS_ON() | 564 #endif // DCHECK_IS_ON() |
| 567 | 565 |
| 568 } // namespace cc | 566 } // namespace cc |
| OLD | NEW |