| 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_RESOURCE_HOLDER_H_ | 5 #ifndef CC_SURFACES_SURFACE_RESOURCE_HOLDER_H_ |
| 6 #define CC_SURFACES_SURFACE_RESOURCE_HOLDER_H_ | 6 #define CC_SURFACES_SURFACE_RESOURCE_HOLDER_H_ |
| 7 | 7 |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "cc/resources/resource_provider.h" | 10 #include "cc/resources/resource_id.h" |
| 11 #include "cc/resources/returned_resource.h" | 11 #include "cc/resources/returned_resource.h" |
| 12 #include "cc/resources/transferable_resource.h" |
| 12 #include "cc/surfaces/surfaces_export.h" | 13 #include "cc/surfaces/surfaces_export.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 class SurfaceFactoryClient; | 16 class SurfaceFactoryClient; |
| 16 | 17 |
| 17 // A SurfaceResourceHolder manages the lifetime of resources submitted by a | 18 // A SurfaceResourceHolder manages the lifetime of resources submitted by a |
| 18 // particular SurfaceFactory. Each resource is held by the service until | 19 // particular SurfaceFactory. Each resource is held by the service until |
| 19 // it is no longer referenced by any pending frames or by any | 20 // it is no longer referenced by any pending frames or by any |
| 20 // resource providers. | 21 // resource providers. |
| 21 class CC_SURFACES_EXPORT SurfaceResourceHolder { | 22 class CC_SURFACES_EXPORT SurfaceResourceHolder { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 | 33 |
| 33 struct ResourceRefs { | 34 struct ResourceRefs { |
| 34 ResourceRefs(); | 35 ResourceRefs(); |
| 35 | 36 |
| 36 int refs_received_from_child; | 37 int refs_received_from_child; |
| 37 int refs_holding_resource_alive; | 38 int refs_holding_resource_alive; |
| 38 }; | 39 }; |
| 39 // Keeps track of the number of users currently in flight for each resource | 40 // Keeps track of the number of users currently in flight for each resource |
| 40 // ID we've received from the client. When this counter hits zero for a | 41 // ID we've received from the client. When this counter hits zero for a |
| 41 // particular resource, that ID is available to return to the client. | 42 // particular resource, that ID is available to return to the client. |
| 42 typedef base::hash_map<ResourceProvider::ResourceId, ResourceRefs> | 43 typedef base::hash_map<ResourceId, ResourceRefs> ResourceIdCountMap; |
| 43 ResourceIdCountMap; | |
| 44 ResourceIdCountMap resource_id_use_count_map_; | 44 ResourceIdCountMap resource_id_use_count_map_; |
| 45 | 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(SurfaceResourceHolder); | 46 DISALLOW_COPY_AND_ASSIGN(SurfaceResourceHolder); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 } // namespace cc | 49 } // namespace cc |
| 50 | 50 |
| 51 #endif // CC_SURFACES_SURFACE_RESOURCE_HOLDER_H_ | 51 #endif // CC_SURFACES_SURFACE_RESOURCE_HOLDER_H_ |
| OLD | NEW |