| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_SURFACES_SURFACE_REFERENCE_MANAGER_H_ |
| 6 #define CC_SURFACES_SURFACE_REFERENCE_MANAGER_H_ |
| 7 |
| 8 namespace cc { |
| 9 |
| 10 // Interface to manage surface references. |
| 11 class SurfaceReferenceManager { |
| 12 public: |
| 13 // Returns the top level root surface id. Surfaces that are not reachable |
| 14 // from this surface id may be garbage collected. Does not correspond to a |
| 15 // real Surface. |
| 16 virtual const SurfaceId& GetRootSurfaceId() const = 0; |
| 17 |
| 18 // Adds a reference from a parent surface to a child surface. Any surface |
| 19 // embedding a child surface should have a reference added so that the child |
| 20 // surface is not garbage collected until after the parent surface. |
| 21 virtual void AddSurfaceReference(const SurfaceId& parent_id, |
| 22 const SurfaceId& child_id) = 0; |
| 23 |
| 24 // Removes a reference from a parent surface to a child surface. |
| 25 virtual void RemoveSurfaceReference(const SurfaceId& parent_id, |
| 26 const SurfaceId& child_id) = 0; |
| 27 |
| 28 // Returns the number of surfaces that have references to |surface_id|. When |
| 29 // the count is zero nothing is referencing the surface and it may be garbage |
| 30 // collected. |
| 31 virtual size_t GetSurfaceReferenceCount( |
| 32 const SurfaceId& surface_id) const = 0; |
| 33 |
| 34 // Returns the number of surfaces that |surface_id| has references to. |
| 35 virtual size_t GetReferencedSurfaceCount( |
| 36 const SurfaceId& surface_id) const = 0; |
| 37 |
| 38 protected: |
| 39 virtual ~SurfaceReferenceManager() {} |
| 40 }; |
| 41 |
| 42 } // namespace cc |
| 43 |
| 44 #endif // CC_SURFACES_SURFACE_REFERENCE_MANAGER_H_ |
| OLD | NEW |