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 "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 surface_map_[surface->surface_id()] = surface; | 50 surface_map_[surface->surface_id()] = surface; |
51 } | 51 } |
52 | 52 |
53 void SurfaceManager::DeregisterSurface(SurfaceId surface_id) { | 53 void SurfaceManager::DeregisterSurface(SurfaceId surface_id) { |
54 DCHECK(thread_checker_.CalledOnValidThread()); | 54 DCHECK(thread_checker_.CalledOnValidThread()); |
55 SurfaceMap::iterator it = surface_map_.find(surface_id); | 55 SurfaceMap::iterator it = surface_map_.find(surface_id); |
56 DCHECK(it != surface_map_.end()); | 56 DCHECK(it != surface_map_.end()); |
57 surface_map_.erase(it); | 57 surface_map_.erase(it); |
58 } | 58 } |
59 | 59 |
60 void SurfaceManager::Destroy(scoped_ptr<Surface> surface) { | 60 void SurfaceManager::Destroy(std::unique_ptr<Surface> surface) { |
61 DCHECK(thread_checker_.CalledOnValidThread()); | 61 DCHECK(thread_checker_.CalledOnValidThread()); |
62 surface->set_destroyed(true); | 62 surface->set_destroyed(true); |
63 surfaces_to_destroy_.push_back(surface.release()); | 63 surfaces_to_destroy_.push_back(surface.release()); |
64 GarbageCollectSurfaces(); | 64 GarbageCollectSurfaces(); |
65 } | 65 } |
66 | 66 |
67 void SurfaceManager::DidSatisfySequences(uint32_t id_namespace, | 67 void SurfaceManager::DidSatisfySequences(uint32_t id_namespace, |
68 std::vector<uint32_t>* sequence) { | 68 std::vector<uint32_t>* sequence) { |
69 DCHECK(thread_checker_.CalledOnValidThread()); | 69 DCHECK(thread_checker_.CalledOnValidThread()); |
70 for (std::vector<uint32_t>::iterator it = sequence->begin(); | 70 for (std::vector<uint32_t>::iterator it = sequence->begin(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 live_surfaces.push_back(id); | 120 live_surfaces.push_back(id); |
121 live_surfaces_set.insert(id); | 121 live_surfaces_set.insert(id); |
122 } | 122 } |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 // Destroy all remaining unreachable surfaces. | 126 // Destroy all remaining unreachable surfaces. |
127 for (SurfaceDestroyList::iterator dest_it = surfaces_to_destroy_.begin(); | 127 for (SurfaceDestroyList::iterator dest_it = surfaces_to_destroy_.begin(); |
128 dest_it != surfaces_to_destroy_.end();) { | 128 dest_it != surfaces_to_destroy_.end();) { |
129 if (!live_surfaces_set.count((*dest_it)->surface_id())) { | 129 if (!live_surfaces_set.count((*dest_it)->surface_id())) { |
130 scoped_ptr<Surface> surf(*dest_it); | 130 std::unique_ptr<Surface> surf(*dest_it); |
131 DeregisterSurface(surf->surface_id()); | 131 DeregisterSurface(surf->surface_id()); |
132 dest_it = surfaces_to_destroy_.erase(dest_it); | 132 dest_it = surfaces_to_destroy_.erase(dest_it); |
133 } else { | 133 } else { |
134 ++dest_it; | 134 ++dest_it; |
135 } | 135 } |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 void SurfaceManager::RegisterSurfaceFactoryClient( | 139 void SurfaceManager::RegisterSurfaceFactoryClient( |
140 uint32_t id_namespace, | 140 uint32_t id_namespace, |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 bool SurfaceManager::SurfaceModified(SurfaceId surface_id) { | 333 bool SurfaceManager::SurfaceModified(SurfaceId surface_id) { |
334 CHECK(thread_checker_.CalledOnValidThread()); | 334 CHECK(thread_checker_.CalledOnValidThread()); |
335 bool changed = false; | 335 bool changed = false; |
336 FOR_EACH_OBSERVER(SurfaceDamageObserver, observer_list_, | 336 FOR_EACH_OBSERVER(SurfaceDamageObserver, observer_list_, |
337 OnSurfaceDamaged(surface_id, &changed)); | 337 OnSurfaceDamaged(surface_id, &changed)); |
338 return changed; | 338 return changed; |
339 } | 339 } |
340 | 340 |
341 } // namespace cc | 341 } // namespace cc |
OLD | NEW |