Index: gpu/command_buffer/service/context_group.cc |
=================================================================== |
--- gpu/command_buffer/service/context_group.cc (revision 51426) |
+++ gpu/command_buffer/service/context_group.cc (working copy) |
@@ -26,6 +26,13 @@ |
} |
ContextGroup::~ContextGroup() { |
+ // Check that Destroy has been called. |
+ DCHECK(buffer_manager_ == NULL); |
+ DCHECK(framebuffer_manager_ == NULL); |
+ DCHECK(renderbuffer_manager_ == NULL); |
+ DCHECK(texture_manager_ == NULL); |
+ DCHECK(program_manager_ == NULL); |
+ DCHECK(shader_manager_ == NULL); |
} |
static void GetIntegerv(GLenum pname, uint32* var) { |
@@ -87,6 +94,38 @@ |
return true; |
} |
+void ContextGroup::Destroy(bool have_context) { |
+ if (buffer_manager_ != NULL) { |
+ buffer_manager_->Destroy(have_context); |
+ buffer_manager_.reset(); |
+ } |
+ |
+ if (framebuffer_manager_ != NULL) { |
+ framebuffer_manager_->Destroy(have_context); |
+ framebuffer_manager_.reset(); |
+ } |
+ |
+ if (renderbuffer_manager_ != NULL) { |
+ renderbuffer_manager_->Destroy(have_context); |
+ renderbuffer_manager_.reset(); |
+ } |
+ |
+ if (texture_manager_ != NULL) { |
+ texture_manager_->Destroy(have_context); |
+ texture_manager_.reset(); |
+ } |
+ |
+ if (program_manager_ != NULL) { |
+ program_manager_->Destroy(have_context); |
+ program_manager_.reset(); |
+ } |
+ |
+ if (shader_manager_ != NULL) { |
+ shader_manager_->Destroy(have_context); |
+ shader_manager_.reset(); |
+ } |
+} |
+ |
IdAllocator* ContextGroup::GetIdAllocator(unsigned namespace_id) { |
IdAllocatorMap::iterator it = id_namespaces_.find(namespace_id); |
if (it != id_namespaces_.end()) { |