Index: gpu/command_buffer/common/id_allocator.h |
diff --git a/gpu/command_buffer/common/id_allocator.h b/gpu/command_buffer/common/id_allocator.h |
index 3f2dc4a65e295c2b3e4d42ab9633c366c6de0b43..b877083008ad724f515799283d66173215d03344 100644 |
--- a/gpu/command_buffer/common/id_allocator.h |
+++ b/gpu/command_buffer/common/id_allocator.h |
@@ -23,39 +23,27 @@ typedef uint32_t ResourceId; |
// Invalid resource ID. |
static const ResourceId kInvalidResource = 0u; |
-class GPU_EXPORT IdAllocatorInterface { |
+// A class to manage the allocation of resource IDs. |
+class GPU_EXPORT IdAllocator { |
public: |
- virtual ~IdAllocatorInterface(); |
+ IdAllocator(); |
+ ~IdAllocator(); |
// Allocates a new resource ID. |
- virtual ResourceId AllocateID() = 0; |
+ ResourceId AllocateID(); |
// Allocates an Id starting at or above desired_id. |
// Note: may wrap if it starts near limit. |
- virtual ResourceId AllocateIDAtOrAbove(ResourceId desired_id) = 0; |
+ ResourceId AllocateIDAtOrAbove(ResourceId desired_id); |
// Marks an id as used. Returns false if id was already used. |
- virtual bool MarkAsUsed(ResourceId id) = 0; |
+ bool MarkAsUsed(ResourceId id); |
// Frees a resource ID. |
- virtual void FreeID(ResourceId id) = 0; |
+ void FreeID(ResourceId id); |
// Checks whether or not a resource ID is in use. |
- virtual bool InUse(ResourceId id) const = 0; |
-}; |
- |
-// A class to manage the allocation of resource IDs. |
-class GPU_EXPORT IdAllocator : public IdAllocatorInterface { |
- public: |
- IdAllocator(); |
- virtual ~IdAllocator(); |
- |
- // Implement IdAllocatorInterface. |
- virtual ResourceId AllocateID() OVERRIDE; |
- virtual ResourceId AllocateIDAtOrAbove(ResourceId desired_id) OVERRIDE; |
- virtual bool MarkAsUsed(ResourceId id) OVERRIDE; |
- virtual void FreeID(ResourceId id) OVERRIDE; |
- virtual bool InUse(ResourceId id) const OVERRIDE; |
+ bool InUse(ResourceId id) const; |
private: |
// TODO(gman): This would work much better with ranges or a hash table. |
@@ -73,28 +61,6 @@ class GPU_EXPORT IdAllocator : public IdAllocatorInterface { |
DISALLOW_COPY_AND_ASSIGN(IdAllocator); |
}; |
-// A class to manage the allocation of resource IDs that are never reused. This |
-// implementation does not track which IDs are currently used. It is useful for |
-// shared and programs which cannot be implicitly created by binding a |
-// previously unused ID. |
-class NonReusedIdAllocator : public IdAllocatorInterface { |
- public: |
- NonReusedIdAllocator(); |
- virtual ~NonReusedIdAllocator(); |
- |
- // Implement IdAllocatorInterface. |
- virtual ResourceId AllocateID() OVERRIDE; |
- virtual ResourceId AllocateIDAtOrAbove(ResourceId desired_id) OVERRIDE; |
- virtual bool MarkAsUsed(ResourceId id) OVERRIDE; |
- virtual void FreeID(ResourceId id) OVERRIDE; |
- virtual bool InUse(ResourceId id) const OVERRIDE; |
- |
- private: |
- ResourceId last_id_; |
- |
- DISALLOW_COPY_AND_ASSIGN(NonReusedIdAllocator); |
-}; |
- |
} // namespace gpu |
#endif // GPU_COMMAND_BUFFER_CLIENT_ID_ALLOCATOR_H_ |