diff options
author | kkinnunen <kkinnunen@nvidia.com> | 2014-10-03 01:30:38 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-03 08:30:56 +0000 |
commit | 06d32878eeabdf9a12c76b8ee89bd5ac5b81d648 (patch) | |
tree | 3f204fef3a852d591d3160613d2cf7c8e3ff3510 /gpu/command_buffer/common | |
parent | 28f92e19b5356243b4b90cd1b3824fab3dfd8e50 (diff) | |
download | chromium_src-06d32878eeabdf9a12c76b8ee89bd5ac5b81d648.zip chromium_src-06d32878eeabdf9a12c76b8ee89bd5ac5b81d648.tar.gz chromium_src-06d32878eeabdf9a12c76b8ee89bd5ac5b81d648.tar.bz2 |
command_buffer: Remove unused shared id code (GenSharedIdsCHROMIUM, ...)
Remove unused shared id code from gpu command buffer. The functions
removed are glGenSharedIdsCHROMIUM, glDeleteSharedIdsCHROMIUM,
glRegisterSharedIdsCHROMIUM. The functions are not specified by the
pseudo-extensions and it appears as if they have never been called. Also
PPAPI does not expose these.
This simplifies working with id generation logic. Removes the extra,
unused id allocation for various id namespaces from the service side.
Also fixes gpu process null pointer deref when the *SharedId
commands would have an invalid namespace id.
Review URL: https://codereview.chromium.org/621673002
Cr-Commit-Position: refs/heads/master@{#298012}
Diffstat (limited to 'gpu/command_buffer/common')
-rw-r--r-- | gpu/command_buffer/common/gles2_cmd_format_autogen.h | 165 | ||||
-rw-r--r-- | gpu/command_buffer/common/gles2_cmd_format_test_autogen.h | 55 | ||||
-rw-r--r-- | gpu/command_buffer/common/gles2_cmd_ids_autogen.h | 75 | ||||
-rw-r--r-- | gpu/command_buffer/common/id_allocator.cc | 33 | ||||
-rw-r--r-- | gpu/command_buffer/common/id_allocator.h | 52 |
5 files changed, 45 insertions, 335 deletions
diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h index 3dbe44d..ccdc040 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h @@ -7430,171 +7430,6 @@ COMPILE_ASSERT(offsetof(GetMaxValueInBufferCHROMIUM, result_shm_id) == 20, COMPILE_ASSERT(offsetof(GetMaxValueInBufferCHROMIUM, result_shm_offset) == 24, OffsetOf_GetMaxValueInBufferCHROMIUM_result_shm_offset_not_24); -struct GenSharedIdsCHROMIUM { - typedef GenSharedIdsCHROMIUM ValueType; - static const CommandId kCmdId = kGenSharedIdsCHROMIUM; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); - - static uint32_t ComputeSize() { - return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { header.SetCmd<ValueType>(); } - - void Init(GLuint _namespace_id, - GLuint _id_offset, - GLsizei _n, - uint32_t _ids_shm_id, - uint32_t _ids_shm_offset) { - SetHeader(); - namespace_id = _namespace_id; - id_offset = _id_offset; - n = _n; - ids_shm_id = _ids_shm_id; - ids_shm_offset = _ids_shm_offset; - } - - void* Set(void* cmd, - GLuint _namespace_id, - GLuint _id_offset, - GLsizei _n, - uint32_t _ids_shm_id, - uint32_t _ids_shm_offset) { - static_cast<ValueType*>(cmd) - ->Init(_namespace_id, _id_offset, _n, _ids_shm_id, _ids_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - gpu::CommandHeader header; - uint32_t namespace_id; - uint32_t id_offset; - int32_t n; - uint32_t ids_shm_id; - uint32_t ids_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GenSharedIdsCHROMIUM) == 24, - Sizeof_GenSharedIdsCHROMIUM_is_not_24); -COMPILE_ASSERT(offsetof(GenSharedIdsCHROMIUM, header) == 0, - OffsetOf_GenSharedIdsCHROMIUM_header_not_0); -COMPILE_ASSERT(offsetof(GenSharedIdsCHROMIUM, namespace_id) == 4, - OffsetOf_GenSharedIdsCHROMIUM_namespace_id_not_4); -COMPILE_ASSERT(offsetof(GenSharedIdsCHROMIUM, id_offset) == 8, - OffsetOf_GenSharedIdsCHROMIUM_id_offset_not_8); -COMPILE_ASSERT(offsetof(GenSharedIdsCHROMIUM, n) == 12, - OffsetOf_GenSharedIdsCHROMIUM_n_not_12); -COMPILE_ASSERT(offsetof(GenSharedIdsCHROMIUM, ids_shm_id) == 16, - OffsetOf_GenSharedIdsCHROMIUM_ids_shm_id_not_16); -COMPILE_ASSERT(offsetof(GenSharedIdsCHROMIUM, ids_shm_offset) == 20, - OffsetOf_GenSharedIdsCHROMIUM_ids_shm_offset_not_20); - -struct DeleteSharedIdsCHROMIUM { - typedef DeleteSharedIdsCHROMIUM ValueType; - static const CommandId kCmdId = kDeleteSharedIdsCHROMIUM; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); - - static uint32_t ComputeSize() { - return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { header.SetCmd<ValueType>(); } - - void Init(GLuint _namespace_id, - GLsizei _n, - uint32_t _ids_shm_id, - uint32_t _ids_shm_offset) { - SetHeader(); - namespace_id = _namespace_id; - n = _n; - ids_shm_id = _ids_shm_id; - ids_shm_offset = _ids_shm_offset; - } - - void* Set(void* cmd, - GLuint _namespace_id, - GLsizei _n, - uint32_t _ids_shm_id, - uint32_t _ids_shm_offset) { - static_cast<ValueType*>(cmd) - ->Init(_namespace_id, _n, _ids_shm_id, _ids_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - gpu::CommandHeader header; - uint32_t namespace_id; - int32_t n; - uint32_t ids_shm_id; - uint32_t ids_shm_offset; -}; - -COMPILE_ASSERT(sizeof(DeleteSharedIdsCHROMIUM) == 20, - Sizeof_DeleteSharedIdsCHROMIUM_is_not_20); -COMPILE_ASSERT(offsetof(DeleteSharedIdsCHROMIUM, header) == 0, - OffsetOf_DeleteSharedIdsCHROMIUM_header_not_0); -COMPILE_ASSERT(offsetof(DeleteSharedIdsCHROMIUM, namespace_id) == 4, - OffsetOf_DeleteSharedIdsCHROMIUM_namespace_id_not_4); -COMPILE_ASSERT(offsetof(DeleteSharedIdsCHROMIUM, n) == 8, - OffsetOf_DeleteSharedIdsCHROMIUM_n_not_8); -COMPILE_ASSERT(offsetof(DeleteSharedIdsCHROMIUM, ids_shm_id) == 12, - OffsetOf_DeleteSharedIdsCHROMIUM_ids_shm_id_not_12); -COMPILE_ASSERT(offsetof(DeleteSharedIdsCHROMIUM, ids_shm_offset) == 16, - OffsetOf_DeleteSharedIdsCHROMIUM_ids_shm_offset_not_16); - -struct RegisterSharedIdsCHROMIUM { - typedef RegisterSharedIdsCHROMIUM ValueType; - static const CommandId kCmdId = kRegisterSharedIdsCHROMIUM; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); - - static uint32_t ComputeSize() { - return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { header.SetCmd<ValueType>(); } - - void Init(GLuint _namespace_id, - GLsizei _n, - uint32_t _ids_shm_id, - uint32_t _ids_shm_offset) { - SetHeader(); - namespace_id = _namespace_id; - n = _n; - ids_shm_id = _ids_shm_id; - ids_shm_offset = _ids_shm_offset; - } - - void* Set(void* cmd, - GLuint _namespace_id, - GLsizei _n, - uint32_t _ids_shm_id, - uint32_t _ids_shm_offset) { - static_cast<ValueType*>(cmd) - ->Init(_namespace_id, _n, _ids_shm_id, _ids_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - gpu::CommandHeader header; - uint32_t namespace_id; - int32_t n; - uint32_t ids_shm_id; - uint32_t ids_shm_offset; -}; - -COMPILE_ASSERT(sizeof(RegisterSharedIdsCHROMIUM) == 20, - Sizeof_RegisterSharedIdsCHROMIUM_is_not_20); -COMPILE_ASSERT(offsetof(RegisterSharedIdsCHROMIUM, header) == 0, - OffsetOf_RegisterSharedIdsCHROMIUM_header_not_0); -COMPILE_ASSERT(offsetof(RegisterSharedIdsCHROMIUM, namespace_id) == 4, - OffsetOf_RegisterSharedIdsCHROMIUM_namespace_id_not_4); -COMPILE_ASSERT(offsetof(RegisterSharedIdsCHROMIUM, n) == 8, - OffsetOf_RegisterSharedIdsCHROMIUM_n_not_8); -COMPILE_ASSERT(offsetof(RegisterSharedIdsCHROMIUM, ids_shm_id) == 12, - OffsetOf_RegisterSharedIdsCHROMIUM_ids_shm_id_not_12); -COMPILE_ASSERT(offsetof(RegisterSharedIdsCHROMIUM, ids_shm_offset) == 16, - OffsetOf_RegisterSharedIdsCHROMIUM_ids_shm_offset_not_16); - struct EnableFeatureCHROMIUM { typedef EnableFeatureCHROMIUM ValueType; static const CommandId kCmdId = kEnableFeatureCHROMIUM; diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h index 5211286..7b7845b 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h @@ -2664,61 +2664,6 @@ TEST_F(GLES2FormatTest, GetMaxValueInBufferCHROMIUM) { CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } -TEST_F(GLES2FormatTest, GenSharedIdsCHROMIUM) { - cmds::GenSharedIdsCHROMIUM& cmd = *GetBufferAs<cmds::GenSharedIdsCHROMIUM>(); - void* next_cmd = cmd.Set(&cmd, - static_cast<GLuint>(11), - static_cast<GLuint>(12), - static_cast<GLsizei>(13), - static_cast<uint32_t>(14), - static_cast<uint32_t>(15)); - EXPECT_EQ(static_cast<uint32_t>(cmds::GenSharedIdsCHROMIUM::kCmdId), - cmd.header.command); - EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); - EXPECT_EQ(static_cast<GLuint>(11), cmd.namespace_id); - EXPECT_EQ(static_cast<GLuint>(12), cmd.id_offset); - EXPECT_EQ(static_cast<GLsizei>(13), cmd.n); - EXPECT_EQ(static_cast<uint32_t>(14), cmd.ids_shm_id); - EXPECT_EQ(static_cast<uint32_t>(15), cmd.ids_shm_offset); - CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); -} - -TEST_F(GLES2FormatTest, DeleteSharedIdsCHROMIUM) { - cmds::DeleteSharedIdsCHROMIUM& cmd = - *GetBufferAs<cmds::DeleteSharedIdsCHROMIUM>(); - void* next_cmd = cmd.Set(&cmd, - static_cast<GLuint>(11), - static_cast<GLsizei>(12), - static_cast<uint32_t>(13), - static_cast<uint32_t>(14)); - EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteSharedIdsCHROMIUM::kCmdId), - cmd.header.command); - EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); - EXPECT_EQ(static_cast<GLuint>(11), cmd.namespace_id); - EXPECT_EQ(static_cast<GLsizei>(12), cmd.n); - EXPECT_EQ(static_cast<uint32_t>(13), cmd.ids_shm_id); - EXPECT_EQ(static_cast<uint32_t>(14), cmd.ids_shm_offset); - CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); -} - -TEST_F(GLES2FormatTest, RegisterSharedIdsCHROMIUM) { - cmds::RegisterSharedIdsCHROMIUM& cmd = - *GetBufferAs<cmds::RegisterSharedIdsCHROMIUM>(); - void* next_cmd = cmd.Set(&cmd, - static_cast<GLuint>(11), - static_cast<GLsizei>(12), - static_cast<uint32_t>(13), - static_cast<uint32_t>(14)); - EXPECT_EQ(static_cast<uint32_t>(cmds::RegisterSharedIdsCHROMIUM::kCmdId), - cmd.header.command); - EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); - EXPECT_EQ(static_cast<GLuint>(11), cmd.namespace_id); - EXPECT_EQ(static_cast<GLsizei>(12), cmd.n); - EXPECT_EQ(static_cast<uint32_t>(13), cmd.ids_shm_id); - EXPECT_EQ(static_cast<uint32_t>(14), cmd.ids_shm_offset); - CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); -} - TEST_F(GLES2FormatTest, EnableFeatureCHROMIUM) { cmds::EnableFeatureCHROMIUM& cmd = *GetBufferAs<cmds::EnableFeatureCHROMIUM>(); diff --git a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h index 474df6d..030ada2 100644 --- a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h @@ -174,45 +174,42 @@ OP(BindVertexArrayOES) /* 415 */ \ OP(SwapBuffers) /* 416 */ \ OP(GetMaxValueInBufferCHROMIUM) /* 417 */ \ - OP(GenSharedIdsCHROMIUM) /* 418 */ \ - OP(DeleteSharedIdsCHROMIUM) /* 419 */ \ - OP(RegisterSharedIdsCHROMIUM) /* 420 */ \ - OP(EnableFeatureCHROMIUM) /* 421 */ \ - OP(ResizeCHROMIUM) /* 422 */ \ - OP(GetRequestableExtensionsCHROMIUM) /* 423 */ \ - OP(RequestExtensionCHROMIUM) /* 424 */ \ - OP(GetMultipleIntegervCHROMIUM) /* 425 */ \ - OP(GetProgramInfoCHROMIUM) /* 426 */ \ - OP(GetTranslatedShaderSourceANGLE) /* 427 */ \ - OP(PostSubBufferCHROMIUM) /* 428 */ \ - OP(TexImageIOSurface2DCHROMIUM) /* 429 */ \ - OP(CopyTextureCHROMIUM) /* 430 */ \ - OP(DrawArraysInstancedANGLE) /* 431 */ \ - OP(DrawElementsInstancedANGLE) /* 432 */ \ - OP(VertexAttribDivisorANGLE) /* 433 */ \ - OP(GenMailboxCHROMIUM) /* 434 */ \ - OP(ProduceTextureCHROMIUMImmediate) /* 435 */ \ - OP(ProduceTextureDirectCHROMIUMImmediate) /* 436 */ \ - OP(ConsumeTextureCHROMIUMImmediate) /* 437 */ \ - OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 438 */ \ - OP(BindUniformLocationCHROMIUMBucket) /* 439 */ \ - OP(BindTexImage2DCHROMIUM) /* 440 */ \ - OP(ReleaseTexImage2DCHROMIUM) /* 441 */ \ - OP(TraceBeginCHROMIUM) /* 442 */ \ - OP(TraceEndCHROMIUM) /* 443 */ \ - OP(AsyncTexSubImage2DCHROMIUM) /* 444 */ \ - OP(AsyncTexImage2DCHROMIUM) /* 445 */ \ - OP(WaitAsyncTexImage2DCHROMIUM) /* 446 */ \ - OP(WaitAllAsyncTexImage2DCHROMIUM) /* 447 */ \ - OP(DiscardFramebufferEXTImmediate) /* 448 */ \ - OP(LoseContextCHROMIUM) /* 449 */ \ - OP(InsertSyncPointCHROMIUM) /* 450 */ \ - OP(WaitSyncPointCHROMIUM) /* 451 */ \ - OP(DrawBuffersEXTImmediate) /* 452 */ \ - OP(DiscardBackbufferCHROMIUM) /* 453 */ \ - OP(ScheduleOverlayPlaneCHROMIUM) /* 454 */ \ - OP(MatrixLoadfCHROMIUMImmediate) /* 455 */ \ - OP(MatrixLoadIdentityCHROMIUM) /* 456 */ + OP(EnableFeatureCHROMIUM) /* 418 */ \ + OP(ResizeCHROMIUM) /* 419 */ \ + OP(GetRequestableExtensionsCHROMIUM) /* 420 */ \ + OP(RequestExtensionCHROMIUM) /* 421 */ \ + OP(GetMultipleIntegervCHROMIUM) /* 422 */ \ + OP(GetProgramInfoCHROMIUM) /* 423 */ \ + OP(GetTranslatedShaderSourceANGLE) /* 424 */ \ + OP(PostSubBufferCHROMIUM) /* 425 */ \ + OP(TexImageIOSurface2DCHROMIUM) /* 426 */ \ + OP(CopyTextureCHROMIUM) /* 427 */ \ + OP(DrawArraysInstancedANGLE) /* 428 */ \ + OP(DrawElementsInstancedANGLE) /* 429 */ \ + OP(VertexAttribDivisorANGLE) /* 430 */ \ + OP(GenMailboxCHROMIUM) /* 431 */ \ + OP(ProduceTextureCHROMIUMImmediate) /* 432 */ \ + OP(ProduceTextureDirectCHROMIUMImmediate) /* 433 */ \ + OP(ConsumeTextureCHROMIUMImmediate) /* 434 */ \ + OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 435 */ \ + OP(BindUniformLocationCHROMIUMBucket) /* 436 */ \ + OP(BindTexImage2DCHROMIUM) /* 437 */ \ + OP(ReleaseTexImage2DCHROMIUM) /* 438 */ \ + OP(TraceBeginCHROMIUM) /* 439 */ \ + OP(TraceEndCHROMIUM) /* 440 */ \ + OP(AsyncTexSubImage2DCHROMIUM) /* 441 */ \ + OP(AsyncTexImage2DCHROMIUM) /* 442 */ \ + OP(WaitAsyncTexImage2DCHROMIUM) /* 443 */ \ + OP(WaitAllAsyncTexImage2DCHROMIUM) /* 444 */ \ + OP(DiscardFramebufferEXTImmediate) /* 445 */ \ + OP(LoseContextCHROMIUM) /* 446 */ \ + OP(InsertSyncPointCHROMIUM) /* 447 */ \ + OP(WaitSyncPointCHROMIUM) /* 448 */ \ + OP(DrawBuffersEXTImmediate) /* 449 */ \ + OP(DiscardBackbufferCHROMIUM) /* 450 */ \ + OP(ScheduleOverlayPlaneCHROMIUM) /* 451 */ \ + OP(MatrixLoadfCHROMIUMImmediate) /* 452 */ \ + OP(MatrixLoadIdentityCHROMIUM) /* 453 */ enum CommandId { kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this. diff --git a/gpu/command_buffer/common/id_allocator.cc b/gpu/command_buffer/common/id_allocator.cc index 7802e17..507b14e 100644 --- a/gpu/command_buffer/common/id_allocator.cc +++ b/gpu/command_buffer/common/id_allocator.cc @@ -10,9 +10,6 @@ namespace gpu { -IdAllocatorInterface::~IdAllocatorInterface() { -} - IdAllocator::IdAllocator() {} IdAllocator::~IdAllocator() {} @@ -89,34 +86,4 @@ ResourceId IdAllocator::FindFirstUnusedId() const { return id; } -NonReusedIdAllocator::NonReusedIdAllocator() : last_id_(0) { -} - -NonReusedIdAllocator::~NonReusedIdAllocator() { -} - -ResourceId NonReusedIdAllocator::AllocateID() { - return ++last_id_; -} - -ResourceId NonReusedIdAllocator::AllocateIDAtOrAbove(ResourceId desired_id) { - if (desired_id > last_id_) - last_id_ = desired_id; - - return ++last_id_; -} - -bool NonReusedIdAllocator::MarkAsUsed(ResourceId id) { - NOTREACHED(); - return false; -} - -void NonReusedIdAllocator::FreeID(ResourceId id) { -} - -bool NonReusedIdAllocator::InUse(ResourceId id) const { - NOTREACHED(); - return false; -} - } // namespace gpu diff --git a/gpu/command_buffer/common/id_allocator.h b/gpu/command_buffer/common/id_allocator.h index 3f2dc4a..b8770830 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_ |