| 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 #ifndef CC_SURFACES_SURFACE_MANAGER_H_ | 5 #ifndef CC_SURFACES_SURFACE_MANAGER_H_ |
| 6 #define CC_SURFACES_SURFACE_MANAGER_H_ | 6 #define CC_SURFACES_SURFACE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <unordered_map> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 16 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
| 17 #include "cc/surfaces/surface_damage_observer.h" | 18 #include "cc/surfaces/surface_damage_observer.h" |
| 18 #include "cc/surfaces/surface_id.h" | 19 #include "cc/surfaces/surface_id.h" |
| 19 #include "cc/surfaces/surface_sequence.h" | 20 #include "cc/surfaces/surface_sequence.h" |
| 20 #include "cc/surfaces/surfaces_export.h" | 21 #include "cc/surfaces/surfaces_export.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 54 |
| 54 void RegisterSurfaceIdNamespace(uint32_t id_namespace); | 55 void RegisterSurfaceIdNamespace(uint32_t id_namespace); |
| 55 | 56 |
| 56 // Invalidate a namespace that might still have associated sequences, | 57 // Invalidate a namespace that might still have associated sequences, |
| 57 // possibly because a renderer process has crashed. | 58 // possibly because a renderer process has crashed. |
| 58 void InvalidateSurfaceIdNamespace(uint32_t id_namespace); | 59 void InvalidateSurfaceIdNamespace(uint32_t id_namespace); |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 void GarbageCollectSurfaces(); | 62 void GarbageCollectSurfaces(); |
| 62 | 63 |
| 63 typedef base::hash_map<SurfaceId, Surface*> SurfaceMap; | 64 using SurfaceMap = std::unordered_map<SurfaceId, Surface*, SurfaceIdHash>; |
| 64 SurfaceMap surface_map_; | 65 SurfaceMap surface_map_; |
| 65 base::ObserverList<SurfaceDamageObserver> observer_list_; | 66 base::ObserverList<SurfaceDamageObserver> observer_list_; |
| 66 base::ThreadChecker thread_checker_; | 67 base::ThreadChecker thread_checker_; |
| 67 | 68 |
| 68 // List of surfaces to be destroyed, along with what sequences they're still | 69 // List of surfaces to be destroyed, along with what sequences they're still |
| 69 // waiting on. | 70 // waiting on. |
| 70 typedef std::list<Surface*> SurfaceDestroyList; | 71 using SurfaceDestroyList = std::list<Surface*>; |
| 71 SurfaceDestroyList surfaces_to_destroy_; | 72 SurfaceDestroyList surfaces_to_destroy_; |
| 72 | 73 |
| 73 // Set of SurfaceSequences that have been satisfied by a frame but not yet | 74 // Set of SurfaceSequences that have been satisfied by a frame but not yet |
| 74 // waited on. | 75 // waited on. |
| 75 base::hash_set<SurfaceSequence> satisfied_sequences_; | 76 base::hash_set<SurfaceSequence> satisfied_sequences_; |
| 76 | 77 |
| 77 // Set of valid surface ID namespaces. When a namespace is removed from | 78 // Set of valid surface ID namespaces. When a namespace is removed from |
| 78 // this set, any remaining sequences with that namespace are considered | 79 // this set, any remaining sequences with that namespace are considered |
| 79 // satisfied. | 80 // satisfied. |
| 80 base::hash_set<uint32_t> valid_surface_id_namespaces_; | 81 base::hash_set<uint32_t> valid_surface_id_namespaces_; |
| 81 | 82 |
| 82 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); | 83 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace cc | 86 } // namespace cc |
| 86 | 87 |
| 87 #endif // CC_SURFACES_SURFACE_MANAGER_H_ | 88 #endif // CC_SURFACES_SURFACE_MANAGER_H_ |
| OLD | NEW |