summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-27 19:39:39 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-27 19:39:39 +0000
commiteadc9679d5b47b498877d074efdc0ca913bd09b8 (patch)
treefc5e2c8185f4d4435b528fc286ea5cc37f505319 /gpu
parent3a5b6ea5e1447b58bedbc367dbdc0fc0cbfd8a48 (diff)
downloadchromium_src-eadc9679d5b47b498877d074efdc0ca913bd09b8.zip
chromium_src-eadc9679d5b47b498877d074efdc0ca913bd09b8.tar.gz
chromium_src-eadc9679d5b47b498877d074efdc0ca913bd09b8.tar.bz2
Fix destruction order of ContextGroup
TEST=none BUG=60777 Review URL: http://codereview.chromium.org/4153003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64121 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/context_group.h4
-rw-r--r--gpu/command_buffer/service/context_group_unittest.cc2
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc10
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc2
4 files changed, 11 insertions, 7 deletions
diff --git a/gpu/command_buffer/service/context_group.h b/gpu/command_buffer/service/context_group.h
index 9d0efd4..f3ae4b7 100644
--- a/gpu/command_buffer/service/context_group.h
+++ b/gpu/command_buffer/service/context_group.h
@@ -41,8 +41,8 @@ class ContextGroup : public base::RefCounted<ContextGroup> {
bool Initialize(const char* allowed_features);
// Sets the ContextGroup has having a lost context.
- void SetLostContext() {
- have_context_ = false;
+ void set_have_context(bool have_context) {
+ have_context_ = have_context;
}
uint32 max_vertex_attribs() const {
diff --git a/gpu/command_buffer/service/context_group_unittest.cc b/gpu/command_buffer/service/context_group_unittest.cc
index 006cfe3..78accf9 100644
--- a/gpu/command_buffer/service/context_group_unittest.cc
+++ b/gpu/command_buffer/service/context_group_unittest.cc
@@ -43,7 +43,7 @@ class ContextGroupTest : public testing::Test {
virtual void TearDown() {
// we must release the ContextGroup before we clear out the GL interface.
// since its destructor uses GL.
- group_->SetLostContext();
+ group_->set_have_context(false);
group_ = NULL;
::gfx::GLInterface::SetGLInterface(NULL);
gl_.reset();
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 94a6e04..7f3bac22 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2342,9 +2342,9 @@ bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id,
}
void GLES2DecoderImpl::Destroy() {
- if (context_.get()) {
- MakeCurrent();
-
+ bool have_context = context_.get() && MakeCurrent();
+ group_->set_have_context(have_context);
+ if (have_context) {
if (attrib_0_buffer_id_) {
glDeleteBuffersARB(1, &attrib_0_buffer_id_);
}
@@ -2399,6 +2399,10 @@ void GLES2DecoderImpl::Destroy() {
offscreen_saved_color_texture_.reset();
}
+ // must release the ContextGroup before destroying the context as its
+ // destructor uses GL.
+ group_ = NULL;
+
context_->Destroy();
context_.reset();
}
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
index 79af216..de3a528 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -150,7 +150,7 @@ void GLES2DecoderTestBase::TearDown() {
.RetiresOnSaturation();
decoder_->Destroy();
decoder_.reset();
- group_->SetLostContext();
+ group_->set_have_context(false);
group_ = NULL;
engine_.reset();
::gfx::GLInterface::SetGLInterface(NULL);