Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: gpu/command_buffer/common/id_allocator.h

Issue 3743001: FBTF: Fix more ctor/dtors found by clang plugin. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Rebase to pick up mac fix on ToT Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/client/mapped_memory.cc ('k') | gpu/command_buffer/common/id_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 76edc346690122902abb8bccc4c6676fcaa82eef..05c6af070b67d1af80f810841403c9882fb833c5 100644
--- a/gpu/command_buffer/common/id_allocator.h
+++ b/gpu/command_buffer/common/id_allocator.h
@@ -22,33 +22,23 @@ static const ResourceId kInvalidResource = 0u;
class IdAllocator {
public:
IdAllocator();
+ ~IdAllocator();
// Allocates a new resource ID.
- ResourceId AllocateID() {
- ResourceId id = FindFirstFree();
- MarkAsUsed(id);
- return id;
- }
+ ResourceId AllocateID();
// Allocates an Id starting at or above desired_id.
// Note: may wrap if it starts near limit.
ResourceId AllocateIDAtOrAbove(ResourceId desired_id);
// Marks an id as used. Returns false if id was already used.
- bool MarkAsUsed(ResourceId id) {
- std::pair<ResourceIdSet::iterator, bool> result = used_ids_.insert(id);
- return result.second;
- }
+ bool MarkAsUsed(ResourceId id);
// Frees a resource ID.
- void FreeID(ResourceId id) {
- used_ids_.erase(id);
- }
+ void FreeID(ResourceId id);
// Checks whether or not a resource ID is in use.
- bool InUse(ResourceId id) const {
- return id == kInvalidResource || used_ids_.find(id) != used_ids_.end();
- }
+ bool InUse(ResourceId id) const;
private:
// TODO(gman): This would work much better with ranges or a hash table.
« no previous file with comments | « gpu/command_buffer/client/mapped_memory.cc ('k') | gpu/command_buffer/common/id_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698